Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Tuning gains for high-precision motion

Adjusting your settings to get the most precision out of your robot

Gains tuning

Anvil's robots use the MIT-mode control law to implement joint-space impedance control. The default parameters ensure safe and compliant robot motion, but by adjusting these based on your task and preferences, you can significantly change the behavior of the robot to suit your needs.

Stiffness

The kp term determines the "stiffness" of the robot. Increasing it means the robot tracks and holds its commanded position more exactly, making it easier to perform tasks that require high precision. Decreasing it makes the robot movement more compliant, making it safer and gentler when responding to external forces.

Damping

The kd term determines the "damping" of the robot, which roughly determines how much the robot decelerates as it approaches its commanded position. Increasing it generally reduces the speed the arm moves with. Importantly, increasing it can eliminate oscillations that can occur when using high kp.

How to tune them

Every robot config inside ~/anvil-loader/config has stiffness and damping exposed per-arm as teleop_kp (example) and teleop_kd (example) respectively. The ordering of the array corresponds to the ordering of the joints (first value is J1, second value is J2, etc.) which are settable per-arm. Edit these values in the config, and then restart the stack for these changes to take effect.

The most common use case of gains tuning is to increase precision. An easy way to start is to increase the kp values on all joints by 25%, then 50%, then so on, trying out each new set of values to determine what feels best. As you increase these, you should increase kd roughly in proportion, to prevent oscillations. You can go so far as doubling (or even sometimes tripling in extreme cases) these values to get the precision you need.

You might notice the last values in the teleop_kp and teleop_kd arrays are extremely small, these are for the gripper and this is by design. To adjust gripper behavior, see Advanced Tuning instead of changing these values.

Last updated