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: Containspose,joint_angles,joint_control_angles,joint_velocities,joint_control_velocities,joint_control_acceleration,joint_torques, andjoint_temperatures
State data model
| Field | Description |
|---|---|
pose | TCP pose (Pose) |
joint_angles | Actual angles of the 7 joints (list[AngleState]) |
joint_control_angles | Control angles of the 7 joints (list[AngleState]) |
joint_velocities | Actual velocities of the 7 joints (list[VelocityState]) |
joint_control_velocities | Control velocities of the 7 joints (list[VelocityState]) |
joint_control_acceleration | Control accelerations of the 7 joints (list[AccelerationState]) |
joint_torques | Actual torques of the 7 joints (list[TorqueState]) |
joint_temperatures | Temperatures 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
| Model | Value field | Timestamp 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
| Method | Return value | Unit |
|---|---|---|
get_angles() | Actual angles of 7 joints | rad |
get_control_angles() | Control angles of 7 joints | rad |
get_velocities() | Actual velocities of 7 joints | rad/s |
get_control_velocities() | Control velocities of 7 joints | rad/s |
get_control_acceleration() | Control accelerations of 7 joints | rad/s² |
get_torques() | Actual torques of 7 joints | Nm |
get_temperatures() | Temperatures of 7 joints | °C |
get_pose() | TCP pose | m, rad |
Sensor Data
A7 uses polling to collect sensor data. get_*() returns the value from the latest polling cycle.
| Data type | Unit | Default polling interval | Maximum delay |
|---|---|---|---|
| Angle | rad | 10 ms | ≈ 10 ms |
| Velocity | rad/s | 10 ms | ≈ 10 ms |
| Torque | Nm | 50 ms | ≈ 50 ms |
| Temperature | °C | 1000 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()