1515class CollisionMesh (object ):
1616 """Represents a collision mesh.
1717
18+ Parameters
19+ ----------
20+ mesh : :class:`compas.datastructures.Mesh`
21+ The collision mesh. Ideally it is as coarse as possible.
22+ id : :obj:`str`
23+ The id of the mesh, used to identify it for later operations
24+ (:meth:`~PlanningScene.add_collision_mesh`,
25+ :meth:`~PlanningScene.remove_collision_mesh`,
26+ :meth:`~PlanningScene.append_collision_mesh` etc.)
27+ frame : :class:`compas.geometry.Frame`, optional
28+ The frame of the mesh. Defaults to :meth:`~compas.geometry.Frame.worldXY().
29+ root_name : :obj:`str`
30+ The name of the root link the collision mesh will be placed in. Defaults
31+ to `'world'`.
32+
1833 Attributes
1934 ----------
2035 mesh : :class:`compas.datastructures.Mesh`
2136 The collision mesh. Ideally it is as coarse as possible.
22- id : str
23- The id of the mesh, used to identify it for later operations (remove,
24- append, etc.)
37+ id : :obj:`str`
38+ The id of the mesh, used to identify it for later operations
39+ (:meth:`~PlanningScene.add_collision_mesh`,
40+ :meth:`~PlanningScene.remove_collision_mesh`,
41+ :meth:`~PlanningScene.append_collision_mesh` etc.)
2542 frame : :class:`compas.geometry.Frame`, optional
26- The frame of the mesh. Defaults to the world XY frame .
27- root_name : str
28- The name of the root link the collision mesh with be placed in. Defaults
29- to 'world'.
43+ The frame of the mesh. Defaults to :meth:`~compas.geometry.Frame.worldXY() .
44+ root_name : :obj:` str`
45+ The name of the root link the collision mesh will be placed in. Defaults
46+ to ` 'world'` .
3047
3148 Examples
3249 --------
@@ -55,19 +72,33 @@ def scale(self, scale_factor):
5572
5673
5774class AttachedCollisionMesh (object ):
58- """Represents a collision mesh that is attached to a robot's link.
75+ """Represents a collision mesh that is attached to a :class:`Robot`'s :class:`~compas.robots.Link`.
76+
77+ Parameters
78+ ----------
79+ collision_mesh : :class:`compas_fab.robots.CollisionMesh`
80+ The collision mesh to be attached to the robot model.
81+ link_name : :obj:`str`
82+ The name of the :class:`~compas.robots.Link` the collision mesh will be
83+ attached to.
84+ touch_links : :obj:`list` of :obj:`str`, optional
85+ The list of link names the collision mesh is allowed to touch. Defaults
86+ to the link it is attached to.
87+ weight : :obj:`float`, optional
88+ The weight of the attached object in kg. Defaults to ``1.0``.
5989
6090 Attributes
6191 ----------
6292 collision_mesh : :class:`compas_fab.robots.CollisionMesh`
6393 The collision mesh we want to attach.
64- link_name : str
65- The name of the link the collision mesh will be attached to.
66- touch_links : list of str
94+ link_name : :obj:`str`
95+ The name of the :class:`~compas.robots.Link` the collision mesh will be
96+ attached to.
97+ touch_links : :obj:`list` of :obj:`str`
6798 The list of link names the collision mesh is allowed to touch. Defaults
68- to the link_name it is attached to.
69- weight : float
70- The weight of the attached object. Defaults to 1 .
99+ to the link it is attached to.
100+ weight : :obj:` float`
101+ The weight of the attached object in kg .
71102
72103 Examples
73104 --------
@@ -89,45 +120,56 @@ def __init__(self, collision_mesh, link_name, touch_links=None, weight=1.):
89120class PlanningScene (object ):
90121 """Represents the planning scene.
91122
92- Attributes
123+ Parameters
93124 ----------
94- robot : :class:`compas_fab.robots. Robot`
125+ robot : :class:`Robot`
95126 A reference to the robot in the planning scene.
96127
97- Examples
98- --------
128+ Attributes
129+ ----------
130+ robot : :class:`Robot`
131+ A reference to the robot in the planning scene.
132+ client
133+ A reference to the robot's backend client.
99134 """
100135
101136 def __init__ (self , robot ):
102137 self .robot = robot
103138
104139 @property
105140 def client (self ):
106- """The backend client."""
141+ """:class:`compas_fab.backend.RosClient` or :class:`compas_fab.backend.VrepClient` : The backend client."""
107142 return self .robot .client
108143
109144 def ensure_client (self ):
145+ """Ensure that the planning scene's robot has a defined client.
146+
147+ Raises
148+ ------
149+ :exc:`Exception`
150+ If no client is set for planning scene's robot.
151+ """
110152 if not self .client :
111153 raise Exception (
112154 'This method is only callable once a client is assigned' )
113155
114156 def add_collision_mesh (self , collision_mesh , scale = False ):
115- """Adds a collision mesh to the planning scene.
157+ """Add a collision mesh to the planning scene.
116158
117- If the object with the same name previously existed, it is replaced.
159+ If there is already a :class:`CollisionMesh` in the
160+ :class:`PlanningScene` with the same `id` it will be replaced.
118161
119162 Parameters
120163 ----------
121- collision_mesh : :class:`compas_fab.robots. CollisionMesh`
164+ collision_mesh : :class:`CollisionMesh`
122165 The collision mesh we want to add.
123- scale : bool, optional
124- If `True`, the mesh will be scaled according to the robot's scale
166+ scale : :obj:` bool` , optional
167+ If `` True` `, the mesh will be scaled according to the robot's scale
125168 factor.
126169
127170 Returns
128171 -------
129- None
130-
172+ ``None``
131173
132174 Examples
133175 --------
@@ -147,16 +189,16 @@ def add_collision_mesh(self, collision_mesh, scale=False):
147189 self .client .add_collision_mesh (collision_mesh )
148190
149191 def remove_collision_mesh (self , id ):
150- """Removes a collision object from the planning scene.
192+ """Remove a collision object from the planning scene.
151193
152194 Parameters
153195 ----------
154- id : str
155- The identifier of the collision object .
196+ id : :obj:` str`
197+ The `id` of the :class:`CollisionMesh` instance to remove .
156198
157199 Returns
158200 -------
159- None
201+ `` None``
160202
161203 Examples
162204 --------
@@ -167,21 +209,28 @@ def remove_collision_mesh(self, id):
167209 self .robot .client .remove_collision_mesh (id )
168210
169211 def append_collision_mesh (self , collision_mesh , scale = False ):
170- """Appends a collision mesh that already exists in the planning scene.
212+ """Append a collision mesh to the planning scene.
213+
214+ Appends a :class:`CollisionMesh` to the :class:`PlanningScene` using
215+ `id` as an identifier of a group or cluster of collision meshes. If the group
216+ does not exist, it will be created implicitly; if it does exist, the meshes will be
217+ appended to it instead.
171218
172- If the does not exist, it is added.
219+ Grouping meshes under a common identifier allows to remove them all
220+ in one operation, using the :meth:`~PlanningScene.remove_collision_mesh` with
221+ the group identifier.
173222
174223 Parameters
175224 ----------
176- collision_mesh : :class:`compas_fab.robots. CollisionMesh`
177- The collision mesh we want to append.
178- scale : bool, optional
179- If `True`, the mesh will be scaled according to the robot's scale
225+ collision_mesh : :class:`CollisionMesh`
226+ The collision mesh we want to append to the :class:`PlanningScene` .
227+ scale : :obj:` bool` , optional
228+ If `` True` `, the mesh will be scaled according to the robot's scale
180229 factor.
181230
182231 Returns
183232 -------
184- None
233+ `` None``
185234
186235 Examples
187236 --------
@@ -201,18 +250,20 @@ def append_collision_mesh(self, collision_mesh, scale=False):
201250 self .robot .client .append_collision_mesh (collision_mesh )
202251
203252 def add_attached_collision_mesh (self , attached_collision_mesh , scale = False ):
204- """Adds an attached collision object to the planning scene.
253+ """Add an attached collision object to the planning scene.
205254
206255 Parameters
207256 ----------
208- attached_collision_mesh : :class:`compas_fab.robots.AttachedCollisionMesh`
209- scale : bool, optional
210- If `True`, the mesh will be scaled according to the robot's scale
211- factor.
257+ attached_collision_mesh : :class:`AttachedCollisionMesh`
258+ The :class:`AttachedCollisionMesh` (a :class:`CollisionMesh`
259+ attached to a :class:`Robot`'s :class:`~compas.robots.Link`) that
260+ we want to add to the :class:`PlanningScene`.
261+ scale : :obj:`bool`, optional
262+ If ``True``, the mesh will be scaled using the robot's scale factor.
212263
213264 Returns
214265 -------
215- None
266+ `` None``
216267
217268 Examples
218269 --------
@@ -233,16 +284,18 @@ def add_attached_collision_mesh(self, attached_collision_mesh, scale=False):
233284 self .client .add_attached_collision_mesh (attached_collision_mesh )
234285
235286 def remove_attached_collision_mesh (self , id ):
236- """Removes an attached collision object from the planning scene.
287+ """Remove an attached collision object from the planning scene.
237288
238289 Parameters
239290 ----------
240- id : str
241- The identifier of the object.
291+ id : :obj:`str`
292+ The `id` of the :class:`CollisionMesh` in the
293+ :class:`AttachedCollisionMesh` to remove from the
294+ :class:`PlanningScene`.
242295
243296 Returns
244297 -------
245- None
298+ `` None``
246299
247300 Examples
248301 --------
@@ -257,18 +310,18 @@ def attach_collision_mesh_to_robot_end_effector(self, collision_mesh, scale=Fals
257310
258311 Parameters
259312 ----------
260- collision_mesh: :class:`compas_fab.robots. CollisionMesh`
261- The collision mesh.
262- scale : bool, optional
263- If `True`, the mesh will be scaled according to the robot's scale
313+ collision_mesh: :class:`CollisionMesh`
314+ The collision mesh to attach to robot's end effector .
315+ scale : :obj:` bool` , optional
316+ If `` True`` , the mesh will be scaled using the robot's scale
264317 factor.
265- group : str
266- The planning group to which we want to attach the mesh to. Defaults
267- to the robot's main planning group.
318+ group : :obj:` str`
319+ The planning group with the end effector we want to attach the mesh
320+ to. Defaults to the robot's main planning group.
268321
269322 Returns
270323 -------
271- None
324+ `` None``
272325
273326 Examples
274327 --------
@@ -303,15 +356,13 @@ def attach_collision_mesh_to_robot_end_effector(self, collision_mesh, scale=Fals
303356 self .add_attached_collision_mesh (acm )
304357
305358 def add_attached_tool (self ):
306- """Adds the robot's attached tool to the planning scene if set.
307- """
359+ """Add the robot's attached tool to the planning scene if tool is set."""
308360 self .ensure_client ()
309361 if self .robot .attached_tool :
310362 self .add_attached_collision_mesh (self .robot .attached_tool .attached_collision_mesh )
311363
312364 def remove_attached_tool (self ):
313- """Removes the robot's attached tool from the planning scene.
314- """
365+ """Remove the robot's attached tool from the planning scene."""
315366 self .ensure_client ()
316367 if self .robot .attached_tool :
317368 self .remove_attached_collision_mesh (self .robot .attached_tool .name )
0 commit comments