Skip to content

get_hardware

Runs at once Any mode Open to every client

Return what the drives, the CAN bus and the control box report. One read of everything the hardware reports, for checking a build: each drive's identity, supply and faults, the CAN interface's error counters, and the E-stop, the buttons and the isolated inputs and outputs. It moves nothing.

Syntax

robot.get_hardware(can=True)

Arguments

Name Type Default Description
can bool True Also read the CAN interface's state and error counters, which takes the robot about 5 ms. False skips them, for polling.

Returns

dict

A dict: drives: one dict per joint, J1 first: name ("J1"), can_id, answered_scan (it answered the scan at start-up), answering (its data is fresh now), lost (its lost-connection error is latched), firmware, hardware, serial, batch, voltage_v (its supply, in volts), temperature_c (in degrees Celsius), fault (a fault is reported), flags (each fault flag: temperature, encoder, supply_voltage, driver, velocity, current, estop and watchdog), calibrated, driver_type, firmware_supported ("ok", "too_old", "too_new", "undeclared", or None before the drive reports) and supported_range. gripper: the same for a CAN gripper's drive, without batch, or None. scan_unexpected_ids: the CAN ids that answered the start-up scan although this robot does not use them. can_link: the CAN interface's interface, state, restart_ms and its counters restarts, bus_errors, arbitration_lost, error_warning, error_passive and bus_off; None with can=False or when the robot cannot read them. io: the control box: estop_pressed, per E-stop channel estop_raw (the level, 0 = pressed) and estop_channel_pressed, estop_channels_used, software_estop, buttons_pressed (B1 and B2), inputs and outputs (the three isolated pins' levels) and pcb_version. joint_num, has_gripper, tick (the control tick of the read) and time (in seconds since 1970, UTC).

Examples

hardware = robot.get_hardware(can=False)
[d["voltage_v"] for d in hardware["drives"]]
Usage restrictions never refused

This command runs at once; it is not queued. The robot accepts it in any mode and state, from every client.

It never answers with an error code.

In Python, the call raises:

  • RobotTimeout: The robot did not answer within 5 s.
  • RobotConnectionError: The client is not connected.

If the connection drops while the call waits for the robot's answer, it raises CommandRejected with the code CONNECTION_LOST (DISCONNECTED after disconnect()); while it waits for the robot's status, RobotConnectionError.

Like every immediate command, it also answers BAD_ARGS when a raw client sends a value the robot cannot read at all, and INTERNAL when it fails inside the robot.

Protocol

A client that does not use robotclient sends this over the TCP command protocol (port 29000) for the example above:

{"id": "c1", "cmd": "get_hardware", "args": [0]}

See also