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.gazebo

class scenario.bindings.gazebo.GazeboEntity(*args, **kwargs)

Bases: object

entity()

Return the entity of this object.

Return type

ignition::gazebo::Entity

Returns

The entity that corresponds to this object.

id()

Get the unique id of the object.

Notes: It might differ from the entity number since a multi-world setting with the same models inserted in the same order would result to same numbering.

Return type

int

Returns

The unique object id. Invalid objects return 0.

property thisown

The membership flag

class scenario.bindings.gazebo.GazeboSimulator(step_size=0.001, rtf=1.0, steps_per_run=1)

Bases: object

close()

Close the simulator and the GUI.

Return type

boolean

Returns

True for success, false otherwise.

get_world(*args)

Get a simulated world.

Parameters

worldName (string) – The name of the desired world.

Return type

World

Returns

The world object.

gui(verbosity=- 1)

Open the Ignition Gazebo GUI.

Parameters

verbosity (int) – Configure the verbosity of the GUI (0-4)

Return type

boolean

Returns

True for success, false otherwise.

initialize()

Initialize the simulator.

Return type

boolean

Returns

True for success, false otherwise.

initialized()

Check if the simulator has been initialized.

Return type

boolean

Returns

True if the simulator was initialized, false otherwise.

insert_world_from_sdf(*args)

Load a SDF world file.

Notes: If the world file is not passed, the default empty world is inserted. The default empty world does not have the ground plane nor any physics. Both can be added by operating on the World object.

This function can only be used while the simulator object is uninitialized.

Parameters
  • worldFile (string) – The path to the SDF world file.

  • worldName (string) – Optionally override the name of the world defined in the SDF world file.

Return type

boolean

Returns

True for success, false otherwise.

insert_worlds_from_sdf(*args)

Load a SDF world file containing multiple worlds.

Parameters
  • worldFile (string) – The path to the SDF world file.

  • worldNames (Tuple[string]) – Optionally override the names of the worlds defined in the SDF world file.

Return type

boolean

Returns

True for success, false otherwise.

Warning: This is an experimental feature. Multiworld simulations are only partially supported by Ignition Gazebo.

pause()

Pause the simulator.

Notes: This method is useful in non-deterministic mode, which is not currently supported.

Return type

boolean

Returns

True for success, false otherwise.

real_time_factor()

Get the desired real-time factor of the simulator.

Return type

float

Returns

The desired real-time factor.

run(paused=False)

Run the simulator.

Parameters

paused (boolean) – True to perform paused steps that do not affect the physics, false for normal steps. The number of steps configured during construction are executed.

Return type

boolean

Returns

True for success, false otherwise.

running()

Check if the simulator is running.

Notes: This method is useful in non-deterministic mode, which is not currently supported.

Return type

boolean

Returns

True for success, false otherwise.

step_size()

Get the size of a simulator step.

Return type

float

Returns

The simulator step size in seconds.

steps_per_run()

Get the number or steps to execute every simulator run.

Return type

int

Returns

The configured number of steps per run.

property thisown

The membership flag

world_names()

Get the list if the world names part of the simulation.

Return type

Tuple[string]

Returns

The world names.

class scenario.bindings.gazebo.Joint

Bases: scenario.bindings.core.Joint, scenario.bindings.gazebo.GazeboEntity

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.

id()

Get the unique id of the object.

Notes: It might differ from the entity number since a multi-world setting with the same models inserted in the same order would result to same numbering.

Return type

int

Returns

The unique object id. Invalid objects return 0.

insert_joint_plugin(*args)

Insert a Ignition Gazebo plugin to the joint.

Parameters
  • libName (string) – The library name of the plugin.

  • className (string) – The class name (or alias) of the plugin.

  • context (string) – Optional XML plugin context.

Return type

boolean

Returns

True for success, 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.

reset(position=0, velocity=0, dof=0)

Reset the state of a joint DOF.

This method also resets the PID state of the joint.

Parameters
  • position (float) – The desired position.

  • velocity (float) – The desired velocity.

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

Return type

boolean

Returns

True for success, false otherwise.

reset_joint(position, velocity)

Reset the state of the joint.

This method also resets the PID state of the joint.

Parameters
  • position (Tuple[float]) – The desired position.

  • velocity (Tuple[float]) – The desired velocity.

Return type

boolean

Returns

True for success, false otherwise.

reset_joint_position(position)

Reset the position of the joint.

This method also resets the PID state of the joint.

Parameters

position (Tuple[float]) – The desired position.

Return type

boolean

Returns

True for success, false otherwise.

reset_joint_velocity(velocity)

Reset the velocity of the joint.

This method also resets the PID state of the joint.

Parameters

velocity (Tuple[float]) – The desired velocity.

Return type

boolean

Returns

True for success, false otherwise.

reset_position(position=0, dof=0)

Reset the position of a joint DOF.

Parameters
  • position (float) – The desired position.

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

Return type

boolean

Returns

True for success, false otherwise.

reset_velocity(velocity=0, dof=0)

Reset the velocity of a joint DOF.

Parameters
  • velocity (float) – The desired velocity.

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

Return type

boolean

Returns

True for success, false otherwise.

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_coulomb_friction(value)

Set the Coulomb friction parameter of the joint.

Notes: Friction can be changed only before the first simulated step after model insertion.

Parameters

value (float) – The new Coulomb friction value.

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.

set_viscous_friction(value)

Set the viscous friction parameter of the joint.

Notes: Friction can be changed only before the first simulated step after model insertion.

Parameters

value (float) – The new viscous friction value.

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 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.

Bases: scenario.bindings.core.Link, scenario.bindings.gazebo.GazeboEntity

apply_world_force(force, duration=0.0)

Apply a force to the link.

The force is applied to the origin of the link frame.

Parameters
  • force (Tuple[float, float, float]) – The force to apply expressed in world coordinates.

  • duration (float) – The duration of the application of the force. By default the force is applied for a single physics step.

Return type

boolean

Returns

True for success, false otherwise.

apply_world_torque(torque, duration=0.0)

Apply a torque to the link.

The force is applied to the origin of the link frame.

Parameters
  • torque (Tuple[float, float, float]) – The torque to apply expressed in world coordinates.

  • duration (float) – The duration of the application of the torque. By default the torque is applied for a single physics step.

Return type

boolean

Returns

True for success, false otherwise.

apply_world_wrench(force, torque, duration=0.0)

Apply a wrench to the link.

The force is applied to the origin of the link frame.

Parameters
  • force (Tuple[float, float, float]) – The force to apply expressed in world coordinates.

  • torque (Tuple[float, float, float]) – The torque to apply expressed in world coordinates.

  • duration (float) – The duration of the application of the wrench. By default the wrench is applied for a single physics step.

Return type

boolean

Returns

True for success, false otherwise.

apply_world_wrench_to_co_m(force, torque, duration=0.0)

Apply a wrench to the CoM of the link.

Notes: This method considers the CoM being positioned in the origin of the inertial frame as it is defined in the SDF description of the model. Note that if not explicitly specified, inertial and link frames match. In this case, applyWorldWrench and applyWorldWrenchToCoM effects will be the same.

Parameters
  • force (Tuple[float, float, float]) – The force to apply expressed in world coordinates.

  • torque (Tuple[float, float, float]) – The torque to apply expressed in world coordinates.

  • duration (float) – The duration of the application of the wrench. By default the wrench is applied for a single physics step.

Return type

boolean

Returns

True for success, false otherwise.

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.

id()

Get the unique id of the object.

Notes: It might differ from the entity number since a multi-world setting with the same models inserted in the same order would result to same numbering.

Return type

int

Returns

The unique object id. Invalid objects return 0.

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.

Insert a Ignition Gazebo plugin to the link.

Parameters
  • libName (string) – The library name of the plugin.

  • className (string) – The class name (or alias) of the plugin.

  • context (string) – Optional XML plugin context.

Return type

boolean

Returns

True for success, 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

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.gazebo.Model

Bases: scenario.bindings.core.Model, scenario.bindings.gazebo.GazeboEntity

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.

enable_self_collisions(enable=True)

Enable the detection of self-collisions.

It will enable contact detection if it was disabled.

Parameters

enable (boolean) – True to enable the self-collision detection, false to disable.

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(*args)

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.

id()

Get the unique id of the object.

Notes: It might differ from the entity number since a multi-world setting with the same models inserted in the same order would result to same numbering.

Return type

int

Returns

The unique object id. Invalid objects return 0.

insert_model_plugin(*args)

Insert a Ignition Gazebo plugin to the model.

Parameters
  • libName (string) – The library name of the plugin.

  • className (string) – The class name (or alias) of the plugin.

  • context (string) – Optional XML plugin context.

Return type

boolean

Returns

True for success, 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.

reset_base_orientation(*args)

Reset the orientation of the base link.

Parameters

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

Return type

boolean

Returns

True for success, false otherwise.

reset_base_pose(*args)

Reset the pose of the base link.

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

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

Return type

boolean

Returns

True for success, false otherwise.

reset_base_position(*args)

Reset the position of the base link.

Parameters

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

Return type

boolean

Returns

True for success, false otherwise.

reset_base_world_angular_velocity(*args)

Reset the angular mixed velocity of the base link.

Parameters

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

Return type

boolean

Returns

True for success, false otherwise.

reset_base_world_linear_velocity(*args)

Reset the linear mixed velocity of the base link.

Parameters

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

Return type

boolean

Returns

True for success, false otherwise.

reset_base_world_velocity(*args)

Reset the mixed velocity of the base link.

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

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

Return type

boolean

Returns

True for success, false otherwise.

reset_joint_positions(*args)

Reset the positions of the joints.

Parameters
  • positions (Tuple[float]) – The desired new joint positions.

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

Return type

boolean

Returns

True for success, false otherwise.

reset_joint_velocities(*args)

Reset the velocities of the joints.

Parameters
  • velocities (Tuple[float]) – The desired new velocities positions.

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

Return type

boolean

Returns

True for success, false otherwise.

self_collisions_enabled()

Check if the detection of self-collisions is enabled.

Return type

boolean

Returns

True if self-collisions detection is enabled, false otherwise.

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

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.

scenario.bindings.gazebo.PhysicsEngine_dart = 0

The physics engine included in the Dynamic Animation and Robotics Toolkit.

scenario.bindings.gazebo.PhysicsEngine_tpe = 1

The Trivial Physics Engine, a kinematics-only physics engine developed by Open Robotics.

class scenario.bindings.gazebo.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.gazebo.ToGazeboJoint(base)
scenario.bindings.gazebo.ToGazeboModel(base)
scenario.bindings.gazebo.ToGazeboWorld(base)
class scenario.bindings.gazebo.World

Bases: scenario.bindings.core.World, scenario.bindings.gazebo.GazeboEntity

get_model(model_name)

Get a model part of the world.

Parameters

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

Return type

scenario.core.Model

Returns

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

gravity()

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

id()

Get the unique id of the object.

Notes: It might differ from the entity number since a multi-world setting with the same models inserted in the same order would result to same numbering.

Return type

int

Returns

The unique object id. Invalid objects return 0.

insert_model(*args)

Load a model from the given path and insert it into the world.

This function is a shim over InsertModelFromFile for backwards compatibility.

Parameters
  • modelFile (string) – A path to the URDF or SDF file to load and insert.

  • pose (Pose) – The optional initial pose of the model.

  • overrideModelName (string) – The optional name of the model. This is the name used to get the model with World::getModel.

Return type

boolean

Returns

True for success, false otherwise.

Notes: The default pose and model name are those specified in the robot description. If the pose is not specified, the identity is used.

Warning: In order to process the model insertion, a simulator step must be executed. It could either be a paused or unpaused step.

insert_model_from_file(*args)

Load a model from the given path and insert it into the world.

Parameters
  • path (string) – A path to the URDF or SDF file to load and insert.

  • pose (Pose) – The optional initial pose of the model.

  • overrideModelName (string) – The optional name of the model. This is the name used to get the model with World::getModel.

Return type

boolean

Returns

True for success, false otherwise.

Notes: The default pose and model name are those specified in the robot description. If the pose is not specified, the identity is used.

Warning: In order to process the model insertion, a simulator step must be executed. It could either be a paused or unpaused step.

insert_model_from_string(*args)

Load a model from the given string and insert it into the world.

Parameters
  • sdfString (string) – A string containing the model’s SDF/URDF XML.

  • pose (Pose) – The optional initial pose of the model.

  • overrideModelName (string) – The optional name of the model. This is the name used to get the model with World::getModel.

Return type

boolean

Returns

True for success, false otherwise.

Notes: The default pose and model name are those specified in the robot description. If the pose is not specified, the identity is used.

Warning: In order to process the model insertion, a simulator step must be executed. It could either be a paused or unpaused step.

insert_world_plugin(*args)

Insert a Ignition Gazebo plugin to the world.

Parameters
  • libName (string) – The library name of the plugin.

  • className (string) – The class name (or alias) of the plugin.

  • context (string) – Optional XML plugin context.

Return type

boolean

Returns

True for success, false otherwise.

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.

remove_model(model_name)

Remove a model from the world.

Parameters

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

Return type

boolean

Returns

True for success, false otherwise.

Warning: In order to process the model removal, a simulator step must be executed. It could either be a paused or unpaused step.

set_gravity(gravity)

Set the gravity of the world.

Notes: This method must be called after setting the physics engine and before performing any physics step.

Parameters

gravity (Tuple[float, float, float]) – The desired gravity vector.

Return type

boolean

Returns

True for success, false otherwise.

set_physics_engine(engine)

Set the physics engine of the world.

By default, if the world file does not already contain a physics plugin, no physics is loaded by default. This method allows to insert in the simulator a plugin with one of the supported physics engines.

Parameters

engine (int) – The desired physics engine.

Return type

boolean

Returns

True for success, false otherwise.

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.

valid()

Check if the world is valid.

Return type

boolean

Returns

True if the world is valid, false otherwise.

scenario.bindings.gazebo.denormalize(input, low, high)

Denormalize a vector from [-1, 1].

The denormalization applies the following equation, where \(v\) is the input, \(l\) and \(h\) are respectively the lower and higher limits:

\(v_{denormalized} = \frac{1}{2} (v + 1)(h - l) - l\)

The input, low and high arguments are broadcasted to a common size. Refer to the following for broadcasting definition:

https://numpy.org/doc/stable/user/basics.broadcasting.html

Parameters
  • input (Tuple[float]) – The input vector.

  • low (Tuple[float]) – The lower limit.

  • high (Tuple[float]) – The higher limit.

Raises

std::invalid_argument If the arguments cannot be broadcasted.

Return type

Tuple[float]

Returns

The denormalized input.

scenario.bindings.gazebo.find_sdf_file(file_name)

Find a SDF file in the filesystem.

The search path is defined with the IGN_GAZEBO_RESOURCE_PATH environment variable.

Parameters

fileName (string) – The SDF file name.

Return type

string

Returns

The absolute path to the file if found, an empty string otherwise.

scenario.bindings.gazebo.get_empty_world()

Return a SDF string with an empty world.

An empty world only has a sun and the default DART physics profile enabled.

Notes: The empty world does not have any ground plane.

Return type

string

Returns

A SDF string with the empty world.

scenario.bindings.gazebo.get_model_file_from_fuel(uri, use_cache=False)

Get a SDF model file from a Fuel URI.

Notes: A valid URI has the following form: https://fuel.ignitionrobotics.org/openrobotics/models/model_name

Parameters
  • URI (string) – A valid Fuel URI.

  • useCache (boolean) – Load the model from the local cache.

Return type

string

Returns

The absolute path to the SDF model.

scenario.bindings.gazebo.get_model_name_from_sdf(file_name)

Get the name of a model from a SDF file or SDF string.

Notes: sdformat supports only one model per SDF.

Parameters

fileName (string) – An SDF file or string. It could be an absolute path to the file, the file name if the parent folder is part of the IGN_GAZEBO_RESOURCE_PATH environment variable, or a SDF string.

Return type

string

Returns

The name of the model if the SDF is valid, an empty string otherwise.

scenario.bindings.gazebo.get_random_string(length)

Generate a random alpha numeric string.

Parameters

length (int) – The length of the string.

Return type

string

Returns

The random string.

scenario.bindings.gazebo.get_sdf_string(file_name)

Get an SDF string from a SDF file.

Parameters

fileName (string) – An SDF file. It could be either an absolute path to the file or the file name if the parent folder is part of the IGN_GAZEBO_RESOURCE_PATH environment variable.

Return type

string

Returns

The SDF string if the file was found and is valid, an empty string otherwise.

scenario.bindings.gazebo.get_world_name_from_sdf(file_name, world_index=0)

Get the name of a world from a SDF file or SDF string.

Parameters

fileName (string) – An SDF file or string. It could be an absolute path to the file, the file name if the parent folder is part of the IGN_GAZEBO_RESOURCE_PATH environment variable, or a SDF string.

Return type

string

Returns

The name of the world if the SDF is valid, an empty string otherwise.

scenario.bindings.gazebo.insert_plugin_to_gazebo_entity(*args)

Insert a plugin to any Gazebo entity.

Notes: This function will not return true if the plugin is successful. This function just triggers an event that notifies the server to load a plugin, and it does not receive any return value that could be used to assess the outcome.

Parameters
  • gazeboEntity (GazeboEntity) – The Gazebo entity (world, model, joint, …).

  • libName (string) – The name of the plugin library.

  • className (string) – The name of the class implementing the plugin.

  • context (string) – The optional plugin SDF context.

Return type

boolean

Returns

True if the entity is valid, false otherwise.

scenario.bindings.gazebo.normalize(input, low, high)

Normalize a vector in [-1, 1].

The normalization applies the following equation, where \(v\) is the input, \(l\) and \(h\) are respectively the lower and higher limits:

\(v_{normalized} = 2 \frac{v - l}{h - l} - 1\)

The input, low and high arguments are broadcasted to a common size. Refer to the following for broadcasting definition:

https://numpy.org/doc/stable/user/basics.broadcasting.html

Notes: If the lower limit matches the higher limit, the corresponding input value is not normalized.

Parameters
  • input (Tuple[float]) – The input vector.

  • low (Tuple[float]) – The lower limit.

  • high (Tuple[float]) – The higher limit.

Raises

std::invalid_argument If the arguments cannot be broadcasted.

Return type

Tuple[float]

Returns

The normalized input.

scenario.bindings.gazebo.sdf_string_valid(sdf_string)

Check if a SDF string is valid.

An SDF string could contain for instance an SDF model or an SDF world, and it is valid if it can be parsed successfully by the SDFormat library.

Parameters

sdfString (string) – The SDF string to check.

Return type

boolean

Returns

True if the SDF string is valid, false otherwise.

scenario.bindings.gazebo.set_verbosity(*args)

Set the verbosity process-wise.

Accepted levels are the following:

  • Verbosity::SuppressAll: No messages.

  • Verbosity::Error: Error messages.

  • Verbosity::Warning: Error and warning messages.

  • Verbosity::Info: Error, warning, and info messages.

  • Verbosity::Debug: Error, warning, info, and debug messages.

If called without specifying the level, it will use Verbosity::Warning or Verbosity::Debug depending if the project was compiled respectively with Release or Debug flags.

Parameters

level (int) – The verbosity level.

scenario.bindings.gazebo.urdffile_to_sdfstring(urdf_file)

Convert a URDF file to a SDF string.

Parameters

urdfFile (string) – The absolute path to the URDF file.

Return type

string

Returns

The SDF string if the file exists and it was successfully converted, an empty string otherwise.

scenario.bindings.gazebo.urdfstring_to_sdfstring(urdf_string)

Convert a URDF string to a SDF string.

Parameters

urdfFile – A URDF string.

Return type

string

Returns

The SDF string if the URDF string was successfully converted, an empty string otherwise.