PID Calibration

Hi folks,

I’m new to this forum, but have a pretty neat custom setup with my magni, including an RPLidar on board.

The RPLidar is working quite well, but the magni is having a real tough time keeping a straight line, and a lot of odd noise is coming from the motors when it comes to a complete stop.

I believe the issue is the PID controller. Are there any instructions on calibrating the PID controller? Can anyone post there sample PID values from rqt_reconfigure?

Thanks in advance.

1 Like

Hey yeah, it’s definitely the motor PID parameters that’s causing that. Can you check the /diagnostics topic for the params and the firmware version?

After you have those @mjstn2011 should be able to give you some notes on fixing it.

Hi @MoffKalast,

Thank you for the quick response. Here is a cut of the motor info from the /diagnostics topic:

seq: 51545
secs: 1605885717
nsecs: 901518325
frame_id: ‘’

level: 0
name: "motor_node: Firmware"
message: "Firmware version is OK"
hardware_id: "Motor Controller"
    key: "Firmware Version"
    value: "35"
  • level: 1
    name: “motor_node: Limits”
    message: " left integral,; right integral,"
    hardware_id: “Motor Controller”
    values: []
  • level: 0
    name: “motor_node: Battery”
    message: “Battery OK”
    hardware_id: “Motor Controller”

    key: "Battery Voltage"
    value: "29.4872"

level: 2
name: “motor_node: MotorPower”
message: “Motor power on”
hardware_id: “Motor Controller”
key: “Motor Power”
value: “True”

level: 0
name: "motor_node: FirmwareOptions"
message: "High resolution encoders, Standard wheels"
hardware_id: "Motor Controller"
    key: "Firmware Options"
    value: "1"
  • level: 0
    name: “motor_node: FirmwareDate”
    message: “Firmware daycode format is YYYYMMDD”
    hardware_id: “Motor Controller”

    key: "Firmware Date"
    value: "20190815"

Hello, Mark here.

We are way behind on getting a true production release to update v35, sorry about that.
A great many firmware bug fixes as well as better PID parameters have been coming along since v35. These changes require both updated firmware as well as updated host code to take advantage of new firmware abilities. We are actively trying to get out a new image and once this is out we will be then ready to put out firmware so the two work together.

As far as PID parameters Vid mentioned how we show the PID parameters in the /diagnostics topic of ROS but that is only true on rather recent hostside software (on raspberry Pi linux).

The PID parameters can be seen and directly edited for new values in base.yaml file.
Edit base.yaml: sudo vi /opt/ros/kinetic/share/magni_bringup/param/base.yaml

Try the values I show below which are less aggressive and lower the amount of ‘chatter’ which is what we call what you are discussing. Edit the above file, change to these.
pid_proportional: 5100
pid_integral: 2
pid_derivative: -111
Dont change other things. Save the file and reboot and the new parameter will be active.

If you want to live ‘closer to the edge’ you can request beta firmware from me and try that out as well. Look at this page for how to do firmware updates.

If it will not let you get the v38 beta from the web (don’t recall if that is setup for request yet) I can send it to you and you would use the --file option. let me know.
There were other v38 beta dates so verify your firmware comes up in /diagnostics with the 0909 version (sept 2020).

Hi Mark,

Thank you for your response. Is there any chance the PID parameters are being over written on magni-base start somewhere other than the base.yaml file? When I check the values in rqt_reconfigure, they never match watch is in the base.yaml.

For refrence, here were the PID values, the first time I opened rqt_reconfigure:
PID_P: 5000
PID_I: 7
PID_C: 1000
PID_W: 100
MAX_PWM: 100

Can you confirm the values other than the Proportional, Integral and Derivative are correct?

Would be happy to try out the beta version 38 as well.


If you have current ubiquity_motor repository then you will see the actual parameters in use in topic /diagnostics. I don’t fully understand rqt_reconfigure completely but what I was surprised to find is it does not seem to automagically start with the default Ubiquity Motor pid parameters and instead has it’s own defaults. If you have the most recent ubiquity_motor you would not need rqt_reconfigure to know the pid parameters as I show them now in /diagnostics topic. Normally our images do not have ubiquity_motor in the catkin_ws/src folder. You would have to be in ~/catkin_ws/src then use the clone like this: git clone After that go to ~/catkin_ws and use ‘catkin_make’ Next reboot you would have parameters show up in /diagnostics topic.