Loading robots#

Loading your Robot#

To load a robot, you’ll need to use the RobotWrapper class. This class is wrapping the robot model, state and exposing all convenient methods to interact with your robot model.

Note

The URDF and MJCF files are loaded by PlaCo’s own parsers, which build the same models as pinocchio (the reference used to implement PlaCo’s rigid body model): joints order, frames, merged fixed bodies and geometries names are the same.

Using URDF file#

To load your robot, you can simply specify an URDF file this way:

import placo
robot = placo.RobotWrapper("model/robot.urdf")

Note

If you only specify a directory, the robot.urdf file will be loaded.

Flags#

The second argument of RobotWrapper is a flag to specify modifiers. Available flags are the following:

Flag

Description

placo.Flags.collision_as_visual

Load collision geometry as visual geometry.

placo.Flags.ignore_collisions

Ignore all collisions (remove all the pairs).

placo.Flags.mjcf

Use MuJoCo MJCF instead of URDF (see below)

For more information about the handling of self-collisions, see Self-collisions. An example would be:

import placo
# Loading a robot, ignoring all collisions
robot = placo.RobotWrapper("model/robot.urdf", placo.Flags.ignore_collisions)

Using direct URDF contents#

The third argument of RobotWrapper can be provided if you want to give the contents of the URDF file directly:

import placo
# Providing directly the URDF contents
robot = placo.RobotWrapper("model/", 0, urdf_contents)

Using MuJoCo (MJCF) file#

You can load a robot from a MuJoCo (MJCF) file by using the placo.Flags.mjcf flag:

import placo
# Loading a robot from MuJoCo (MJCF) file
robot = placo.RobotWrapper("model/robot.xml", placo.Flags.mjcf)