scenario.bindings

scenario.bindings.core

class scenario.bindings.core.Array3d(*args)

Bases: object

back()
begin()
empty()
end()
fill(u)
front()
iterator()
rbegin()
rend()
size()
swap(v)
property thisown

The membership flag

class scenario.bindings.core.Array4d(*args)

Bases: object

back()
begin()
empty()
end()
fill(u)
front()
iterator()
rbegin()
rend()
size()
swap(v)
property thisown

The membership flag

class scenario.bindings.core.Array6d(*args)

Bases: object

back()
begin()
empty()
end()
fill(u)
front()
iterator()
rbegin()
rend()
size()
swap(v)
property thisown

The membership flag

class scenario.bindings.core.Contact

Bases: object

property body_a
property body_b
property points
property thisown

The membership flag

class scenario.bindings.core.ContactPoint

Bases: object

property depth
property force
property normal
property position
property thisown

The membership flag

property torque
class scenario.bindings.core.Joint(*args, **kwargs)

Bases: object

acceleration(dof=0)

Get the acceleration of a joint DOF.

Parameters

dof (int) – The index of the DOF.

Raises

std::runtime_error if the DOF is not valid.

Return type

float

Returns

The acceleration of the joint DOF.

acceleration_target(dof=0)

Get the active acceleration target of the joint DOF.

Parameters

dof (int) – The index of the DOF.

Raises

std::runtime_error if the DOF is not valid or if no acceleration target was set.

Return type

float

Returns

The acceleration target of the joint DOF.

control_mode()

Get the active joint control mode.

Return type

int

Returns

The active joint control mode.

controller_period()

Get the period of the controller, if any.

The controller period is a model quantity. If no controller is active, infinity is returned.

Return type

float

Returns

The the controller period.

coulomb_friction()

Get the Coulomb friction of the joint.

If \(K_c\) is the Coulomb friction parameter, and \(\dot{q}\) the joint velocity, the corresponding torque is often modelled as:

\(\tau_{static} = sign(\dot{q}) K_c\)

Return type

float

Returns

The Coulomb friction parameter of the joint.

dofs()

Get the number of degrees of freedom of the joint.

Return type

int

Returns

The number of DOFs of the joint.

enable_history_of_applied_joint_forces(enable=True, max_history_size=100)

Enable the history of joint forces.

Parameters
  • enable (boolean) – True to enable, false to disable.

  • maxHistorySize (int) – The size of the history window.

Return type

boolean

Returns

True for success, false otherwise.

generalized_force(dof=0)

Get the generalized force of a joint DOF.

Parameters

dof (int) – The index of the DOF.

Raises

std::runtime_error if the DOF is not valid.

Return type

float

Returns

The generalized force of the joint DOF.

generalized_force_target(dof=0)

Get the active generalized force target of the joint DOF.

Parameters

dof (int) – The index of the DOF.

Raises

std::runtime_error if the DOF is not valid or if no generalized force target was set.

Return type

float

Returns

The generalized force target of the joint DOF.

history_of_applied_joint_forces()

Get the history of applied joint forces.

The vector is populated with #DoFs values at each physics step.

Return type

Tuple[float]

Returns

The vector containing the history of joint forces.

history_of_applied_joint_forces_enabled()

Check if the history of applied joint forces is enabled.

Return type

boolean

Returns

True if the history is enabled, false otherwise.

joint_acceleration()

Get the acceleration of the joint.

Return type

Tuple[float]

Returns

The acceleration of the joint.

joint_acceleration_target()

Get the active acceleration target.

Return type

Tuple[float]

Returns

The acceleration target of the joint.

joint_generalized_force()

Get the generalized force of the joint.

Return type

Tuple[float]

Returns

The generalized force of the joint.

joint_generalized_force_target()

Get the active generalized force target.

Return type

Tuple[float]

Returns

The generalized force target of the joint.

joint_max_generalized_force()

Get the maximum generalized force that could be applied to the joint.

Return type

Tuple[float]

Returns

The maximum generalized force of the joint.

joint_position()

Get the position of the joint.

Return type

Tuple[float]

Returns

The position of the joint.

joint_position_limit()

Get the position limits of the joint.

Return type

JointLimit

Returns

The position limits of the joint.

joint_position_target()

Get the active position target.

Return type

Tuple[float]

Returns

The position target of the joint.

joint_velocity()

Get the velocity of the joint.

Return type

Tuple[float]

Returns

The velocity of the joint.

joint_velocity_limit()

Get the velocity limits of the joint.

Return type

JointLimit

Returns

The velocity limits of the joint.

joint_velocity_target()

Get the active velocity target.

Return type

Tuple[float]

Returns

The velocity target of the joint.

max_generalized_force(dof=0)

Get the maximum generalized force that could be applied to a joint DOF.

Parameters

dof (int) – The index of the DOF.

Raises

std::runtime_error if the DOF is not valid.

Return type

float

Returns

The maximum generalized force of the joint DOF.

name(scoped=False)

Get the name of the joint.

Parameters

scoped (boolean) – If true, the scoped name of the joint is returned.

Return type

string

Returns

The name of the joint.

pid()

Get the PID parameters of the joint.

If no PID parameters have been set, the default parameters are returned.

Return type

PID

Returns

The joint PID parameters.

position(dof=0)

Get the position of a joint DOF.

Parameters

dof (int) – The index of the DOF.

Raises

std::runtime_error if the DOF is not valid.

Return type

float

Returns

The position of the joint DOF.

position_limit(dof=0)

Get the position limits of a joint DOF.

Parameters

dof (int) – The index of the DOF.

Raises

std::runtime_error if the DOF is not valid.

Return type

Limit

Returns

The position limits of the joint DOF.

position_target(dof=0)

Get the active position target of the joint DOF.

Parameters

dof (int) – The index of the DOF.

Raises

std::runtime_error if the DOF is not valid or if no position target was set.

Return type

float

Returns

The position target of the joint DOF.

set_acceleration_target(acceleration, dof=0)

Set the acceleration target of a joint DOF.

The target is processed by a joint controller, if enabled.

Parameters
  • acceleration (float) – The acceleration target of the joint DOF.

  • dof (int) – The index of the DOF.

Return type

boolean

Returns

True for success, false otherwise.

set_control_mode(mode)

Set the joint control mode.

Parameters

mode (int) – The desired control mode.

Return type

boolean

Returns

True for success, false otherwise.

set_generalized_force_target(force, dof=0)

Set the generalized force target of a joint DOF.

The force is applied to the desired DOF. Note that if there’s friction or other loss components, the real joint force will differ.

Parameters
  • force (float) – The generalized force target of the joint DOF.

  • dof (int) – The index of the DOF.

Return type

boolean

Returns

True for success, false otherwise.

set_joint_acceleration_target(acceleration)

Set the acceleration target of the joint.

The target is processed by a joint controller, if enabled.

Parameters

acceleration (Tuple[float]) – A vector with the acceleration targets of the joint DOFs.

Return type

boolean

Returns

True for success, false otherwise.

set_joint_generalized_force_target(force)

Set the generalized force target of the joint.

Note that if there’s friction or other loss components, the real joint force will differ.

Parameters

force (Tuple[float]) – A vector with the generalized force targets of the joint DOFs.

Return type

boolean

Returns

True for success, false otherwise.

set_joint_max_generalized_force(max_force)

Set the maximum generalized force that can be applied to the joint.

This limit can be used to clip the force applied by joint controllers.

Parameters

maxForce (Tuple[float]) – A vector with the maximum generalized forces of the joint DOFs.

Return type

boolean

Returns

True for success, false otherwise.

set_joint_position_target(position)

Set the position target of the joint.

The target is processed by a joint controller, if enabled.

Parameters

position (Tuple[float]) – A vector with the position targets of the joint DOFs.

Return type

boolean

Returns

True for success, false otherwise.

set_joint_velocity_limit(max_velocity)

Set the maximum velocity of the joint.

This limit can be used to clip the velocity applied by joint controllers.

Parameters

maxVelocity (Tuple[float]) – A vector with the maximum velocity of the joint DOFs.

Return type

boolean

Returns

True for success, false otherwise.

set_joint_velocity_target(velocity)

Set the velocity target of the joint.

The target is processed by a joint controller, if enabled.

Parameters

velocity (Tuple[float]) – A vector with the velocity targets of the joint DOFs.

Return type

boolean

Returns

True for success, false otherwise.

set_max_generalized_force(max_force, dof=0)

Set the maximum generalized force that can be applied to a joint DOF.

This limit can be used to clip the force applied by joint controllers.

Parameters
  • maxForce (float) – The maximum generalized force.

  • dof (int) – The index of the DOF.

Return type

boolean

Returns

True for success, false otherwise.

set_pid(pid)

Set the PID parameters of the joint.

Parameters

pid (PID) – The desired PID parameters.

Return type

boolean

Returns

True for success, false otherwise.

set_position_target(position, dof=0)

Set the position target of a joint DOF.

The target is processed by a joint controller, if enabled.

Parameters
  • position (float) – The position target of the joint DOF.

  • dof (int) – The index of the DOF.

Raises

std::runtime_error if the DOF is not valid.

Return type

boolean

Returns

True for success, false otherwise.

set_velocity_limit(max_velocity, dof=0)

Set the maximum velocity of a joint DOF.

This limit can be used to clip the velocity applied by joint controllers.

Parameters
  • maxVelocity (float) – The maximum velocity.

  • dof (int) – The index of the DOF.

Return type

boolean

Returns

True for success, false otherwise.

set_velocity_target(velocity, dof=0)

Set the velocity target of a joint DOF.

The target is processed by a joint controller, if enabled.

Parameters
  • velocity (float) – The velocity target of the joint DOF.

  • dof (int) – The index of the DOF.

Return type

boolean

Returns

True for success, false otherwise.

property thisown

The membership flag

to_gazebo()
Return type

Union[ForwardRef, ForwardRef]

type()

Get the type of the joint.

Return type

int

Returns

The type of the joint.

valid()

Check if the joint is valid.

Return type

boolean

Returns

True if the joint is valid, false otherwise.

velocity(dof=0)

Get the velocity of a joint DOF.

Parameters

dof (int) – The index of the DOF.

Raises

std::runtime_error if the DOF is not valid.

Return type

float

Returns

The velocity of the joint DOF.

velocity_limit(dof=0)

Get the velocity limit of a joint DOF.

Parameters

dof (int) – The index of the DOF.

Raises

std::runtime_error if the DOF is not valid.

Return type

Limit

Returns

The velocity limit of the joint DOF.

velocity_target(dof=0)

Get the active velocity target of the joint DOF.

Parameters

dof (int) – The index of the DOF.

Raises

std::runtime_error if the DOF is not valid or if no velocity target was set.

Return type

float

Returns

The velocity target of the joint DOF.

viscous_friction()

Get the viscous friction of the joint.

If \(K_v\) is the viscous friction parameter, and \(\dot{q}\) the joint velocity, the corresponding torque is often modelled as:

\(\tau_{static} = K_v \dot{q}\)

Return type

float

Returns

The viscous friction parameter of the joint.

scenario.bindings.core.JointControlMode_force = 2

Marks the joint to be controlled in force. A Force joint receives generalized force references that are actuated by a force actuator. Depending on the active backend, the presence of friction and other loss components could be compensated.

scenario.bindings.core.JointControlMode_idle = 1

Marks the joint to be IDLE. An IDLE joint is equivalent to a joint controlled in Force with zero references. The joint shows only passive behaviour.

scenario.bindings.core.JointControlMode_invalid = 0

Marks the joint to have an invalid control mode.

scenario.bindings.core.JointControlMode_position = 5

Marks the joint to be controlled in position. A Position joint receives position references that are actuated using a PID controller.

scenario.bindings.core.JointControlMode_position_interpolated = 6

Marks the joint to be controlled in position with trajectory smoothing. A PositionInterpolated joint receives position references that are filtered to get a smooth trajectory. The resulting trajectory is then actuated using a position PID controller.

scenario.bindings.core.JointControlMode_velocity = 3

Marks the joint to be controlled in velocity. A Velocity joint receives velocity references that are actuated using a PID controller.

scenario.bindings.core.JointControlMode_velocity_follower_dart = 4

Marks the joint to follow precisely a velocity trajectory. A VelocityFollowerDart joint receives velocity references that are processed by the physics engine, which computes instantaneously the right force to apply to follow the desired trajectory. It works only with the DART physics engine.

class scenario.bindings.core.JointLimit(*args)

Bases: object

property max
property min
property thisown

The membership flag

class scenario.bindings.core.Limit(*args)

Bases: object

property max
property min
property thisown

The membership flag

Bases: object

body_angular_acceleration()

Get the angular body acceleration of the link.

TODO: Add link to the velocity representation documentation page.

Return type

Tuple[float, float, float]

Returns

The angular body acceleration of the link.

body_angular_velocity()

Get the angular body velocity of the link.

TODO: Add link to the velocity representation documentation page.

Return type

Tuple[float, float, float]

Returns

The angular body velocity of the link.

body_linear_acceleration()

Get the linear body acceleration of the link.

TODO: Add link to the velocity representation documentation page.

Return type

Tuple[float, float, float]

Returns

The linear body acceleration of the link.

body_linear_velocity()

Get the linear body velocity of the link.

TODO: Add link to the velocity representation documentation page.

Return type

Tuple[float, float, float]

Returns

The linear body velocity of the link.

contact_wrench()

Get the total wrench generated by the active contacts.

All the contact wrenches are composed to an equivalent wrench applied to the origin of the link frame and expressed in world coordinates.

Return type

Tuple[float, float, float, float, float, float]

Returns

The total wrench of the active contacts.

contacts()

Get the active contacts of the link.

Return type

Tuple[Contact]

Returns

The vector of active contacts.

contacts_enabled()

Check if the contact detection is enabled.

Return type

boolean

Returns

True if the contact detection is enabled, false otherwise.

enable_contact_detection(enable)

Enable the contact detection.

Parameters

enable (boolean) – True to enable the contact detection, false to disable.

Return type

boolean

Returns

True for success, false otherwise.

in_contact()

Check if the link has active contacts.

Return type

boolean

Returns

True if the link has at least one contact and contacts are enabled, false otherwise.

mass()

Get the mass of the link.

Return type

float

Returns

The mass of the link.

name(scoped=False)

Get the name of the link.

Parameters

scoped (boolean) – If true, the scoped name of the link is returned.

Return type

string

Returns

The name of the link.

orientation()

Get the orientation of the link.

The orientation is returned as a quaternion, which defines the rotation between the world frame and the link frame.

Return type

Tuple[float, float, float, float]

Returns

The wxyz quaternion defining the orientation if the link wrt the world frame.

position()

Get the position of the link.

The returned position is the position of the link frame, as it was defined in the model file, in world coordinates.

Return type

Tuple[float, float, float]

Returns

The cartesian position of the link frame in world coordinates.

property thisown

The membership flag

to_gazebo()
Return type

Union[ForwardRef, ForwardRef]

valid()

Check if the link is valid.

Return type

boolean

Returns

True if the link is valid, false otherwise.

world_angular_acceleration()

Get the angular mixed acceleration of the link.

TODO: Add link to the velocity representation documentation page.

Return type

Tuple[float, float, float]

Returns

The angular mixed acceleration of the link.

world_angular_velocity()

Get the angular mixed velocity of the link.

TODO: Add link to the velocity representation documentation page.

Return type

Tuple[float, float, float]

Returns

The angular mixed velocity of the link.

world_linear_acceleration()

Get the linear mixed acceleration of the link.

TODO: Add link to the velocity representation documentation page.

Return type

Tuple[float, float, float]

Returns

The linear mixed acceleration of the link.

world_linear_velocity()

Get the linear mixed velocity of the link.

TODO: Add link to the velocity representation documentation page.

Return type

Tuple[float, float, float]

Returns

The linear mixed velocity of the link.

class scenario.bindings.core.Model(*args, **kwargs)

Bases: object

base_body_angular_velocity()

Get the angular body velocity of the base link.

TODO: Add link to the velocity representation documentation page.

Return type

Tuple[float, float, float]

Returns

The angular body velocity of the base link.

base_body_linear_velocity()

Get the linear body velocity of the base link.

TODO: Add link to the velocity representation documentation page.

Return type

Tuple[float, float, float]

Returns

The linear body velocity of the base link.

base_frame()

Get the name of the model’s base frame.

By default, the base frame is typically the root of the kinematic tree of the model.

Return type

string

Returns

The name of the model’s base frame.

base_orientation()

Get the orientation of the base link.

Return type

Tuple[float, float, float, float]

Returns

The wxyz quaternion defining the orientation of the base link wrt the world frame.

base_orientation_target()

Get the orientation target of the base link.

Return type

Tuple[float, float, float, float]

Returns

The quaternion defining the orientation target of the base link.

base_position()

Get the position of the base link.

Return type

Tuple[float, float, float]

Returns

The position of the base link in world coordinates.

base_position_target()

Get the position target of the base link.

Return type

Tuple[float, float, float]

Returns

The position target of the base link.

base_world_angular_acceleration_target()

Get the mixed angular acceleration target of the base link.

Return type

Tuple[float, float, float]

Returns

The mixed angular acceleration target of the base link.

base_world_angular_velocity()

Get the angular mixed velocity of the base link.

TODO: Add link to the velocity representation documentation page.

Return type

Tuple[float, float, float]

Returns

The angular mixed velocity of the base link.

base_world_angular_velocity_target()

Get the mixed angular velocity target of the base link.

Return type

Tuple[float, float, float]

Returns

The mixed angular velocity target of the base link.

base_world_linear_acceleration_target()

Get the mixed linear acceleration target of the base link.

Return type

Tuple[float, float, float]

Returns

The mixed linear acceleration target of the base link.

base_world_linear_velocity()

Get the linear mixed velocity of the base link.

TODO: Add link to the velocity representation documentation page.

Return type

Tuple[float, float, float]

Returns

The linear mixed velocity of the base link.

base_world_linear_velocity_target()

Get the mixed linear velocity target of the base link.

Return type

Tuple[float, float, float]

Returns

The mixed linear velocity target of the base link.

contacts(*args)

Get the active contacts of the model.

Parameters

linkNames (Tuple[string]) – Optionally restrict the considered links.

Return type

Tuple[Contact]

Returns

A vector of contacts.

contacts_enabled()

Check if the contact detection is enabled model-wise.

Return type

boolean

Returns

True if the contact detection is enabled model-wise, false otherwise.

controller_period()

Get the controller period of the model.

If no controller has been enabled, infinite is returned.

Return type

float

Returns

The controller period of the model.

dofs(*args)

Get the degrees of freedom of the model.

Parameters

jointNames (Tuple[string]) – Optionally restrict the count to a subset of joints.

Return type

int

Returns

The number of degrees of freedom of the model.

enable_contacts(enable=True)

Enable the contact detection model-wise.

Parameters

enable (boolean) – True to enable the contact detection model-wise, false to disable.

Return type

boolean

Returns

True for success, false otherwise.

enable_history_of_applied_joint_forces(*args)

Enable logging the applied joint forces.

The output of joint controllers is often a torque. This method allows to log the force references that the controller sent to the joints. It is useful when the controller runs in its own thread at its own rate and the caller wants to extract the forces at a lower frequency.

Parameters
  • enable (boolean) – True to enable logging, false to disable.

  • maxHistorySizePerJoint (int) – Size of the logging window of each joint.

  • jointNames (Tuple[string]) – Optional vector of considered joints that also defines the joint serialization. By default, Model::jointNames is used.

Return type

boolean

Returns

True for success, false otherwise.

get_joint(joint_name)

Get a joint belonging to the model.

Parameters

jointName (string) – The name of the joint.

Raises

std::runtime_error if the joint does not exist.

Return type

Joint

Returns

The desired joint.

Get a link belonging to the model.

Parameters

linkName (string) – The name of the link.

Raises

std::runtime_error if the link does not exist.

Return type

Link

Returns

The desired link.

history_of_applied_joint_forces(*args)

Get the log of applied joint forces.

Parameters

jointNames (Tuple[string]) – Optional vector of considered joints that also defines the joint serialization. By default, Model::jointNames is used.

Return type

Tuple[float]

Returns

The entire window of applied joint forces.

Notes: Given a serialization, the window has DoFs * JointWindowSize elements. The elements are ordered per time steps, i.e. the first #DoFs elements refer to the oldest forces of the windows ordered with the active joint serialization.

If a joint has multiple DoFs, they are serialized contiguously.

history_of_applied_joint_forces_enabled(joint_names)

Check if logging the applied joint force is enabled.

Parameters

jointNames (Tuple[string]) – Optional vector of considered joints that also defines the joint serialization. By default, Model::jointNames is used.

Return type

boolean

Returns

True if the log is enabled, false otherwise.

joint_acceleration_targets(*args)

Get the acceleration targets of the joints.

Parameters

jointNames (Tuple[string]) – Optional vector of considered joints. By default, Model::jointNames is used.

Return type

Tuple[float]

Returns

The acceleration targets of the joints.

joint_accelerations(*args)

Get the joint accelerations.

Parameters

jointNames (Tuple[string]) – Optional vector of considered joints that also defines the joint serialization. By default, Model::jointNames is used.

Return type

Tuple[float]

Returns

The serialization of joint accelerations. The vector has as many elements as DoFs of the considered joints.

joint_generalized_force_targets(*args)

Get the generalized force targets of the joints.

Parameters

jointNames (Tuple[string]) – Optional vector of considered joints. By default, Model::jointNames is used.

Return type

Tuple[float]

Returns

The generalized force targets of the joints.

joint_generalized_forces(*args)

Get the joint generalized forces.

Parameters

jointNames (Tuple[string]) – Optional vector of considered joints that also defines the joint serialization. By default, Model::jointNames is used.

Return type

Tuple[float]

Returns

The serialization of joint forces. The vector has as many elements as DoFs of the considered joints.

joint_limits(*args)

Get the joint limits of the model.

Parameters

jointNames (Tuple[string]) – Optional vector of considered joints that also defines the joint serialization. By default, Model::jointNames is used.

Return type

JointLimit

Returns

The joint limits of the model. The vectors of the limit object have as many elements as DoFs of the considered joints.

joint_names(scoped=False)

Get the name of all the model’s joints.

Parameters

scoped (boolean) – Scope the joint names with the model name, (e.g. mymodel::joint1).

Return type

Tuple[string]

Returns

The list of joint names.

joint_position_targets(*args)

Get the position targets of the joints.

Parameters

jointNames (Tuple[string]) – Optional vector of considered joints. By default, Model::jointNames is used.

Return type

Tuple[float]

Returns

The position targets of the joints.

joint_positions(*args)

Get the joint positions.

Parameters

jointNames (Tuple[string]) – Optional vector of considered joints that also defines the joint serialization. By default, Model::jointNames is used.

Return type

Tuple[float]

Returns

The serialization of joint positions. The vector has as many elements as DoFs of the considered joints.

joint_velocities(*args)

Get the joint velocities.

Parameters

jointNames (Tuple[string]) – Optional vector of considered joints that also defines the joint serialization. By default, Model::jointNames is used.

Return type

Tuple[float]

Returns

The serialization of joint velocities. The vector has as many elements as DoFs of the considered joints.

joint_velocity_targets(*args)

Get the velocity targets of the joints.

Parameters

jointNames (Tuple[string]) – Optional vector of considered joints. By default, Model::jointNames is used.

Return type

Tuple[float]

Returns

The velocity targets of the joints.

joints(*args)

Get the joints of the model.

Parameters

jointNames (Tuple[string]) – Optional vector of considered joints. By default, Model::jointNames is used.

Return type

Tuple[Joint]

Returns

A vector of pointers to the joint objects.

Get the name of all the model’s links.

Parameters

scoped (boolean) – Scope the link names with the model name (e.g. mymodel::link1).

Return type

Tuple[string]

Returns

The list of link names.

Get the links of the model.

Parameters

linkNames (Tuple[string]) – Optional vector of considered links. By default, Model::linkNames is used.

Return type

Tuple[Link]

Returns

A vector of pointers to the link objects.

Get the vector of links with active contacts with other bodies.

Return type

Tuple[string]

Returns

The vector of links in contact.

name()

Get the name of the model.

Return type

string

Returns

The name of the model.

nr_of_joints()

Get the number of joints of the model.

Return type

int

Returns

The number of joints.

Get the number of links of the model.

Return type

int

Returns

The number of links.

set_base_orientation_target(orientation)

Set the orientation target of the base link.

Parameters

orientation (Tuple[float, float, float, float]) – The wxyz quaternion defining the orientation target of the base link wrt the world frame.

Return type

boolean

Returns

True for success, false otherwise.

set_base_pose_target(position, orientation)

Set the pose target of the base link.

Parameters
  • position (Tuple[float, float, float]) – The position target of the base link in world coordinates.

  • orientation (Tuple[float, float, float, float]) – The wxyz quaternion defining the orientation target of the base link wrt the world frame.

Return type

boolean

Returns

True for success, false otherwise.

set_base_position_target(position)

Set the position target of the base link.

Parameters

position (Tuple[float, float, float]) – The position target of the base link in world coordinates.

Return type

boolean

Returns

True for success, false otherwise.

set_base_world_angular_acceleration_target(angular)

Set the mixed angular acceleration target of the base link.

Parameters

angular (Tuple[float, float, float]) – The mixed angular acceleration target of the base link.

Return type

boolean

Returns

True for success, false otherwise.

set_base_world_angular_velocity_target(angular)

Set the mixed angular velocity target of the base link.

Parameters

angular (Tuple[float, float, float]) – The mixed angular velocity target of the base link.

Return type

boolean

Returns

True for success, false otherwise.

set_base_world_linear_acceleration_target(linear)

Set the mixed linear acceleration target of the base link.

Parameters

linear (Tuple[float, float, float]) – The mixed linear acceleration target of the base link.

Return type

boolean

Returns

True for success, false otherwise.

set_base_world_linear_velocity_target(linear)

Set the mixed linear velocity target of the base link.

Parameters

linear (Tuple[float, float, float]) – The mixed linear velocity target of the base link.

Return type

boolean

Returns

True for success, false otherwise.

set_base_world_velocity_target(linear, angular)

Set the mixed velocity target of the base link.

Parameters
  • linear (Tuple[float, float, float]) – The mixed linear velocity target of the base link.

  • angular (Tuple[float, float, float]) – The mixed angular velocity target of the base link.

Return type

boolean

Returns

True for success, false otherwise.

set_controller_period(period)

Set the controller period of the model.

This controller period is used by PIDs and custom controller. If it is smaller than the physics step, it is treated as 0.

Parameters

period (float) – The desired controller period.

Return type

boolean

Returns

True for success, false otherwise.

set_joint_acceleration_targets(*args)

Set the acceleration targets of the joints.

Parameters
  • accelerations (Tuple[float]) – The vector with the joint acceleration targets. It must have as many elements as the considered joint DoFs.

  • jointNames (Tuple[string]) – Optional vector of considered joints. By default, Model::jointNames is used.

Return type

boolean

Returns

True for success, false otherwise.

set_joint_control_mode(*args)

Set the control mode of model joints.

Parameters
  • mode (int) – The desired joint control mode.

  • jointNames (Tuple[string]) – Optional vector of considered joints that also defines the joint serialization. By default, Model::jointNames is used.

Return type

boolean

Returns

True for success, false otherwise.

set_joint_generalized_force_targets(*args)

Set the generalized force targets of the joints.

Parameters
  • forces (Tuple[float]) – The vector with the joint generalized force targets. It must have as many elements as the considered joint DoFs.

  • jointNames (Tuple[string]) – Optional vector of considered joints. By default, Model::jointNames is used.

Return type

boolean

Returns

True for success, false otherwise.

set_joint_position_targets(*args)

Set the position targets of the joints.

Parameters
  • positions (Tuple[float]) – The vector with the joint position targets. It must have as many elements as the considered joint DoFs.

  • jointNames (Tuple[string]) – Optional vector of considered joints. By default, Model::jointNames is used.

Return type

boolean

Returns

True for success, false otherwise.

set_joint_velocity_targets(*args)

Set the velocity targets of the joints.

Parameters
  • velocities (Tuple[float]) – The vector with the joint velocity targets. It must have as many elements as the considered joint DoFs.

  • jointNames (Tuple[string]) – Optional vector of considered joints. By default, Model::jointNames is used.

Return type

boolean

Returns

True for success, false otherwise.

property thisown

The membership flag

to_gazebo()
Return type

Union[ForwardRef, ForwardRef]

total_mass(*args)

Get the total mass of the model.

Parameters

linkNames (Tuple[string]) – Optionally restrict the count to a subset of links.

Return type

float

Returns

The total mass of the model.

valid()

Check if the model is valid.

Return type

boolean

Returns

True if the model is valid, false otherwise.

class scenario.bindings.core.PID(*args)

Bases: object

property cmd_max
property cmd_min
property cmd_offset
property d
property i
property i_max
property i_min
property p
property thisown

The membership flag

class scenario.bindings.core.Pose(*args)

Bases: object

static identity()
property orientation
property position
property thisown

The membership flag

class scenario.bindings.core.PosePair(*args)

Bases: object

property first
property second
property thisown

The membership flag

scenario.bindings.core.Pose_identity()
class scenario.bindings.core.SwigPyIterator(*args, **kwargs)

Bases: object

advance(n)
copy()
decr(n=1)
distance(x)
equal(x)
incr(n=1)
next()
previous()
property thisown

The membership flag

value()
class scenario.bindings.core.VectorD(*args)

Bases: object

append(x)
assign(n, x)
back()
begin()
capacity()
clear()
empty()
end()
erase(*args)
front()
get_allocator()
insert(*args)
iterator()
pop()
pop_back()
push_back(x)
rbegin()
rend()
reserve(n)
resize(*args)
size()
swap(v)
property thisown

The membership flag

class scenario.bindings.core.VectorF(*args)

Bases: object

append(x)
assign(n, x)
back()
begin()
capacity()
clear()
empty()
end()
erase(*args)
front()
get_allocator()
insert(*args)
iterator()
pop()
pop_back()
push_back(x)
rbegin()
rend()
reserve(n)
resize(*args)
size()
swap(v)
property thisown

The membership flag

class scenario.bindings.core.VectorI(*args)

Bases: object

append(x)
assign(n, x)
back()
begin()
capacity()
clear()
empty()
end()
erase(*args)
front()
get_allocator()
insert(*args)
iterator()
pop()
pop_back()
push_back(x)
rbegin()
rend()
reserve(n)
resize(*args)
size()
swap(v)
property thisown

The membership flag

class scenario.bindings.core.VectorOfContactPoints(*args)

Bases: object

append(x)
assign(n, x)
back()
begin()
capacity()
clear()
empty()
end()
erase(*args)
front()
get_allocator()
insert(*args)
iterator()
pop()
pop_back()
push_back(x)
rbegin()
rend()
reserve(n)
resize(*args)
size()
swap(v)
property thisown

The membership flag

class scenario.bindings.core.VectorOfContacts(*args)

Bases: object

append(x)
assign(n, x)
back()
begin()
capacity()
clear()
empty()
end()
erase(*args)
front()
get_allocator()
insert(*args)
iterator()
pop()
pop_back()
push_back(x)
rbegin()
rend()
reserve(n)
resize(*args)
size()
swap(v)
property thisown

The membership flag

class scenario.bindings.core.VectorOfJoints(*args)

Bases: object

append(x)
assign(n, x)
back()
begin()
capacity()
clear()
empty()
end()
erase(*args)
front()
get_allocator()
insert(*args)
iterator()
pop()
pop_back()
push_back(x)
rbegin()
rend()
reserve(n)
resize(*args)
size()
swap(v)
property thisown

The membership flag

Bases: object

append(x)
assign(n, x)
back()
begin()
capacity()
clear()
empty()
end()
erase(*args)
front()
get_allocator()
insert(*args)
iterator()
pop()
pop_back()
push_back(x)
rbegin()
rend()
reserve(n)
resize(*args)
size()
swap(v)
property thisown

The membership flag

class scenario.bindings.core.VectorS(*args)

Bases: object

append(x)
assign(n, x)
back()
begin()
capacity()
clear()
empty()
end()
erase(*args)
front()
get_allocator()
insert(*args)
iterator()
pop()
pop_back()
push_back(x)
rbegin()
rend()
reserve(n)
resize(*args)
size()
swap(v)
property thisown

The membership flag

class scenario.bindings.core.VectorU(*args)

Bases: object

append(x)
assign(n, x)
back()
begin()
capacity()
clear()
empty()
end()
erase(*args)
front()
get_allocator()
insert(*args)
iterator()
pop()
pop_back()
push_back(x)
rbegin()
rend()
reserve(n)
resize(*args)
size()
swap(v)
property thisown

The membership flag

class scenario.bindings.core.World(*args, **kwargs)

Bases: object

get_model(model_name)

Get a model part of the world.

Parameters

modelName (string) – The name of the model to get.

Return type

Model

Returns

The model if it is part of the world, nullptr otherwise.

gravity()

Get the gravity vector. :rtype: Tuple[float, float, float] :return: The gravity vector.

model_names()

Get the name of the models that are part of the world.

Return type

Tuple[string]

Returns

The list of model names.

models(*args)

Get the models of the world.

Parameters

modelNames (Tuple[string]) – Optional vector of considered models. By default, World::modelNames is used.

Return type

std::vector< scenario::core::ModelPtr,std::allocator< scenario::core::ModelPtr > >

Returns

A vector of pointers to the model objects.

name()

Get the name of the world.

Return type

string

Returns

The name of the world.

property thisown

The membership flag

time()

Get the simulated time.

Notes: A physics plugin need to be part of the simulation in order to make the time flow.

Return type

float

Returns

The simulated time.

to_gazebo()
Return type

Union[ForwardRef, ForwardRef]

valid()

Check if the world is valid.

Return type

boolean

Returns

True if the world is valid, false otherwise.

scenario.bindings.core.get_install_prefix()

Get the install prefix used by the CMake project.

Notes: It is defined only if the project is installed in Developer mode.

Return type

string

Returns

A string with the install prefix if the project is installed in Developer mode, an empty string otherwise.

scenario.bindings.monopod

class scenario.bindings.monopod.Joint

Bases: scenario.bindings.core.Joint

control_mode()

get the joint control mode.

Return type

int

Returns

the joint control mode

dofs()

Get the number of degrees of freedom of the joint.

Return type

int

Returns

The number of DOFs of the joint.

initialize(name_index_pair, monopod_sdk)
joint_acceleration()

Get the acceleration of the joint.

Return type

Tuple[float]

Returns

The acceleration of the joint.

joint_acceleration_limit()

Get the acceleration limits of the joint.

Return type

JointLimit

Returns

The acceleration limits of the joint.

joint_generalized_force_target()

Get the active generalized force target.

Return type

Tuple[float]

Returns

The generalized force target of the joint.

joint_max_generalized_force()

Get the maximum generalized force that could be applied to the joint.

Return type

Tuple[float]

Returns

The maximum generalized force of the joint.

joint_position()

Get the position of the joint.

Return type

Tuple[float]

Returns

The position of the joint.

joint_position_limit()

Get the position limits of the joint.

Return type

JointLimit

Returns

The position limits of the joint.

joint_velocity()

Get the velocity of the joint.

Return type

Tuple[float]

Returns

The velocity of the joint.

joint_velocity_limit()

Get the velocity limits of the joint.

Return type

JointLimit

Returns

The velocity limits of the joint.

name(scoped=False)

Get the name of the joint.

Parameters

scoped (boolean) – If true, the scoped name of the joint is returned.

Return type

string

Returns

The name of the joint.

pid()

Get the PID parameters of the joint.

If no PID parameters have been set, the default parameters are returned.

Return type

PID

Returns

The joint PID parameters.

set_control_mode(mode)

Set the joint control mode.

Parameters

mode (int) – The desired control mode.

Return type

boolean

Returns

True for success, false otherwise.

set_joint_acceleration_limit(max_acceleration, min_acceleration)

Set the maximum acceleration of the joint.

This limit can be used to set safety limits on the joint acceleration. when violated the Robot will enter into a safe mode. disabling the robot until it is reset or restart.

Parameters
  • maxAcceleration (float) – maximum acceleration of the joint DOFs.

  • minAcceleration (float) – minimum acceleration of the joint DOFs.

Return type

boolean

Returns

True for success, false otherwise.

set_joint_generalized_force_target(force)

Set the generalized force target of the joint.

Note that if there’s friction or other loss components, the real joint force will differ.

Parameters

force (Tuple[float]) – A vector with the generalized force targets of the joint DOFs.

Return type

boolean

Returns

True for success, false otherwise.

set_joint_max_generalized_force(max_force)

Set the maximum generalized force that can be applied to the joint.

This limit can be used to clip the force applied by joint controllers.

Parameters

maxForce (Tuple[float]) – A vector with the maximum generalized forces of the joint DOFs.

Return type

boolean

Returns

True for success, false otherwise.

set_joint_position_limit(max_position, min_position)

Set the maximum position of the joint.

This limit can be used to set safety limits on the joint position. when violated the Robot will enter into a safe mode. disabling the robot until it is reset or restart.

Parameters
  • maxPosition (float) – maximum position of the joint DOFs.

  • minPosition (float) – minimum position of the joint DOFs.

Return type

boolean

Returns

True for success, false otherwise.

set_joint_velocity_limit(max_velocity, min_velocity)

Set the maximum velocity of the joint.

This limit can be used to set safety limits on the joint velocity. when violated the Robot will enter into a safe mode. disabling the robot until it is reset or restart.

Parameters
  • maxVelocity (float) – maximum velocity of the joint DOFs.

  • minVelocity (float) – minimum position of the joint DOFs.

Return type

boolean

Returns

True for success, false otherwise.

set_pid(pid)

Set the PID parameters of the joint.

Parameters

pid (PID) – The desired PID parameters.

Return type

boolean

Returns

True for success, false otherwise.

property thisown

The membership flag

type()

Get the type of the joint.

Return type

int

Returns

The type of the joint.

valid()

Check if the joint is valid.

Return type

boolean

Returns

True if the model is valid, false otherwise.

scenario.bindings.monopod.Mode_encoder_board1 = 4

encoder board 1

scenario.bindings.monopod.Mode_encoder_board2 = 5

encoder board 2

scenario.bindings.monopod.Mode_fixed = 2

Fixed boom connector and planrizer yaw (3 joints total)

scenario.bindings.monopod.Mode_fixed_connector = 1

Fixed boom connector (4 joints total)

scenario.bindings.monopod.Mode_free = 0

Complete free boom connector (5 joints total)

scenario.bindings.monopod.Mode_motor_board = 3

motor board

class scenario.bindings.monopod.Model

Bases: scenario.bindings.core.Model

calibrate(hip_home_offset_rad=0, knee_home_offset_rad=0)

Calibrate the Encoders.

Parameters
  • hip_home_offset_rad (float) – hip offset from found encoder index 0 (rad)

  • knee_home_offset_rad (float) – knee offset from found encoder index 0 (rad)

dofs(*args)

Get the joints DOF

Parameters

jointNames (Tuple[string]) – Optional vector of considered joints that also defines the joint serialization. By default, Model::jointNames is used.

Return type

int

Returns

The sum of serialization of joint DOFs. The sum is the number of DoFs of all the considered joints.

get_joint(joint_name)

Get a joint belonging to the model.

Parameters

jointName (string) – The name of the joint.

Raises

std::runtime_error if the joint does not exist.

Return type

Joint

Returns

The desired joint.

initialize(mode, dummy_mode)

Initialize can_bus connections to encoder board and motor board.

Parameters
  • monopod_mode – defines the task mode of the monopod. Can also specify individual boards.

  • dummy_mode (boolean) – if false the sdk will try to connect to the canbus connection otherwise it will just create a dummy board class which fakes the real robot.

joint_accelerations(*args)

Get the joint accelerations.

Parameters

jointNames (Tuple[string]) – Optional vector of considered joints that also defines the joint serialization. By default, Model::jointNames is used.

Return type

Tuple[float]

Returns

The serialization of joint accelerations. The vector has as many elements as DoFs of the considered joints.

joint_generalized_force_targets(*args)

Get the generalized force targets of the joints.

Parameters

jointNames (Tuple[string]) – Optional vector of considered joints. By default, Model::jointNames is used.

Return type

Tuple[float]

Returns

The generalized force targets of the joints.

joint_names(scoped=False)

Get the name of all the model’s joints.

Parameters

scoped (boolean) – Scope the joint names with the model name, (e.g. mymodel::joint1).

Return type

Tuple[string]

Returns

The list of joint names.

joint_positions(*args)

Get the joint positions.

Parameters

jointNames (Tuple[string]) – Optional vector of considered joints that also defines the joint serialization. By default, Model::jointNames is used.

Return type

Tuple[float]

Returns

The serialization of joint positions. The vector has as many elements as DoFs of the considered joints.

joint_velocities(*args)

Get the joint velocities.

Parameters

jointNames (Tuple[string]) – Optional vector of considered joints that also defines the joint serialization. By default, Model::jointNames is used.

Return type

Tuple[float]

Returns

The serialization of joint velocities. The vector has as many elements as DoFs of the considered joints.

joints(*args)

Get the joints of the model.

Parameters

jointNames (Tuple[string]) – Optional vector of considered joints. By default, Model::jointNames is used.

Return type

Tuple[Joint]

Returns

A vector of pointers to the joint objects.

name()

Get the name of the model.

Return type

string

Returns

The name of the model.

print_status()

print status messages of robot.

reset()

If the joint module is not valid (safemode after limit reached) the joint will be reset into a valid state. This means the joint must be set back into the valid state first otherwise it will trigger the limits again.

set_controller_period(period)

Set the controller period of the model.

This controller period is used by PIDs and custom controller. If it is smaller than the physics step, it is treated as 0.

Parameters

period (float) – The desired controller period.

Return type

boolean

Returns

True for success, false otherwise.

set_joint_control_mode(*args)

Set the control mode of model joints.

Parameters
  • mode (int) – The desired joint control mode.

  • jointNames (Tuple[string]) – Optional vector of considered joints that also defines the joint serialization. By default, Model::jointNames is used.

Return type

boolean

Returns

True for success, false otherwise.

set_joint_generalized_force_targets(*args)

Set the generalized force targets of the joints.

Parameters
  • forces (Tuple[float]) – The vector with the joint generalized force targets. It must have as many elements as the considered joint DoFs.

  • jointNames (Tuple[string]) – Optional vector of considered joints. By default, Model::jointNames is used.

Return type

boolean

Returns

True for success, false otherwise.

property thisown

The membership flag

valid()

Check if the model is valid.

Return type

boolean

Returns

True if the model is valid, false otherwise.

class scenario.bindings.monopod.SwigPyIterator(*args, **kwargs)

Bases: object

advance(n)
copy()
decr(n=1)
distance(x)
equal(x)
incr(n=1)
next()
previous()
property thisown

The membership flag

value()
scenario.bindings.monopod.ToMonopodJoint(base)
scenario.bindings.monopod.ToMonopodModel(base)
scenario.bindings.monopod.ToMonopodWorld(base)
class scenario.bindings.monopod.VectorOfModels(*args)

Bases: object

append(x)
assign(n, x)
back()
begin()
capacity()
clear()
empty()
end()
erase(*args)
front()
get_allocator()
insert(*args)
iterator()
pop()
pop_back()
push_back(x)
rbegin()
rend()
reserve(n)
resize(*args)
size()
swap(v)
property thisown

The membership flag

class scenario.bindings.monopod.World

Bases: scenario.bindings.core.World

get_model(model_name)

Get a model part of the world.

Parameters

modelName (string) – The name of the model to get.

Return type

Model

Returns

The model if it is part of the world, nullptr otherwise.

initialize(mode, dummy_mode=False)

Initialize can_bus connections to encoder board and motor board.

Parameters
  • monopod_mode – defines the task mode of the monopod. Can also specify individual boards.

  • dummy_mode (boolean) – if false the sdk will try to connect to the canbus connection otherwise it will just create a dummy board class which fakes the real robot.

model_names()

Get the name of the models that are part of the world.

Return type

Tuple[string]

Returns

The list of model names.

models(*args)

Get the models of the world.

Parameters

modelNames (Tuple[string]) – Optional vector of considered models. By default, World::modelNames is used.

Return type

std::vector< scenario::core::ModelPtr,std::allocator< scenario::core::ModelPtr > >

Returns

A vector of pointers to the model objects.

name()

Get the name of the world.

Return type

string

Returns

The name of the world.

property thisown

The membership flag

valid()

Check if the world is valid.

Return type

boolean

Returns

True if the world is valid, false otherwise.