Skip to content

Commit ef12e3e

Browse files
committed
Update documentation for Robot and Tool classes. Attributes be complete now.
1 parent 21da373 commit ef12e3e

File tree

2 files changed

+53
-12
lines changed

2 files changed

+53
-12
lines changed

src/compas_fab/robots/robot.py

Lines changed: 52 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Robot(Data):
3434
Parameters
3535
----------
3636
model : :class:`compas_robots.RobotModel`
37-
The robot model, usually created from an URDF structure.
37+
The robot model that describes robot kinematics, typically comes from an URDF structure.
3838
scene_object : :class:`compas_robots.scene.BaseRobotModelObject`
3939
Instance of the scene object used to visualize the robot model. Defaults to ``None``.
4040
semantics : :class:`~compas_fab.robots.RobotSemantics`
@@ -48,9 +48,28 @@ class Robot(Data):
4848
attributes : :obj:`dict`
4949
Named attributes related to the robot instance.
5050
attached_tools : :obj:`dict` of [:obj:`str`, :class:`~compas_fab.robots.Tool`], read-only
51-
Dictionary of tools and the planning groups that the tools are currently attached to, if any.
51+
attached_tool : :class:`~compas_fab.robots.Tool`, read-only
52+
client : :class:`~compas_fab.backends.interfaces.ClientInterface`
53+
The backend client to use for communication.
54+
group_names : :obj:`list` of :obj:`str`, read-only
55+
group_states : :obj:`dict` of :obj:`dict`, read-only
56+
scene_object : :class:`~compas_robots.scene.BaseRobotModelObject`
57+
main_group_name : :obj:`str`, read-only
58+
model : :class:`compas_robots.RobotModel`
59+
The robot model that describes robot kinematics, typically comes from an URDF structure.
60+
name : :obj:`str`, read-only
61+
Name of the robot, as defined by its model.
62+
root_name : :obj:`str`, read-only
63+
semantics : :class:`~compas_fab.robots.RobotSemantics`
64+
The semantic model of the robot. Can be ``None`` if not loaded.
65+
scale_factor : :obj:`float`
66+
5267
"""
5368

69+
# NOTE: If the attribute function has a docstring, the first sentence will be used automatically in the class attribute's.
70+
# However, the rest of the docstring, after the first fullstop symbol will be ignored.
71+
# It is futile to add examples to the attribute docstrings, as they will not be rendered in the documentation.
72+
5473
def __init__(self, model=None, scene_object=None, semantics=None, client=None):
5574
super(Robot, self).__init__()
5675
# These attributes have to be initiated first,
@@ -95,7 +114,7 @@ def __from_data__(cls, data):
95114

96115
@property
97116
def scene_object(self):
98-
""":class:`compas_robots.scene.BaseRobotModelObject`: Scene object used to visualize robot model."""
117+
"""Scene object used to visualize robot model."""
99118
return self._scene_object
100119

101120
@scene_object.setter
@@ -143,7 +162,11 @@ def basic(cls, name, joints=None, links=None, materials=None, **kwargs):
143162

144163
@property
145164
def name(self):
146-
""":obj:`str`: Name of the robot, as defined by its model.
165+
"""Name of the robot, as defined by its model.
166+
167+
Returns
168+
-------
169+
:obj:`str`
147170
148171
Examples
149172
--------
@@ -155,7 +178,11 @@ def name(self):
155178

156179
@property
157180
def group_names(self):
158-
""":obj:`list` of :obj:`str`: All planning groups of the robot.
181+
"""All planning groups of the robot, only available if semantics is set.
182+
183+
Returns
184+
-------
185+
:obj:`list` of :obj:`str`
159186
160187
Examples
161188
--------
@@ -169,18 +196,29 @@ def group_names(self):
169196

170197
@property
171198
def main_group_name(self):
172-
""":obj:`str`: Robot's main planning group."""
199+
"""
200+
Robot's main planning group, only available if semantics is set.
201+
202+
Returns
203+
-------
204+
:obj:`str`
205+
206+
"""
173207
self.ensure_semantics()
174208
return self.semantics.main_group_name
175209

176210
@property
177211
def root_name(self):
178-
""":obj:`str`: Robot's root name."""
212+
"""Robot's root name."""
179213
return self.model.root.name
180214

181215
@property
182216
def group_states(self):
183-
""":obj:`dict` of :obj:`dict`: All group states of the robot.
217+
"""All group states of the robot, only available if semantics is set.
218+
219+
Returns
220+
-------
221+
:obj:`dict` of :obj:`dict`
184222
185223
Examples
186224
--------
@@ -194,12 +232,12 @@ def group_states(self):
194232

195233
@property
196234
def attached_tools(self):
197-
""":obj:`dict` of :obj:`robot.Tool`: Maps planning group to the tool attached to it"""
235+
"""Dictionary of tools and the planning groups that the tools are currently attached to, if any."""
198236
return self._attached_tools
199237

200238
@property
201239
def attached_tool(self):
202-
""":obj:`robot.Tool`: For backwards compatibility. Returns the tool attached to the default group, or None."""
240+
"""Returns the tool attached to the default main planning group, if any."""
203241
return self._attached_tools.get(self.main_group_name, None)
204242

205243
def get_end_effector_link_name(self, group=None):
@@ -1986,7 +2024,10 @@ def scale(self, factor):
19862024

19872025
@property
19882026
def scale_factor(self):
1989-
""":obj:`float`: Robot's scale factor."""
2027+
"""A scale factor affecting planning targets, results and visualizaion; Typically, robot models are defined in meters,
2028+
if used in CAD environemnt where units is mm, use a scale_factor of 1000.
2029+
2030+
"""
19902031
if self.scene_object:
19912032
return self.scene_object.scale_factor
19922033
else:

src/compas_fab/robots/tool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
class Tool(Data):
1616
"""Represents a tool to be attached to the robot's flange.
1717
18-
Properties
18+
Parameters
1919
----------
2020
visual : :class:`compas.datastructures.Mesh`
2121
The visual mesh of the tool.

0 commit comments

Comments
 (0)