Skip to content

save_drive_parameter_to_xml

Runs at once Any mode Takes control

Save one of the gains or limits the robot sends to its config file. For the values the robot sends every drive from its configuration at start: the gains (8 to 14) and the velocity, current and voltage limits (15 to 17). The value is written into that joint's entry in the robot's XML file, or the gripper's file, changing only that number: every comment stays. A copy of the file is kept in temp_data/xml_backups/ first, and the file is read again to check that only that value changed. The robot uses it from its next start; set_pid_gains() applies a joint's value now. It works in any mode.

Syntax

robot.save_drive_parameter_to_xml(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, 8 to 17.
value float required Its new value, in the drive's own units as in the file. The limits are written as whole numbers.

Returns

dict

A dict: file (the file's name), key (the configuration key, for example motor_KPV), value (as written) and backup (the copy's name).

Examples

robot.save_drive_parameter_to_xml(3, 9, 0.02)

Further details

Warning

A limit in the file is the most the robot ever asks of that joint. Raise one only within what the joint's motor and drive are made for.

Usage restrictions 3 codes

This command runs at once; it is not queued. The robot accepts it in any mode and state, 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:

  • [6101] Control held by another client — another client holds control; the message names it
  • [6003] Invalid arguments — no such drive, a parameter not sent from the file, or a value out of range
  • [6013] Internal error — the file could not be written, or reading it again found another change; the file is then put back as it was

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

  • CommandRejected: The robot refused it: another client holds control, no such drive, a parameter it does not send, a value below 0 (or 0 for the velocity and current limits), or the file could not be changed (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": "save_drive_parameter_to_xml", "args": [3, 9, 0.02]}

See also