State and errors


Robot state

State

Dictionary key

Unit

Data type

Axis - specific (joint) actual position

joint_position

radians

np.ndarray shape=(7,) dtype=np.float32

Axis-specific (joint) actual velocity internally calculated as the position difference in 1/100 second interval

joint_velocity

radians/s

np.ndarray shape=(7,) dtype=np.float32

External acting torques without the component resulting from the robot weight and mass inertias during motion

joint_torque

Nm

np.ndarray shape=(7,) dtype=np.float32

Cartesian position (X,Y,Z)

cartesian_position

m

np.ndarray shape=(3,) dtype=np.float32

Cartesian orientation (A,B,C)

cartesian_orientation

radians

np.ndarray shape=(3,) dtype=np.float32

External Cartesian forces (X,Y,Z)

cartesian_force

N

np.ndarray shape=(3,) dtype=np.float32

External Cartesian torques (A,B,C)

cartesian_torque

Nm

np.ndarray shape=(3,) dtype=np.float32

Last registered error code. See Errors

last_error

libiiwa.Error

Whether motion has terminated due to a break condition

has_fired_condition

bool

Whether the robot is ready for motion. A true value does not necessarily mean that the brakes are open and that the robot is under servo control

is_ready_to_move

bool

Whether the robot is active. It does not provide any information on whether the robot is currently in motion (a false value does not necessarily mean that the robot is stationary)

has_active_motion

bool

get_state

LibIiwa.get_state(refresh: bool = False) Mapping[str, ndarray]

Get the state of the robot

Parameters:

refresh (bool, optional) – If True, the state is requested from the robot otherwise the last received state is returned (default: False)

Returns:

The state of the robot

Return type:

dict

Example:

>>> # get an updated robot state
>>> iiwa.get_state(refresh=True)
{'joint_position': array([0., 0., 0., 0., 0., 0., 0.], dtype=float32), 'joint_velocity': array([0., 0., 0., 0., 0., 0., 0.], dtype=float32), 
'joint_acceleration': array([0., 0., 0., 0., 0., 0., 0.], dtype=float32), 'joint_torque': array([0., 0., 0., 0., 0., 0., 0.], dtype=float32), 
'cartesian_position': array([0., 0., 0.], dtype=float32), 'cartesian_orientation': array([0., 0., 0.], dtype=float32), 
'cartesian_force': array([0., 0., 0.], dtype=float32), 'cartesian_torque': array([0., 0., 0.], dtype=float32)}

>>> # get the last updated robot state
>>> iiwa.get_state(refresh=False)  # or just `iiwa.get_state()`
{'joint_position': array([0., 0., 0., 0., 0., 0., 0.], dtype=float32), 'joint_velocity': array([0., 0., 0., 0., 0., 0., 0.], dtype=float32), 
'joint_acceleration': array([0., 0., 0., 0., 0., 0., 0.], dtype=float32), 'joint_torque': array([0., 0., 0., 0., 0., 0., 0.], dtype=float32), 
'cartesian_position': array([0., 0., 0.], dtype=float32), 'cartesian_orientation': array([0., 0., 0.], dtype=float32), 
'cartesian_force': array([0., 0., 0.], dtype=float32), 'cartesian_torque': array([0., 0., 0.], dtype=float32)}

Errors

Operation errors

Enum (Error)

The robot has been configured to work with incompatible control settings

INVALID_CONFIGURATION_ERROR

Validation of the load model for impedance control to use servo motions has failed

VALIDATION_FOR_IMPEDANCE_ERROR

Asynchronous motion command execution failed

ASYNCHRONOUS_MOTION_ERROR

Synchronous motion command execution failed

SYNCHRONOUS_MOTION_ERROR

Joint subscript is out of range

INVALID_JOINT_ERROR

An operation or function receives an argument that has the right type but an inappropriate value

VALUE_ERROR

No error. This is not a guarantee that there are no errors

NO_ERROR

class libiiwa.Error(value)

Bases: Enum

An enumeration.

ASYNCHRONOUS_MOTION_ERROR = -14
INVALID_CONFIGURATION_ERROR = -16
INVALID_JOINT_ERROR = -12
NO_ERROR = -10
SYNCHRONOUS_MOTION_ERROR = -13
UNKNOW_ERROR = 0
VALIDATION_FOR_IMPEDANCE_ERROR = -15
VALUE_ERROR = -11

get_last_error

LibIiwa.get_last_error(clear_after_read: bool = True) Error

Get the last error message from the robot

If there is no error, Error.NO_ERROR enum will be returned

Parameters:

clear_after_read (bool, optional) – If True, the internal error flag will be reset after this call (default: True).

Returns:

The last error message from the robot

Return type:

Error

Example:

>>> # no errors
>>> iiwa.get_last_error()
<Error.NO_ERROR: -10>