Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

State Reading

Full State Snapshot

Read the complete arm state in one call, including TCP pose plus angle, velocity, acceleration, torque, and temperature for all joints.

from realhand import A7

with A7(side="left", interface_name="can0") as arm:
    arm.enable()
    state = arm.get_state()
    print(state.pose)
    print(f"Actual angle of the first joint: {state.joint_angles[0].angle:.4f} rad")

Return value

  • State: Contains pose, joint_angles, joint_control_angles, joint_velocities, joint_control_velocities, joint_control_acceleration, joint_torques, and joint_temperatures

State data model

FieldDescription
poseTCP pose (Pose)
joint_anglesActual angles of the 7 joints (list[AngleState])
joint_control_anglesControl angles of the 7 joints (list[AngleState])
joint_velocitiesActual velocities of the 7 joints (list[VelocityState])
joint_control_velocitiesControl velocities of the 7 joints (list[VelocityState])
joint_control_accelerationControl accelerations of the 7 joints (list[AccelerationState])
joint_torquesActual torques of the 7 joints (list[TorqueState])
joint_temperaturesTemperatures of the 7 joints (list[TemperatureState])

Each sub-state model includes a value field and a timestamp (Unix time in seconds).

Sub-state model fields

ModelValue fieldTimestamp field
AngleState.angle.timestamp
VelocityState.velocity.timestamp
AccelerationState.acceleration.timestamp
TorqueState.torque.timestamp
TemperatureState.temperature.timestamp

Read Individual State Items

Besides get_state(), the following methods return a single kind of state. All of them return lists for 7 joints, except get_pose().

from realhand import A7

with A7(side="left", interface_name="can0") as arm:
    arm.enable()
    angles = arm.get_angles()
    velocities = arm.get_velocities()
    temps = arm.get_temperatures()
    pose = arm.get_pose()
    print(f"Actual angle of the second joint: {angles[1]:.4f} rad")
    print(f"Actual velocity of the third joint: {velocities[2]:.4f} rad/s")
    print(f"Actual temperature of the fourth joint: {temps[3]:.1f} °C")
    print(f"TCP: ({pose.x:.3f}m, {pose.y:.3f}m, {pose.z:.3f}m)")

Return values

MethodReturn valueUnit
get_angles()Actual angles of 7 jointsrad
get_control_angles()Control angles of 7 jointsrad
get_velocities()Actual velocities of 7 jointsrad/s
get_control_velocities()Control velocities of 7 jointsrad/s
get_control_acceleration()Control accelerations of 7 jointsrad/s²
get_torques()Actual torques of 7 jointsNm
get_temperatures()Temperatures of 7 joints°C
get_pose()TCP posem, rad

Sensor Data

A7 uses polling to collect sensor data. get_*() returns the value from the latest polling cycle.

Data typeUnitDefault polling intervalMaximum delay
Anglerad10 ms≈ 10 ms
Velocityrad/s10 ms≈ 10 ms
TorqueNm50 ms≈ 50 ms
Temperature°C1000 ms≈ 1000 ms

If you need lower latency, use start_polling() to configure different intervals for different sensor types:

from realhand import A7
from realhand.arm.a7 import SensorType

with A7(side="left", interface_name="can0") as arm:
    arm.start_polling(
        {
            SensorType.POSITION: 0.005,  # 5 ms = 200 Hz
            SensorType.VELOCITY: 0.005,
            SensorType.TORQUE: 0.1,
            SensorType.TEMPERATURE: 2.0,
        }
    )
    arm.enable()
    arm.home()