Configuration

class compas_fab.robots.Configuration(values=None, types=None, joint_names=None)[source]

Bases: object

Represents the configuration of a robot based on the state of its joints. This concept is also refered to as Joint State.

Attributes
  • values (list of float) – Joint values expressed in radians or meters, depending on the respective type.

  • types (list of compas.robots.Joint.TYPE) – Joint types, e.g. a list of compas.robots.Joint.REVOLUTE for revolute joints.

  • joint_names (list of str, optional) – Joint names list

Examples

>>> config = Configuration.from_revolute_values([math.pi/2, 0., 0.])
>>> config.values
[1.5707963267948966, 0.0, 0.0]
>>> from compas_fab.robots import Configuration
>>> config = Configuration.from_prismatic_and_revolute_values([8.312], [math.pi/2, 0., 0., 0., 2*math.pi, 0.8])
>>> str(config)
'Configuration((8.312, 1.571, 0.000, 0.000, 0.000, 6.283, 0.800), (2, 0, 0, 0, 0, 0, 0))'
>>> from compas_fab.robots import Configuration
>>> from compas.robots import Joint
>>> config = Configuration([math.pi/2, 3., 0.1], [Joint.REVOLUTE, Joint.PRISMATIC, Joint.PLANAR])
>>> str(config)
'Configuration((1.571, 3.000, 0.100), (0, 2, 5))'

Methods

__init__([values, types, joint_names])

Initialize self.

copy()

from_data(data)

Construct a configuration from its data representation.

from_prismatic_and_revolute_values(…)

Construct a configuration from prismatic and revolute joint values.

from_revolute_values(values)

Construct a configuration from revolute joint values in radians.

scale(scale_factor)

Scales the joint positions of the current configuration.

scaled(scale_factor)

Returns a scaled copy of this configuration.

to_data()

Return the data dictionary that represents the configuration, and from which it can be reconstructed.

Attributes

data

The data representing the configuration.

prismatic_values

Prismatic joint values in meters.

revolute_values

Revolute joint values in radians.