Coordinate Systems

Certain movement operations provided by this library allow the specification of a coordinate system in which the motion is executed. Coordinate systems may be predefined, such as the robot, tool, or camera coordinate system, or they may be defined by the user. User-defined coordinate systems offer flexibility and can represent arbitrary frames of reference. These may be static or dynamic; in the latter case, they can be updated at runtime to reflect changing conditions.

New coordinate systems are defined by a pose that is expressed relative to the robot coordinate system.

The joint coordinate system is a special case as it is defined in joint space rather than Cartesian space. Manipulating the joint coordinate system is rarely necessary and is therefore not supported.

The coordinate systems are the variants of the Cs enum: Robot, Tool, Camera, and the user coordinate systems User1 to User16. Only the user coordinate systems can be read and written, which the UserCs enum encodes: it has only the User1 to User16 variants and is what the methods below accept. A motion target takes a Cs; a UserCs converts into one with .into(), as in with_cs(UserCs::User1.into()).

Reading a Coordinate System

To get the origin of a user coordinate system as a CartesianPose in robot coordinates, use cs_origin():

let usercs1_origin = robot.cs_origin(UserCs::User1)?;

Manipulating a Coordinate System

The origin of a user coordinate system is set with set_cs_origin(). It takes the coordinate system to manipulate and the new origin, given as any motion target: a JointPose, which places the origin where the TCP of the selected tool, or the flange without a tool, is at that joint pose, a CartesianPose, or a CartesianTarget. Of a CartesianTarget only the pose and the coordinate system are used; arriving_cs and configuration_vector are ignored. A CartesianTarget must not be expressed in the coordinate system it defines; such a call fails with RobotArmError::InvalidArgument:

robot.set_cs_origin(UserCs::User1, home)?;

The robot control stores every origin in robot coordinates. A JointPose is therefore first converted into the TCP pose in robot coordinates with the robot’s kinematics. Like a CartesianPose or a CartesianTarget in Cs::Robot, the result is written directly and confirmed by reading it back. For a CartesianTarget in another coordinate system, the call waits for two confirmations. Each wait is bounded by the command timeout, so such a call can take up to twice the command timeout. If such a call fails, it writes the previous origin back, without confirming that write, before returning the error. Do not redefine a coordinate system that a running motion uses.

Moving in a Coordinate System

A motion is executed in a coordinate system by giving the target as a CartesianTarget with the coordinate system attached; every motion method takes it. The following moves the tool to the origin of the first user coordinate system, which after the call above is the home pose:

robot
    .move_ptp(CartesianTarget::new(CartesianPose::default()).with_cs(UserCs::User1.into()))
    .start()?
    .join()?;

Full Example

The complete program sets a user coordinate system, moves to its origin, and verifies the result. It is rust/crates/voraus-robot-arm/examples/coordinate_systems.rs in the repository.

Trait Definitions

Reading an origin is the GetCsOrigin trait, which a read-only view implements as well; setting one is the SetCsOrigin trait, which extends it. Application code calls cs_origin() and set_cs_origin(), which accepts any motion target. A robot type implements cs_origin() and the hidden apply_cs_origin(). The traits are included here from the crate’s source.