build details

# Calibration - Kinematics

Modified 2022-11-14 by Andrea Censi

A Duckiebot set up according to Unit E-1 - Setup

Kinematics are calibrated.

The kinematics node does not have an automatic calibration procedure like the sensors have. Instead, you should open up a graph of the demanded velocity vs. the actual velocity, and tweak the parameters until you get good performance.

Step 1: Follow the steps in Unit C-10 - Operation - Make it Move to open a virtual joystick.

Step 2: Open GUI tools:

``````$dts start_gui_tools duckiebot name --base_image duckietown/dt-core:daffy `````` Step 3: Within GUI tools, run the command `rqt_plot &amp;`, and add the following topics: • `/duckiebot_name/car_cmd_switch_node/cmd/v`: Shows the demanded velocity of the Duckiebot • `/duckiebot name/encoder_node/encoder_velocity/vel_encoder`: Shows the current velocity measured by the wheel encoder. • `/duckiebot name/wheels_driver_node/wheels_cmd_dbv2/vel_wheel`: The duty cycle sent to the DC motor. This is constrained to the range `[-1, +1]`. Step 4: Drive the Duckiebot around using the joystick, and observe the graph. If the `vel_wheel` is consistently at or near 1, then you should turn down the joystick speed gain: ``````$ rosparam set /dbv2optimus/joy_mapper_node/speed_gain 0.3
``````

If the wheel velocity is saturated at 1, then it will be impossible to tune the speed controller.

Step 5: Reset all of the necessary parameters, by running these commands within GUI tools:

``````$rosparam set /duckiebot name/kinematics_node/k_P 0$ rosparam set /duckiebot name/kinematics_node/k_I 0
``````

Step 6: Adjust the parameter `kinematics_node/k_wheel` until the encoder velocity roughly matches the set speed. In Figure 6.1, there are three separate sections. From left to right:

• Duckiebot is driving too fast: `k_wheel` is too low.
• Duckiebot is driving too slow: `k_wheel` is too high.
• Duckiebot is driving at the correct speed: `k_wheel` is correct.

Step 7: Adjust the parameter `kinematics_node/k_P` to be as high as possible, without introducing oscillations. Figure 6.2 shows two separate sections, from left to right:

• Speed is oscillating: `k_P` is too high
• Speed is not oscillation: `k_P` is correct

Step 7: Adjust the parameter `kinematics_node/k_I` to be as high as possible, without introducing oscillations. Figure 6.3 shows two separate sections, from left to right:

• Speed is oscillating: `k_I` is too high
• Speed is not oscillating: `k_I` is correct

Step 8: Save the calibration by running:

``````\$ rosservice call /duckiebot name/kinematics_node/save_calibration
``````

## Validation

Modified 2020-03-04 by Timothy Scott

To validate this tuning, keep the same graph open. Drive the duckiebot around in the city, and pay attention to the measured speed when going around turns. The duckiebot tends to slow down slightly around turns, and so the kinematics node should compensate by slightly increasing the output to the motors.

## Demo

Modified 2022-11-14 by Andrea Censi

By default, all demos on DBV2 use this speed control. See Part G - Duckiebot V2 Demos