robot

This module adds the notion of hardware and option TOML configuration files for robots. It provides utilities for generating them automatically and a basic wrapper on top of the lower-level Jiminy Robot for loading them.

jiminy_py.robot.generate_default_hardware_description_file(urdf_path, hardware_path=None, default_update_rate=1000.0, verbose=True)[source]

Generate a default hardware description file, based on the information grabbed from the URDF when available, using educated guess otherwise.

If no IMU sensor is found, a single one is added on the root body of the kinematic tree. If no Gazebo plugin is available, collision bodies and force sensors are added on every leaf body of the robot. Otherwise, the definition of the plugins in use to infer them.

‘joint’ fields are parsed to extract every joint, actuated or not. ‘fixed’ joints are not considered as actual joints. Transmission fields are parsed to determine which one of those joints are actuated. If no transmission is found, it is assumed that every joint is actuated, with a transmission ratio of 1:1.

It is assumed that:

  • every joint has an encoder attached,

  • every actuated joint has an effort sensor attached,

  • every collision body has a force sensor attached

  • for every Gazebo contact sensor, the associated body is added to the set of the collision bodies, but it is not the case for Gazebo force plugin.

When the default update rate is unspecified, then the default sensor update rate is 1KHz if no Gazebo plugin has been found, otherwise the highest one among found plugins will be used.

Note

It has been primarily designed for robots with freeflyer. The default configuration should work out-of-the-box for walking robot, but substantial modification may be required for different types of robots such as wheeled robots or robotics manipulator arms.

Note

TOML format as be chosen to make reading and manually editing of the file as human-friendly as possible.

Parameters:
  • urdf_path (str) – Fullpath of the URDF file.

  • hardware_path (str | None) – Fullpath of the hardware description file. Optional: By default, it is the same location than the URDF file, using ‘*_hardware.toml’ extension.

  • default_update_rate (float) – Default update rate of the sensors and the controller in Hz. It will be used for sensors whose the update rate is unspecified. 0.0 for continuous update. Optional: DEFAULT_UPDATE_RATE if no Gazebo plugin has been found, the lowest among the Gazebo plugins otherwise.

  • verbose (bool) – Whether to print warnings.

Return type:

None

jiminy_py.robot.load_hardware_description_file(robot, hardware_path, avoid_instable_collisions=True, verbose=True)[source]

Load hardware configuration file.

If no collision geometry is associated with the body requiring collision handling, then the visual geometry is used instead, if any. If none is available despite at, then a single contact point is added at body frame.

For now, every mesh used for collision are replaced by the vertices of the associated minimum volume bounding box, to avoid numerical instabilities.

Parameters:
  • robot (Robot) – Jiminy robot.

  • hardware_path (str) – Path of Jiminy hardware description toml file.

  • avoid_instable_collisions (bool) – Prevent numerical instabilities by replacing collision mesh by vertices of associated minimal volume bounding box, and primitive box by its vertices.

  • verbose (bool) – Whether to print warnings.

Returns:

Unused information available in hardware configuration file.

Return type:

Dict[str, Any]

class jiminy_py.robot.BaseJiminyRobot((object)arg1[, (str)name=''])[source]

Bases: Robot

Base class to instantiate a Jiminy robot based on a standard URDF file and Jiminy-specific hardware description file.

The utility ‘generate_default_hardware_description_file’ is provided to automatically generate a default hardware description file for any given URDF file. URDF file containing Gazebo plugins description should not require any further modification as it usually includes the information required to fully characterize the motors, sensors, contact points and collision bodies, along with some of there properties.

Note

Overload this class if you need finer-grained capability.

Warning

Hardware description files within the same directory and having the name than the URDF file will be detected automatically without requiring to manually specify its path.

initialize(urdf_path, hardware_path=None, mesh_path_dir=None, mesh_package_dirs=(), has_freeflyer=True, avoid_instable_collisions=True, load_visual_meshes=False, verbose=True)[source]

Initialize the robot.

Parameters:
  • urdf_path (str) – Path of the URDF file of the robot.

  • hardware_path (str | None) – Path of Jiminy hardware description toml file. Optional: Looking for ‘*_hardware.toml’ file in the same folder and with the same name. If not found, then no hardware is added to the robot, which is valid and can be used for display.

  • mesh_path_dir (str | None) – Path to the folder containing the URDF meshes. It will overwrite the common root of all absolute mesh paths. Optional: Env variable ‘JIMINY_DATA_PATH’ will be used if available.

  • mesh_package_dirs (Sequence[str]) – Additional search paths for all relative mesh paths beginning with ‘packages://’ directive. ‘mesh_path_dir’ is systematically appended.

  • has_freeflyer (bool) – Whether the robot is fixed-based wrt its root link, or can move freely in the world.

  • avoid_instable_collisions (bool) – Prevent numerical instabilities by replacing collision mesh by vertices of associated minimal volume bounding box, primitive box by its vertices, and primitive sphere by its center.

  • load_visual_meshes (bool) – Load visual and collision geometries when creating the robot. It will allow for dumping standalone log files that are safe to carry around but larger.

  • verbose (bool) – Whether to print warnings.

Return type:

None