I am using the
rosserial_arduino packages to control my two-wheeled robot. Currently I'm trying to tune each wheel's PID velocity controller but have been having some trouble. Here is how the nodes are currently organized.
In the above, the
diff_drive_controller node has been omitted for the sake of tuning; the setpoints are instead being published from two custom-written nodes.
rosserial_arduino) runs on an Arduino Nano 33 BLE, subscribes to the
control_effort topics and writes their values to the robot motors, and publishes the
vel topics to the PID controllers as plant state. All other nodes run on my laptop (Ubuntu 16.04, x86,
When I follow the traditional tuning method of increasing P until wild oscillation and then increasing D for dampening, what happens is that increasing D actually worsens the oscillations.
Here are some plots to show this. A rosbag in which I try to tune the left PID can also be found here; you can see the topics
/left_wheel/pid_node/parameter_updates for the gains and
/left_wheel/vel for the plant state.
I've tried the following changes but haven't had much success:
- Making sure that each PID controller receives the setpoint and plant state at the same time
- Decreasing control loop frequency from 100 to 50 Hz
Here are the settings for my PID controllers (ignore
Kd since those are adjusted anyways):
<node name="pid_node" pkg="pid" type="controller" ns="left_wheel" output="screen"> <param name="Kp" value="5.0"/> <param name="Ki" value="0.0"/> <param name="Kd" value="0.1"/> <param name="upper_limit" value="255"/> <param name="lower_limit" value="-255"/> <param name="windup_limit" value="10"/> <!-- topic_from_controller = control_effort --> <!-- setpoint_topic = setpoint --> <param name="topic_from_plant" value="vel"/> </node> <!-- same settings for right pid controller -->
Any ideas on what could be wrong and how to fix my problem? I have verified that setpoint and plant state message values are accurate.
Post score: 0