Model Predictive Control on ROSbot pro

Hi, I was wondering if anyone could share some code or tutorial on using model predictive control or PID control on the ROSbot pro. I want to do some low level path planning and control to code up algorithms we are learning in our graduate course here from scratch to understand how these algorithms work in practice.

Any code or github repo that you can point us to would be of great help.

Thank you.

Hi @jaskarangrover

Unfortunately, from our official side, we do not have any MPC related resources. I will try to give you a staring point for that, so you will have at least a stating point :slight_smile:

Kinematics calculations are done on the embedded side on STM processor. It’s an 32 bit ARM cortex M4 with FPU, so you can early implement stuff like PID and LQR. Loving linear programming on that processor is possible, but I personally think you would spend too much time focusing on implementing the solver rather than the problem itself.
If you want to make changes or simply understand the underlying dynamics of the system, here is source code for forward and inverse kinematics:

I would suggest sticking to the navigation stack approach of control, with control input being forward and angular velocities. Keep in mind though that both of those inputs are not perfectly linear and at some velocity in x direction angular z will saturate at 0 rad/s and your robot won’t turn.

As a starting point, you can take a look at TEB planner implementation. It is pseudo MPC local planner. It is available as an option in both move_base and nav2. TinkerBoard on the ROSbot 2.0 Pro is powerful enough to handle optimization tasks for short time horizons in semi real time fashion.

I guess unfortunately my knowledge ends here… I really hope I managed to help at least at some point…
I will leave the topic for the community to carry on :slight_smile:

As a final note, I encourage you to simply search for MPC done in ROS or basically on any differential drive robots. ROSbot should be compatible with most of those papers and software.

Best regards,
Krzysztof Wojciechowski.