1+ """Classes used to define robot trajectories."""
12from __future__ import absolute_import
23from __future__ import division
34from __future__ import print_function
@@ -21,12 +22,31 @@ class JointTrajectoryPoint(Configuration):
2122 Trajectory points are defined either as *values + velocities and
2223 accelerations*, or as *values + efforts*.
2324
25+ Parameters
26+ ----------
27+ values : :obj:`list` of :obj:`float`, optional
28+ Joint values expressed in radians or meters, depending on the respective
29+ type.
30+ types : :obj:`list` of :attr:`compas.robots.Joint.TYPE`, optional
31+ Joint types, e.g. a :obj:`list` of
32+ :attr:`compas.robots.Joint.REVOLUTE` for revolute joints.
33+ velocities : :obj:`list` of :obj:`float`, optional
34+ Velocity of each joint.
35+ accelerations : :obj:`list` of :obj:`float`, optional
36+ Acceleration of each joint.
37+ effort : :obj:`list` of :obj:`float`, optional
38+ Effort of each joint.
39+ time_from_start : :class:`Duration`, optional
40+ Duration of trajectory point counting from the start.
41+
2442 Attributes
2543 ----------
2644 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.
45+ Joint values expressed in radians or meters, depending on the respective
46+ type.
47+ types : :obj:`list` of :attr:`compas.robots.Joint.TYPE`
48+ Joint types, e.g. a :obj:`list` of
49+ :attr:`compas.robots.Joint.REVOLUTE` for revolute joints.
3050 velocities : :obj:`list` of :obj:`float`
3151 Velocity of each joint.
3252 accelerations : :obj:`list` of :obj:`float`
@@ -35,6 +55,10 @@ class JointTrajectoryPoint(Configuration):
3555 Effort of each joint.
3656 time_from_start : :class:`Duration`
3757 Duration of trajectory point counting from the start.
58+ positions : :obj:`list` of :obj:`float`
59+ Alias of `values`.
60+ data : obj:`dict`
61+ The data representing the trajectory point.
3862 """
3963
4064 def __init__ (self , values = None , types = None , velocities = None , accelerations = None , effort = None , time_from_start = None ):
@@ -45,6 +69,7 @@ def __init__(self, values=None, types=None, velocities=None, accelerations=None,
4569 self .time_from_start = time_from_start or Duration (0 , 0 )
4670
4771 def __str__ (self ):
72+ """Return a human-readable string representation of the instance."""
4873 vs = '%.' + self ._precision
4974 return 'JointTrajectoryPoint(({}), {}, ({}), ({}), ({}), {})' .format (
5075 ', ' .join (vs % i for i in self .values ),
@@ -57,11 +82,12 @@ def __str__(self):
5782
5883 @property
5984 def positions (self ):
60- """Alias of ``values` `."""
85+ """:obj:`list` of :obj:`float` : Alias of `values `."""
6186 return self .values
6287
6388 @property
6489 def velocities (self ):
90+ """:obj:`list` of :obj:`float` : Velocity of each joint."""
6591 return self ._velocities
6692
6793 @velocities .setter
@@ -74,6 +100,7 @@ def velocities(self, velocities):
74100
75101 @property
76102 def accelerations (self ):
103+ """:obj:`list` of :obj:`float` : Acceleration of each joint."""
77104 return self ._accelerations
78105
79106 @accelerations .setter
@@ -86,6 +113,7 @@ def accelerations(self, accelerations):
86113
87114 @property
88115 def effort (self ):
116+ """:obj:`list` of :obj:`float` : Effort of each joint."""
89117 return self ._effort
90118
91119 @effort .setter
@@ -101,7 +129,7 @@ def data(self):
101129 """:obj:`dict` : The data representing the trajectory point.
102130
103131 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
132+ configuration will be replaced by the data in the :obj:` dict` . The data getter
105133 and setter should always be used in combination with each other.
106134 """
107135 data_obj = super (JointTrajectoryPoint , self ).data
@@ -125,9 +153,9 @@ def data(self, data):
125153class Trajectory (object ):
126154 """Base trajectory class.
127155
128- Attributes
129- ----------
130- planning_time: :obj:`float`
156+ Attribute
157+ ---------
158+ planning_time : :obj:`float`
131159 Amount of time it took to complete the motion plan
132160 """
133161
@@ -138,17 +166,31 @@ def __init__(self):
138166class JointTrajectory (Trajectory ):
139167 """Describes a joint trajectory as a list of trajectory points.
140168
169+ Parameters
170+ ----------
171+ trajectory_points : :obj:`list` of :class:`JointTrajectoryPoint`, optional
172+ List of points composing the trajectory.
173+ joint_names : :obj:`list` of :obj:`str`, optional
174+ List of joint names of the trajectory.
175+ start_configuration : :class:`Configuration`, optional
176+ Start configuration for the trajectory.
177+ fraction : :obj:`float`, optional
178+ Indicates the percentage of requested trajectory that was calculated,
179+ e.g. ``1`` means the full trajectory was found.
180+
141181 Attributes
142182 ----------
143- points: :obj:`list` of :class:`JointTrajectoryPoint`
183+ points : :obj:`list` of :class:`JointTrajectoryPoint`
144184 List of points composing the trajectory.
145- joint_names: :obj:`list` of :obj:`str`
185+ joint_names : :obj:`list` of :obj:`str`
146186 List of joint names of the trajectory.
147- start_configuration: :class:`Configuration`
187+ start_configuration : :class:`Configuration`
148188 Start configuration for the trajectory.
149- fraction: float
189+ fraction : :obj:` float`
150190 Indicates the percentage of requested trajectory that was calculated,
151191 e.g. ``1`` means the full trajectory was found.
192+ data : :obj:`dict`
193+ The data representing the trajectory.
152194 """
153195
154196 def __init__ (self , trajectory_points = None , joint_names = None , start_configuration = None , fraction = None ):
@@ -177,8 +219,14 @@ def from_data(cls, data):
177219 return trajectory
178220
179221 def to_data (self ):
180- """Return the data dictionary that represents the trajectory, and from
181- which it can be reconstructed."""
222+ """Get the data dictionary that represents the trajectory.
223+
224+ This can be used to reconstruct the :class:`Trajectory` instance.
225+
226+ Returns
227+ -------
228+ :obj:`dict`
229+ """
182230 return self .data
183231
184232 @property
@@ -202,8 +250,7 @@ def data(self, data):
202250
203251 @property
204252 def time_from_start (self ):
205- """Effectively, time from start for the last point in the trajectory.
206- """
253+ """:obj:`float` : Effectively, time from start for the last point in the trajectory."""
207254 if not self .points :
208255 return 0.
209256
0 commit comments