Robot description · repose-robot-description

Import a URDF

CuRobotDescription::from_urdf follows the URDF tree from a base link to a tip link and converts that path into a chain and a collision model. Anything it can't represent faithfully is an error, never a silent omission.

Import

rust
use repose_robot_description::{CuRobotDescription, CuUrdfImport};
use repose_collision::CuCollisionModelParams;

let robot = CuRobotDescription::<6, 16>::from_urdf(
    include_str!("../robots/my_arm.urdf"),
    CuUrdfImport::new("base_link", "tool0").with_collision(CuCollisionModelParams {
        safety_margin: Length::new::<meter>(0.005),
        skip_adjacent_links: false,
    }),
)?;

println!("{:?}", robot.joint_names());         // order used in every payload
let (chain, model) = robot.into_parts();

include_str! keeps the file in the binary. Reading it from disk at startup works too: the importer only needs a &str.

Path selection

Only the joints between base_link and tip_link become the chain; other branches (a second arm, a camera mast) are ignored. The tip must descend from the base. The tip link's frame becomes the tool frame, and fixed joints along the path are folded into the neighbouring transforms, ending up in the tool offset after the last movable joint.

Joints

revoluteRevolute with the URDF limits.
continuousRevolute with ±π bounds.
prismaticPrismatic with the URDF limits.
fixedFolded into the transform chain.
floating, planar, mimic jointsRejected.

Axes must be non-zero and finite, velocity limits positive, lower ≤ upper.

Collision geometry

<sphere>Sphere.
<cylinder>A capsule along the cylinder's axis with the same radius and length, which fully encloses the cylinder including its flat ends.
<box>, <mesh>Rejected. Add sphere or cylinder collision elements to the URDF (keep the meshes for visuals) or preprocess them.

Each collision element becomes one shape on the frame of the joint that moves its link, or on the base for links before the first movable joint. robot.collision_links() tells you which URDF link each shape index came from, which helps when reading contact reports.

Default collision parameters

CuUrdfImport::new uses a zero safety margin and no adjacent-link skipping, because the importer can't know which neighbours touch. Either set skip_adjacent_links: true yourself, or (better) supply an SRDF whose disable_collisions list names the pairs that touch by construction.

What gets rejected

Malformed XML, duplicate link or joint names, joints referencing unknown links, a link with several parents, cycles, more or less than one root link, a tip that isn't below the base, a movable-joint count different from N, more collision shapes than M, empty or non-positive geometry, unsupported joint types or geometry. Each comes back as a CuError with a message naming the problem.

API reference