[P] Self-Balancing Robot using ROS (Python or C++)

My capstone project is to make a self-balancing robot. I’ve accomplished this in that I have a robot that can balance on the spot with a simple PID controller that takes just takes into account the tilt angle. But I am wanting to now add in Bluetooth control via a PS3 controller to control the linear velocity as well as the head angle, this introduces 2 more DOFs. I already have done the necessary calculations and work to confirm an appropriate LQR controller for my system.

I am using a Raspberry Pi 4 with a Cytron 10A 5-30V Dual Channel DC Motor Driver.

I’m taking into account 5 things: Tilt angle, Tilt Angular Velocity, Head Angle, Head Angular Velocity, and Linear Velocity. I have the appropriate A and B matrices and the output matrix would be the right and left motor PWM values.

I have 2 DC motors with Encoders on them as well as a BNO055 IMU:

The IMU can measure the Tile Angle, Head Angle and Linear Velocity

The Encoders can measure the Linear Velocity and Head Angle

I have simulated the controller in Matlab & Simulink and have the appropriate Q, R and K matrices to control the system. but I am having trouble figuring out how to actually hard code this in either Python or C++ as the code will be vastly different from our simple PID code.

I also was told that it would be a much easier to execute the LQR with BT control with ROS as I could separate the needed things in nodes and have them subscribe and publish to each other. But I literally cannot find anything online that matches what I need with this LQR controller. Could anyone give some insight on how I can approach this project?

Later on in the year, i’d like to implement a vision system as well as SLAM to make the robot able to autonomously navigate through a maze as well as detect certain objects.

submitted by /u/Rezzurrections
[link] [comments]