Skip to content

get_drive_parameters

Runs at once Any mode Open to every client

Return the drive parameters that the last read found. Each value is what the drive answered when it was read with read_drive_parameters(); nothing is read now. A parameter not read yet has the value None. It moves nothing.

Syntax

robot.get_drive_parameters(drive=None)

Arguments

Name Type Default Description
drive int | None None One drive: 1 to the number of joints for a joint, one more for a CAN gripper. None returns every drive.

Returns

dict

A dict: read: the read's state ("idle", "reading" or "done"), done and total (requests), and drive (the one being read now, or None). drives: per drive ("J1" ... and "gripper"): read_utc (when its read finished, an ISO 8601 UTC time, or None) and parameters, a list of dicts: number, name, value (a number, or None) and state ("read", "not read", "unknown" to its firmware, "no answer" or "asked").

Examples

j1 = robot.get_drive_parameters(1)["drives"]["J1"]
[p["value"] for p in j1["parameters"] if p["number"] == 16]
Usage restrictions 1 code

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

It answers with one of these codes when it does not carry the command out:

  • [6003] Invalid arguments — drive is not one of this robot's drives

In Python, a code above raises CommandRejected; its number is the code. The call raises:

  • CommandRejected: The robot refused it: no such drive.
  • 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_drive_parameters", "args": [1]}

See also