Joint configurations#

Robot state#

The robot configuration is stored in the RobotWrapper class, in the state members:

  • robot.state.q for \(q\) the joint positions, you can use the helpers:
    • get_joint: to retrieve the joint value of a given joint name,

    • set_joint: to set the joint value of a given joint name,

  • robot.state.qd for \(\dot{q}\) the joint velocities, you can use the helpers:
  • robot.state.qdd for \(\ddot{q}\) the joint accelerations, you can use the helpers:

For example:

# Sets head_pan joint to 0.5 rad
robot.set_joint("head_pan", 0.5)

Retrieving all the joint names#

All the joint names can be retrieved by calling joint_names().

Integrating#

You can call integrate to integrate the robot state. This will integrate the acceleration, velocity and position of the robot for a given dt.

Joint limits#

Limits are loaded by default from the URDF file. However, you can override the joint limits by using set_joint_limits:

# Sets head_pan joint limits to [-1.0, 1.0] rad
robot.set_joint_limits("head_pan", -1.0, 1.0)

You can also update the velocity and torque limits, by using respectively set_velocity_limit and set_torque_limit.

Adding configuration noise#

You can call the method add_q_noise to add noise to the joint positions:

# Adds noise to the joint positions
robot.add_q_noise(0.01)

The noise parameters is a value between 0 and 1. A random configuration will be sampled within the ranges of the robot, and the configuration will be updated towards this configuration.

Rotor inertia and gear ratio#

In order to take apparent inertia in account, you can set the rotor inertia and gear ratio of the joints, by calling set_rotor_inertia() and set_gear_ratio():

# Sets the rotor inertia to 1e-5 N.m.s^2
robot.set_rotor_inertia("head_pan", 1e-5)

# Sets the gear ratio of the head_pan joint to 100
robot.set_gear_ratio("head_pan", 100)

Note

A rotor inertia of \(I_{rotor}\) and a gear ratio of \(G\) will modify the apparent inertia of the joint by \(I_{rotor} \times G^2\).