1111
1212class Configuration (object ):
1313 """Represents the configuration of a robot based on the state of its joints.
14+
1415 This concept is also refered to as `Joint State`.
1516
16- Attributes
17+ Parameters
1718 ----------
1819 values : :obj:`list` of :obj:`float`
1920 Joint values expressed in radians or meters, depending on the respective type.
20- types : list of :class :`compas.robots.Joint.TYPE `
21+ types : list of :data :`compas.robots.Joint.SUPPORTED_TYPES `
2122 Joint types, e.g. a list of `compas.robots.Joint.REVOLUTE` for revolute joints.
2223 joint_names : :obj:`list` of :obj:`str`, optional
23- Joint names list
24+ List of joint names.
25+
26+ Attributes
27+ ----------
28+ data
29+ prismatic_values
30+ revolute_values
2431
2532 Examples
2633 --------
@@ -52,13 +59,15 @@ def __init__(self, values=None, types=None, joint_names=None):
5259 len (self .values ), len (self .values ), len (self .types )))
5360
5461 def __str__ (self ):
62+ """Nicely printable representation of :class:`Configuration`."""
5563 v_str = ('(' + ", " .join (['%.' + self ._precision ] * len (self .values )) + ')' ) % tuple (self .values )
5664 if len (self .joint_names ):
5765 return "Configuration({}, {}, {})" .format (v_str , tuple (self .types ), tuple (self .joint_names ))
5866 else :
5967 return "Configuration({}, {})" .format (v_str , tuple (self .types ))
6068
6169 def __repr__ (self ):
70+ """Printable representation of :class:`Configuration`."""
6271 return self .__str__ ()
6372
6473 @classmethod
@@ -92,7 +101,7 @@ def from_prismatic_and_revolute_values(cls, prismatic_values, revolute_values):
92101 Returns
93102 -------
94103 :class:`Configuration`
95- An instance of :class:`Configuration` instance .
104+ An instance of :class:`Configuration`.
96105 """
97106 # Force iterables into lists
98107 prismatic_values = list (prismatic_values )
@@ -114,24 +123,33 @@ def from_data(cls, data):
114123 Returns
115124 -------
116125 :class:`Configuration`
117- An instance of :class:`Configuration` instance .
126+ An instance of :class:`Configuration`.
118127 """
119128 config = cls ()
120129 config .data = data
121130 return config
122131
123132 def to_data (self ):
124- """Return the data dictionary that represents the configuration, and from
125- which it can be reconstructed."""
133+ """Get the data dictionary that represents the configuration.
134+
135+ This data can also be used to reconstruct the :class:`Configuration`
136+ instance.
137+
138+ Returns
139+ -------
140+ :class:`dict`
141+ The data representing the configuration.
142+ """
126143 return self .data
127144
128145 @property
129146 def data (self ):
130147 """:obj:`dict` : The data representing the configuration.
131148
132- By assigning a data dictionary to this property, the current data of the
133- configuration will be replaced by the data in the dict. The data getter
134- and setter should always be used in combination with each other.
149+ By assigning a data dictionary to this property, the current data of
150+ the configuration will be replaced by the data in the :obj:`dict`. The
151+ data getter and setter should always be used in combination with each
152+ other.
135153 """
136154 return {
137155 'values' : self .values ,
@@ -149,7 +167,8 @@ def data(self, data):
149167 def prismatic_values (self ):
150168 """:obj:`list` of :obj:`float` : Prismatic joint values in meters.
151169
152- E.g. positions on the external axis system."""
170+ E.g. positions on the external axis system.
171+ """
153172 return [v for i , v in enumerate (self .values ) if self .types [i ] == Joint .PRISMATIC ]
154173
155174 @property
@@ -158,6 +177,13 @@ def revolute_values(self):
158177 return [v for i , v in enumerate (self .values ) if self .types [i ] == Joint .REVOLUTE ]
159178
160179 def copy (self ):
180+ """Create a copy of this :class:`Configuration`.
181+
182+ Returns
183+ -------
184+ :class:`Configuration`
185+ An instance of :class:`Configuration`
186+ """
161187 cls = type (self )
162188 return cls (self .values [:], self .types [:], self .joint_names [:])
163189
@@ -168,8 +194,8 @@ def scale(self, scale_factor):
168194
169195 Parameters
170196 ----------
171- scale_factor : float
172- Scale factor
197+ scale_factor : :class:` float`
198+ Scale factor.
173199
174200 Returns
175201 -------
@@ -185,13 +211,13 @@ def scale(self, scale_factor):
185211 self .values = values_scaled
186212
187213 def scaled (self , scale_factor ):
188- """Returns a scaled copy of this configuration.
214+ """Return a scaled copy of this configuration.
189215
190216 Only scalable joints are scaled, i.e. planar and prismatic joints.
191217
192218 Parameters
193219 ----------
194- scale_factor : float
220+ scale_factor : :class:` float`
195221 Scale factor
196222
197223 Returns
0 commit comments