Skip to content

write_drive_parameter

Runs at once Any mode Disabled Takes control

Write one of a drive's own settings into the drive. For the settings only the drive holds, which the robot never sends it: its motor model (R, L), its control loops' bandwidths and speed estimate, the commutation delay, the position input filter, the integral deadband, the Id setpoint, Rstint, the thermistor, the watchdog fallback, the heartbeat, the sound limit, and the anti-cogging, encoder-table and switching-zero switches (get_drive_parameters() lists their numbers). The value goes into the drive's working memory and is read back at once; it is lost at the drive's next power-off unless save_drive_config() stores it. Only with the arm disabled. The gains and limits the robot sends are set with set_pid_gains() and save_drive_parameter_to_xml() instead.

Syntax

robot.write_drive_parameter(drive, number, value)

Arguments

Name Type Default Description
drive int required 1 to the number of joints for a joint, one more for a CAN gripper.
number int required The parameter's number.
value float required Its new value, a whole number in the drive's own units.

Returns

Nothing.

Examples

robot.write_drive_parameter(6, 49, 2000)

Further details

Warning

A wrong motor model or loop bandwidth can make that joint buzz or unable to hold when it is next enabled: try a change on one joint, and keep the old value at hand.

Usage restrictions 5 codes

This command runs at once; it is not queued. The robot accepts it only when it is disabled, from the client that holds control or when no client does.

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

  • [6010] Command not allowed now — the message names the mode or state it needs
  • [6101] Control held by another client — another client holds control; the message names it
  • [6003] Invalid arguments — no such drive, a parameter not written here, or not a whole number
  • [6025] RTI not running or not answering — rTI did not answer within 1 s: it is not running or not responding. The command may still have taken effect
  • [6026] Refused by RTI — rTI refused it: the arm is enabled. The message says why

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

  • CommandRejected: The robot refused it: the arm is enabled, another client holds control, no such drive, a parameter not written here, or not a whole number. Or RTI refused it or did not answer within 1 s (Errors:).
  • 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": "write_drive_parameter", "args": [6, 49, 2000]}

See also