@@ -27,14 +27,25 @@ two subclasses:
27
27
28
28
Each planner has one or more * planning methods* , annotated with either the
29
29
` @LockedPlanningMethod ` or `@ClonedPlanningMethod decorator, that look like
30
- ordinary functions. However, unlike an ordinary function, calling a planning
31
- method either locks the robot environment or clones the robot's environment
32
- into a * planning environment* associated with the planner. Planning occurs in
33
- the locked or cloned environment to allow PrPy to run multiple planners in
34
- parallel and to paralellize planning and execution. In general, locked
35
- planning methods are used for calls that will terminate extremely quickly,
36
- while cloned planning methods are used for calls that might take a significant
37
- amount of time.
30
+ ordinary functions. Using these decorators makes other PrPy components
31
+ aware that these methods exist and follow a particular specification that
32
+ allows them to be composed with other PrPy objects automatically. For
33
+ example, ` MetaPlanner ` s will report that they can perform planning methods
34
+ that their child motion planners have enumerated via ` @PlanningMethod `
35
+ decorators.
36
+
37
+ ` @PlanningMethod ` decorators also make sure that calls to planning code are
38
+ executed in a thread-safe manner. In the case of ` @LockedPlanningMethod ` ,
39
+ this is enforced by locking the calling environment until the planning method
40
+ has completed. In the case of ` @ClonedPlanningMethod ` , this is enforced by
41
+ cloning the calling environment, and calling the wrapped method with references
42
+ to the cloned environment. The result of the method is then copied back to the
43
+ calling environment. ` @ClonedPlanningMethod ` s can be used to run multiple
44
+ planners in parallel and to parallelize planning and execution.
45
+
46
+ In general, ** locked** planning methods are used for calls that will terminate
47
+ extremely quickly, while ** cloned** planning methods are used for calls that
48
+ might take a significant amount of time.
38
49
39
50
For example, the following code will use OMPL to plan ` robot ` 's active DOFs
40
51
from their current values to to the ` goal_config ` configuration:
@@ -117,23 +128,34 @@ of these methods accept planner-specific keyword arguments.
117
128
118
129
Implementing a custom planner requires extending the ` BasePlanner ` class and
119
130
decorating one or more methods with the ` @LockedPlanningMethod ` or
120
- ` @ClonedPlanningMethod ` decorator. Extending the ` BasePlanner ` class constructs
121
- the planning environment ` self.env ` and allows PrPy to identify your planner
122
- as a base planner class, as opposed to a meta-planner. The ` @*PlanningMethod `
131
+ ` @ClonedPlanningMethod ` decorator.
132
+
133
+ Extending the ` BasePlanner ` class allows PrPy to identify your planner as a
134
+ base planner class, as opposed to a meta-planner. The ` @PlanningMethod `
123
135
decorators handle environment cloning or locking and allows meta-planners to
124
136
query the list of planning methods that the planner supports (e.g. to generate
125
137
docstrings).
126
138
139
+ Each instance of a ` BasePlanner ` -derived class constructs a planning
140
+ environment ` self.env ` . This environment is uniquely associated with each
141
+ instance of the planner and is what will be used in ` @ClonedPlanningMethod `
142
+ calls. Since this environment is persistent and unique, it can also be used
143
+ as a place to cache data or pre-load plugins for planners that have heavyweight
144
+ initialization steps. However, because of this, each planning instance can
145
+ only execute one ` @ClonedPlanningMethod ` at a time. It can still execute
146
+ arbitrary ` @LockedPlanningMethod ` calls, as long as they are referring to
147
+ robots in different environments.
148
+
127
149
Please obey the following guidelines:
128
150
129
- - Assume that the environment is locked during the entire call.
151
+ - Assume that the planning environment is locked during the entire call.
130
152
- Subclass constructors ** must** call ` BasePlanner.__init__ ` .
131
- - Each ` @* PlanningMethod ` ** must** accept the first argument ` robot ` , which is a
132
- robot in the cloned environment.
133
- - Each ` @* PlanningMethod ` ** must** accept ` **kwargs ` to ignore arguments that
153
+ - Each ` @PlanningMethod ` ** must** accept the first argument ` robot ` , which is a
154
+ robot in the environment it should be using to perform planning .
155
+ - Each ` @PlanningMethod ` ** must** accept ` **kwargs ` to ignore arguments that
134
156
are not supported by the planner.
135
- - Each ` @* PlanningMethod ` ** must** return a ` Trajectory ` which was created in
136
- the cloned environment.
157
+ - Each ` @PlanningMethod ` ** must** return a ` Trajectory ` which was created in
158
+ the same environment as the robot it was passed (e.g. ` robot.GetEnv() ` ) .
137
159
- When possible, use one of the defacto-standard ` @*PlanningMethod ` names listed
138
160
below.
139
161
- Raise a ` PlanningError ` to indicate an expected, but fatal, error (e.g.
0 commit comments