Skip to content

set_recipe

Runs at once Any mode Takes control

Choose the telemetry recipe that the robot's data streams carry. A recipe is a file in the robot's data_recipe/ folder that names the values sent every control tick, both in the telemetry the robot broadcasts on UDP port 30003 and in the state packets of a real-time stream. The robot switches on its next tick. The status field recipe names the recipe in use, and recipes lists the recipe files on the robot.

Syntax

robot.set_recipe(name)

Arguments

Name Type Default Description
name str required The recipe. The robot ships "standard" (joint positions and speeds, the drives' errors, the tool centre point's pose, the tick, the mode, the loop period and the real-time link), "minimal" (joint positions and the tick), "commanded" (measured, commanded and target positions), "diagnostics" (the real-time link's quality, the loop's timing, errors and external torques), "full", and "tracking", "can_gaps", "external_test", "friction_id", "haptic_wall" and "monitor_baseline" for the robot's own tests. A recipe file added while the robot software runs needs reload_recipes() first.

Default values

"standard", set each time the real-time loop starts. The robot's other processes keep the recipe in use when they restart.

Returns

Nothing.

Examples

robot.set_recipe("diagnostics")

Further details

Note

The real-time loop checks the name again, in lower case, against the recipes it has loaded. A file added but not reloaded, or a recipe whose name inside the file has capitals or differs from its file name, is refused there, in its log only; the call still returns normally. Check the status field recipe.

Usage restrictions 4 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 recipe file of that name is on the robot
  • [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 does not know the recipe. The message says why

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

  • CommandRejected: The robot refused it: no recipe file has that name, or another client holds control. 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": "set_recipe", "args": ["diagnostics"]}

See also