1+ """Classes used to define robot trajectories."""
12from __future__ import absolute_import
23from __future__ import division
34from __future__ import print_function
@@ -21,17 +22,19 @@ class JointTrajectoryPoint(Configuration):
2122 Trajectory points are defined either as *values + velocities and
2223 accelerations*, or as *values + efforts*.
2324
24- Attributes
25+ Parameters
2526 ----------
26- values : :obj:`list` of :obj:`float`
27- Joint values expressed in radians or meters, depending on the respective type.
28- types : :obj:`list` of :class:`compas.robots.Joint.TYPE`
29- Joint types, e.g. a list of :class:`compas.robots.Joint.REVOLUTE` for revolute joints.
30- velocities : :obj:`list` of :obj:`float`
27+ values : :class:`list` of :class:`float`
28+ Joint values expressed in radians or meters, depending on the respective
29+ type.
30+ types : :class:`list` of :class:`compas.robots.Joint.TYPE`
31+ Joint types, e.g. a :class:`list` of
32+ :attr:`compas.robots.Joint.REVOLUTE` for revolute joints.
33+ velocities : :class:`list` of :class:`float`
3134 Velocity of each joint.
32- accelerations : :obj :`list` of :obj :`float`
35+ accelerations : :class :`list` of :class :`float`
3336 Acceleration of each joint.
34- effort : :obj :`list` of :obj :`float`
37+ effort : :class :`list` of :class :`float`
3538 Effort of each joint.
3639 time_from_start : :class:`Duration`
3740 Duration of trajectory point counting from the start.
@@ -45,6 +48,7 @@ def __init__(self, values=None, types=None, velocities=None, accelerations=None,
4548 self .time_from_start = time_from_start or Duration (0 , 0 )
4649
4750 def __str__ (self ):
51+ """Return a nicely printable representation of :class:`JointTrajectoryPoint`."""
4852 vs = '%.' + self ._precision
4953 return 'JointTrajectoryPoint(({}), {}, ({}), ({}), ({}), {})' .format (
5054 ', ' .join (vs % i for i in self .values ),
@@ -57,11 +61,12 @@ def __str__(self):
5761
5862 @property
5963 def positions (self ):
60- """Alias of ``values` `."""
64+ """:class:`list` of :class:`float` : Alias of `values `."""
6165 return self .values
6266
6367 @property
6468 def velocities (self ):
69+ """:class:`list` of :class:`float` : Velocity of each joint."""
6570 return self ._velocities
6671
6772 @velocities .setter
@@ -74,6 +79,7 @@ def velocities(self, velocities):
7479
7580 @property
7681 def accelerations (self ):
82+ """:class:`list` of :class:`float` : Acceleration of each joint."""
7783 return self ._accelerations
7884
7985 @accelerations .setter
@@ -86,6 +92,7 @@ def accelerations(self, accelerations):
8692
8793 @property
8894 def effort (self ):
95+ """:class:`list` of :class:`float` : Effort of each joint."""
8996 return self ._effort
9097
9198 @effort .setter
@@ -98,10 +105,10 @@ def effort(self, effort):
98105
99106 @property
100107 def data (self ):
101- """:obj :`dict` : The data representing the trajectory point.
108+ """:class :`dict` : The data representing the trajectory point.
102109
103110 By assigning a data dictionary to this property, the current data of the
104- configuration will be replaced by the data in the dict. The data getter
111+ configuration will be replaced by the data in the :class:` dict` . The data getter
105112 and setter should always be used in combination with each other.
106113 """
107114 data_obj = super (JointTrajectoryPoint , self ).data
@@ -127,7 +134,7 @@ class Trajectory(object):
127134
128135 Attributes
129136 ----------
130- planning_time: :obj :`float`
137+ planning_time : :class :`float`
131138 Amount of time it took to complete the motion plan
132139 """
133140
@@ -138,15 +145,15 @@ def __init__(self):
138145class JointTrajectory (Trajectory ):
139146 """Describes a joint trajectory as a list of trajectory points.
140147
141- Attributes
148+ Parameters
142149 ----------
143- points: :obj :`list` of :class:`JointTrajectoryPoint`
150+ points : :class :`list` of :class:`JointTrajectoryPoint`
144151 List of points composing the trajectory.
145- joint_names: :obj :`list` of :obj :`str`
152+ joint_names : :class :`list` of :class :`str`
146153 List of joint names of the trajectory.
147- start_configuration: :class:`Configuration`
154+ start_configuration : :class:`Configuration`
148155 Start configuration for the trajectory.
149- fraction: float
156+ fraction : :class:` float`
150157 Indicates the percentage of requested trajectory that was calcuted,
151158 e.g. ``1`` means the full trajectory was found.
152159 """
@@ -164,7 +171,7 @@ def from_data(cls, data):
164171
165172 Parameters
166173 ----------
167- data : :obj :`dict`
174+ data : :class :`dict`
168175 The data dictionary.
169176
170177 Returns
@@ -177,13 +184,19 @@ def from_data(cls, data):
177184 return trajectory
178185
179186 def to_data (self ):
180- """Return the data dictionary that represents the trajectory, and from
181- which it can be reconstructed."""
187+ """Get the data dictionary that represents the trajectory.
188+
189+ This can be used to reconstruct the :class:`Trajectory` instance.
190+
191+ Returns
192+ -------
193+ :class:`dict`
194+ """
182195 return self .data
183196
184197 @property
185198 def data (self ):
186- """:obj :`dict` : The data representing the trajectory."""
199+ """:class :`dict` : The data representing the trajectory."""
187200 data_obj = {}
188201 data_obj ['points' ] = [p .to_data () for p in self .points ]
189202 data_obj ['joint_names' ] = self .joint_names or []
@@ -202,8 +215,7 @@ def data(self, data):
202215
203216 @property
204217 def time_from_start (self ):
205- """Effectively, time from start for the last point in the trajectory.
206- """
218+ """:class:`float` : Effectively, time from start for the last point in the trajectory."""
207219 if not self .points :
208220 return 0.
209221
0 commit comments