Skip to content

set_ik_solver

Runs at once Any mode Takes control

Set the default IK solver, which turns poses into joint angles. Every queued move that does not pass its own ik_solver uses this solver to work out the joint angles for its poses: move_pose(), the straight lines, arcs, circles and splines, and their relative forms. Joint moves do not use it, and neither does is_reachable().

  • "pinocchio" (also "pin"): damped least squares. Deterministic and fast.
  • "roboticstoolbox" (also "robotics_toolbox", "rtb"): a Levenberg-Marquardt solve, with damped least squares as its fallback.

Case and spaces around the name do not matter. The setting is the robot's: it applies to the moves every client sends after it, and moves already sent keep their solver. It lasts until it is changed or the robot software restarts. The status shows it as default_ik_solver.

Syntax

robot.set_ik_solver(solver)

Arguments

Name Type Default Description
solver str required The solver's name, one of those above.

Default values

"pinocchio", set each time the robot software starts.

Returns

Any

{"ik_solver": name}: the solver now in force, by its main name, for example "roboticstoolbox" for "rtb".

Examples

robot.set_ik_solver("rtb")
x, y, z, rx, ry, rz = robot.get_pose()
robot.move_linear(x, y, z - 0.02, rx, ry, rz)
robot.wait_idle()
robot.set_ik_solver("pinocchio")
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 solver was given (only a raw client can send that)
  • [6006] Unknown IK solver — solver is not one of the names above

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

  • CommandRejected: The robot refused it: the name is not a known solver, or another client holds control.
  • 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, with the tool at the standard start pose (get_pose() returning [0.0, 0.2617, 0.2329, -2.0944, 0.0, -1.5708]):

{"id": "c1", "cmd": "set_ik_solver", "args": ["rtb"]}

See also