Self Balancing Rocket Booster

I’m building a smaller version of the SpaceX reusable booster using a jet turbine instead of a rocket engine, and using a Husarion CORE2 as the controller. I am modifying GitHub - husarion/self-balancing-telepresence-robot: Embedded firmware and web user interface for self balancing telepresence robot . Instead of motors however, the balancing is achieved through thrust vectoring as shown in the first minute of this video. I only need the PID control for the angle, not the speed. The vector angle is achieved by a standard servo control. Before I start modifying the code, can you offer any tips? speedNow and targetSpeed in RobotController.h would likely both be 0, for example. Anything else? Project Updates - YouTube

Hello PureRockets,

In the example you mentioned, there are two PIDs, one for speed and second for balancing. The second PID, which is controlling the angle, is in RobotController.cpp in line 181. Initialization of this PID is in lines 34 - 38.

For two wheeled self balancing robot speed depends on angle. If you want only an angle, just skip first PID and set targetAngle with your desired value.


Sounds good! I will keep you posted. I don’t need the motors obviously either, I’ll just map the motor values to a PWM equivalent value. I have the absolute side force measurements that are created given a throttle setting and vectoring angle, not sure how I will translate those into the PID parameters. Likely trial and error for now! Per my setup, I have the rotation configured around the center of gravity and limited to a single X-Z plane, eventually there will be two servos for full 3D balancing! Then soon thereafter the first test flight (after I implement the parachute system using ) Thanks again, I’m loving my CORE2 and CORE2-ROS controllers, essentially saved this project.

I see the following code in main.cpp, how do I read this data? Do you have instructions for a serial monitor? Can I just use the Arduino IDE serial monitor on my PC?



Update - Solved via the Community pages - “You can do by VSC by clicking on the icon in the bottom left corner “open CORE2 serial console” or you can use any terminal and set the appropriate baud rate.” or "simply connecting CORE2 and RPi via USB cable followed by screen /tty/USB0 19200 "

So I’m close. On the CORE2-ROS device, I tried “screen /dev/ttyUSB0 115200” and other baud rates, but I keep getting scrolling ? marks. What would the correct baud rate be? When I connect to my Windows system with Visual Code, the CORE2 serial console works just fine. What baud rate is that window using?

Hello PureRockets,

The default baud rate is 460800.
You can use Visual Studio to connect with serial console also on Ubuntu, what is the reason that you want to use screen /dev/ttyUSB0 460800 instead?


Got it, thanks! I will give it a try. I’m using SSH to connect remotely to the CORE2-ROS for safety to monitor sys.log via screen. To keep the CPU and network usage as low as possible, I would not want to use a remote GUI with Visual Studio (although I do love your cloud-based UI). During the static tests of this rocket, if I was using the local console with a monitor/keyboard attached and I was positioned nearby and there was an explosion, I could be hurt. Does that answer your question? :slight_smile:

Yes, this answers all my doubts :wink:

/dev/ttyUSB0 460800 worked perfectly, thanks for the help! Follow up question, what is the difference between setRange and setIRange? Are they documented anywhere? I did find this but I was looking for functional descriptions, thx About Husarion's manuals | Husarion thx

pidIMU.setRange(-7.5, 7.5); //max speed to motors
pidIMU.setIRange(-4, 4);

Update: I believe I found what I needed here PID without a PhD - and hFramework/hPID.cpp at master · husarion/hFramework · GitHub