Reading the Robot State

The current robot state is defined by various metrics.
The most basic and universally supported one is the provision of joint positions.

Whether a robot supports other metrics such as the provision of the Tool Center Point (TCP) pose and TCP velocity depends on the robot and the underlying robot control.

Reading the Main State of the Robot

In addition to the lifecycle state, a robot may also provide more specific states.

For example a robot with Victor behavior can be in one of the following states:

These states can be read using the get_robot_state_v() method.

Note

Note that those states are specific to a robot behavior group and may require additional effort when porting to another robot. If possible, stick to the lifecycle states, as those are available on every robot.

Reading the Joint Pose

Reading the joint pose can be done using the method get_joint_pose(). It will return the most recent joint pose reported by the robot control in radians.

joint_pose = robot.get_joint_pose()
_logger.info("The current joint pose is %s", joint_pose)

If you run the code, the log output should look like the following:

[INFO ]  The current joint pose is [0.0, -1.57..., 1.57..., -1.57..., -1.57..., 0.0]

Note that the method makes no assumption whether the values are actually measured or inferred but delegates this issue to the respective robot control.

Reading the Joint Velocities

Reading the joint velocities can be done using the method get_joint_velocities(). It will return the most recent joint velocities reported by the robot control in radians per second.

joint_velocities = robot.get_joint_velocities()
_logger.info("The current joint velocities are %s", joint_velocities)

If you run the code, the log output should look like the following:

[INFO ]  The current velocities are (0.0, 0.0, -1.57..., 0.0, 0.0, 0.0)

Note that the method makes no assumption whether the values are actually measured or inferred but delegates this issue to the respective robot control.

Reading the Joint Accelerations

Reading the joint accelerations can be done using the method get_joint_accelerations(). It will return the most recent joint accelerations reported by the robot control in radians per second squared.

joint_accelerations = robot.get_joint_accelerations()
_logger.info(
    "The current joint accelerations are %s", joint_accelerations
)

If you run the code, the log output should look like the following:

[INFO ]  The current accelerations are (0.0, 0.0, -3.66..., 0.0, 0.0, 0.0)

Note that the method makes no assumption whether the values are actually measured or inferred but delegates this issue to the respective robot control.

Reading the TCP Pose

Reading the TCP pose can be done using the method get_tcp_pose(). It returns the current TCP pose reported by the robot control in meters for the translational part and in radians for the rotational part.

tcp_pose = robot.get_tcp_pose()
_logger.info("The current TCP pose is %s", tcp_pose)

If you run the code, the log output should look like the following:

[INFO ]  The current TCP pose is [0.54..., -0.13..., 0.29..., -3.14..., 0.0..., 1.57...]

Note that the method makes no assumption about the coordinate system of the returned pose but delegates this issue to the respective robot control.

Reading the TCP Velocity

Reading the TCP velocity can be done using the method get_tcp_velocity(). It returns the current TCP velocity reported by the robot control in meters per second for the translational part and in radians per second for the rotational part.

tcp_velocity = robot.get_tcp_velocity()
_logger.info("The current TCP velocity is %s", tcp_velocity)

If you run the code, the log output should look like the following:

[INFO ]  The current TCP velocity is (0.19..., 0.0, 0.99..., 0.0, -1.58..., 0.0)

Full Example of Reading the Robot States

The following example shows a simple application in which the robot states are being read.