Controller Configurations
Controller configurations: how a policy drives the robot, in one YAML file.
A file names the controller mode, its gains, the policy rate and the tool it is for:
mode: osc tool: test panda hand # Desk end-effector profile, or none (optional) ee_kp: [100, 100, 100, 30, 30, 30] # x, y, z, then rotation [1/s^2], or one value for all ee_kd: 20 # [1/s]; the OSC multiplies both by the task-space
# inertia, so ee_kp = w^2, ee_kd = 2 zeta w
null_kp: 9 # null space [Nm/rad], one value or one per joint (default 1) null_kd: 6 # [Nm s/rad] (default 1) null_target: home # 7 joint positions [rad], home, or current (the default): the
# joint positions when activated, as switch(“osc”) keeps
- tcp: [0, 0, 0.1034] # TCP in the flange frame: a translation [m] or a 4x4 pose
# (default: the flange)
frequency: 50 # policy rate [Hz], the rate of controller.set()
or
mode: impedance tool: none kp: [64, 64, 64, 64, 32, 32, 32] # [Nm/rad], one value or one per joint kd: [16, 16, 16, 16, 8, 8, 8] # [Nm s/rad] frequency: 50
controller.activate(“osc.yaml”) applies it, and refuses if the tool is not the end effector active in Desk (none is Desk’s “No End Effector”; leave tool out to skip the check), or if the arm is not at the null_target of an OSC configuration that sets one (await controller.move(config[“null_target”]) first). The system identification examples collect with it (–activate) and add what they fit to its sim section, one entry per physics step: the gains and joint parameters with which a simulation that runs the controller every physics step on fr3.xml’s motors, with the payload the fit assumed, responds as the robot did. The collectors also list the recordings they made on the robot, newest last, which is what the fitters fit by default.
recordings: - {path: ../examples/sysid_data/osc_sysid_<date>.npz, date: …, tool: …}
sim: - physics_dt: 0.005
ee_kp: […] … armature: […] damping: […] frictionloss: […] payload: {mass: …, com: […], inertia: […]}
- aiofranka.config.load_config(source)[source]
Read and check a controller configuration.
- Parameters:
- Returns:
mode, frequency [Hz], recordings and sim (the lists the sysid examples write), plus kp and kd (7,) for impedance, or ee_kp and ee_kd (6,), null_kp and null_kd (7,), null_target (7,) or None for the joint positions at activation, and tcp (4, 4) for osc, and tool and name if given
- Return type:
- Raises:
ValueError – If the file is not valid YAML, or the configuration is incomplete, has unknown keys or wrong values
- aiofranka.config.tcp_transform(value)[source]
A TCP pose in the flange frame, from a translation (3,), 16 values row by row, or a 4x4 pose.
- Raises:
ValueError – If it is none of these, or its rotation is not a rotation
- aiofranka.config.to_yaml(config)[source]
The configuration as plain values, as written in a file (without recordings and sim).
- aiofranka.config.same_controller(a, b)[source]
Whether two configurations drive the robot the same way, with the same tool (sim and name aside).
- aiofranka.config.sim_entry(config, physics_dt)[source]
The fitted simulation parameters for a physics step, as arrays.
- aiofranka.config.save_sim(path, entry, controller=None)[source]
Add a fitted entry to the sim section of a configuration file, replacing one with the same physics_dt.
The rest of the file stays as written, comments included; the recordings and sim sections move to its end. The new file is checked before it replaces the old one, so a failure leaves the file as it was.
- Parameters:
- Raises:
ValueError – If the file is not a valid configuration, or no longer describes controller
RuntimeError – If the sim section could not be rewritten without changing the rest
- aiofranka.config.add_recording(path, recording, controller=None)[source]
Add a recording collected with a configuration to its recordings section, newest last.
- Parameters:
path (str | Path) – Configuration file
recording (dict) – path of the recording (kept relative to the file’s folder when it is under the same root) and what else to note, e.g. date and tool
controller (str | Path | dict | None) – If given, the configuration the recording was collected with; the file must still describe the same controller
- Raises:
ValueError, RuntimeError – As save_sim()