yahboom
HomeLearn
Solution
Blog
Online Store
About Us
EN/中文
MicroROS Self-balancing Robot Car📖
01.Introduction
  • 0.Unboxing and Reviewing
  • 1. Must read before use - learning route
  • 2. Introduction to LiDAR
  • 3. Balance car interface description
  • 4. Analysis of common problems
  • 5. Robot charging and battery precautions
02.Assembly tutorial
  • Robot assembly steps
03.Preparation
  • 0.Quick Start (Must Read)
  • 1.Write firmware
  • 2.How to install and use VM
  • 3.ESP32 communication board configuration parameters
  • 4.Connect to microROS agent
04.ROS-WiFi module configuration
  • 0.Serial port configuration WiFi instructions
  • 1.Use ROS-WiFi cam module(must read)
  • 2.Connect to ROS-WiFi cam module agent
  • 3.Camera image correction (optional)
05.Quick start control
  • 1.Keyboard remote control
  • 2.Handle remote control
06.ROS+OpenCV course
  • 1.OpenCV Getting started
  • 2.Geometric transformation
  • 3.Image processing and drawing text line segments
  • 4.Image beautification
07.Mediapipe course
  • 1. Hand detection
  • 2. Posture detection
  • 3. Overall inspection
  • 4. Face detection
  • 5. Face recognition
  • 6. Facial effects
  • 7. 3D object recognition
  • 8. Brush
  • 9. Finger control
  • 10. Gesture recognition
08.Robot basic course
  • 1.Robot information release
  • 2.Robot keyboard control
  • 3.Robot handle control
  • 4.Robot state estimation
  • 5.Line speed calibration
  • 6.Angular velocity calibration
  • 7.Robot URDF model
09.Lidar course
  • 1.Lidar avoid
  • 2.Lidar following
  • 3.Lidar guard
  • 5.Gmapping mapping
  • 6.Cartographer mapping
  • 7.Navigation2 navigation avoid
  • 8.Navigation2 fast relocation navigation
  • 9.ROS Robot APP mapping
  • 10.ROS Robot APP navigation
10.Robot visual interaction
  • 1.Color tracking
  • 2.Object recognition and tracking
  • 3.Face recognition tracking
  • 4.Autonomous driving line patrol
  • 5.QR code motion control
  • 6.Gesture control car movement
  • 7.Palm control car movement
  • 8.Gesture control car action group
  • 9.Palm recognition and tracking
  • 10.Human body posture recognition and tracking
11.Multi-machine course
  • 1.Multi-machine handle control
  • 2.Multi-machine keyboard control
  • 3.Multi-machine navigation
  • 4.Multi-machine rapid relocation navigation
12.STM32 balancing case
01.Environment construction and development
  • 13.Window Watchdog (WWDG)
  • 01.MDK-ARM installation
  • 02.STM32CubeIDE installation
  • 03.Common driver installation
  • 04.Download the program
  • 05.MDK-ARM project usage
  • 06.Program simulation
02.STM32 getting started course
  • 01.Project creation
  • 02.LED Control(GPIO)
  • 03.Buzzer control(GPIO)
  • 04.Button control(EXTI)
  • 05.Serial communication(USART)
  • 06.Voltage detection(ADC)
  • 07.Basic timer(TIM)
  • 08.Universal timer(TIM)
  • 09.Advanced Timer(TIM)
  • 10.I2C Communication(I2C)-OLED
  • 11.SPI communication(SPI)-2.4G handle
  • 12.Independent Watchdog (IWDG)
  • 14.DMA-USART
  • 15.DMA-I2C
03.STM32 expansion course
  • 01.Battery voltage detection (ADC)
  • 02.Ultrasonic module-measuring distance (TIM)
  • 03.Motor drive+encoder (TIM)
  • 04.OLED Data-Display(I2C)
  • 05.MPU6050-Data Read (I2C)
04.Robot car PID control course
  • 01.PID basic concept
  • 02.PID example analysis
  • 03.P, PI, PD controller theory
  • 04.Position PID
  • 05.Incremental PID
  • 06.Cascade PID
  • 07.Balance principle of car
  • 08.Car upright control (PD)
  • 09.Car speed ​​control (PI)
  • 10.Car steering control (PD)
  • 11.Got angle and angular velocity (DMP algorithm)
  • 12.Got angle and angular velocity (Kalman filter algorithm)
  • 13.Got angle and angular velocity(Complementary filter algorithm)
05.Robot car basic course
  • 01.Car parameter adjustment
  • 02.Ultrasonic obstacle avoidance
  • 03.Ultrasonic follow
  • 04.Bluetooth remote control
  • 05.Load balance
  • 06.Radar obstacle avoidance
  • 07.Radar guard
  • 08.Radar follow
  • 09.Radar patrol
  • 10.Radar wall following go in a straight line
  • 11.Radar tracking wall multiple walls
06.Robot car LQR control
  • Balance car LQR high-level control
07.Circuit design
  • 01.Overall circuit design
  • 02.STM32 minimum system
  • 03.Serial port circuit design
  • 04.Power circuit design
  • 05.MPU6050 Circuit Design
  • 06.Motor drive circuit design
08.Mathematical model
  • Balance car mathematical model
13.Linux basic course
  • 1.Introduction to Linux system
  • 2.Ubuntu file system
  • 3.Ubuntu common commands
  • 4.Ubuntu common editors
  • 5.Ubuntu software operation commands
  • 6.Virtual machine installation
  • 7.SSH remote control
  • 8.VNC remote control
  • 9.Transfer files remotely
  • 10.Driver library and communication
  • 11.Static IP and hotspot mode
  • 12.Bind device ID
  • 13.Capacity expansion and resource allocation
  • 14.Update system software sources
  • 15.Set root user password
  • 16.sudo free password
  • 17.Connect to WiFi network
  • 18.View system version
  • 19.Customized service management
  • 20.Back up system image
14.Docker course
  • 1. Overview and installation
  • 2. Common commands
  • 3. Docker images deeply understand and publish images
  • 4. Docker hardware interaction and data processing
  • 5. Enter the bot's docker container
15.ROS2 basic course
  • 1.Introduction to ROS2
  • 2.ROS2 install Humble
  • 3.ROS2 development environment
  • 4.ROS2 workspace
  • 5.ROS2 function package
  • 6.ROS2 node
  • 7.ROS2 topic communication
  • 8.ROS2 service communication
  • 9.ROS2 action communication
  • 10.ROS2 custom interface message
  • 11.ROS2 parameter service case
  • 12.ROS2 meta-function package
  • 13.ROS2 distributed communication
  • 14.ROS2 DDS
  • 15.ROS2 time related API
  • 16.ROS2 common command tools
  • 17.ROS2 rviz2 use
  • 18.ROS2 rqt toolbox
  • 19.ROS2 Launch startup file configuration
  • 20.ROS2 recording and playback tool
  • 21.ROS2 URDF model
  • 22.ROS2 Gazebo simulation platform
  • 23.ROS2 TF2 coordinate transformation
Download
  • RemoteCtrl_APP(Android)
  • Mapping_APP(iOS_Android)
  • Code
  • Hardware Information
  • software tools
  • 3D model file
  • Instruction manual
  • VM image file
  • ROS2_Basic_VM
Download ZIP

Welcome to MicroROS Self-balancing Robot Car repository

Balance car mathematical model

Balance car mathematical model

Balance car mathematical modelClassic inverted pendulum mathematical modelBalance car mathematical modelWheel modelCar body modelForward motionSteering movement

 

Classic inverted pendulum mathematical model

The inverted pendulum system usually consists of a rotatable rod and a mass block, the mass block is located at one end of the rod, and the entire system is controlled by a motor or other driver.

xxxxxxxxxx
The goal of controlling the inverted pendulum system is to keep the mass block in a vertical position and be robust to external interference

Figure (a) is a simplified model diagram of the inverted pendulum system, and Figure (b) is a force analysis diagram of the inverted pendulum system

image-20240921145253686

Instructions

image-20240921145404245

Based on Newton's mechanics and theorem of motion, the process of deriving the dynamic equation of the linear inverted pendulum system is as follows: Analyze the force balance of the car in the horizontal direction

image-20240921145531686

Analyze the force balance of the pendulum in the horizontal direction, and we can get:

image-20240921145514168

(1) and (2) In the equations, N is the interaction force between the slider and the pendulum in the horizontal direction. Combining the two equations (1) and (2) eliminates N, we get the first nonlinear dynamics model equation of the first-order linear inverted pendulum:

image-20240921145611963

Analyzing the force balance of the pendulum in the vertical direction, we get:

image-20240921145635811

Analyzing the moment balance of the pendulum around its center of mass, we get:

image-20240921145656266

In equations (2), (4), and (5), N and P are the interaction forces between the slider and the pendulum in the horizontal and vertical directions. Combining equations (2), (4), and (5) eliminates P, N, we get the second nonlinear dynamic model equation of the first-order linear inverted pendulum:

image-20240921145751308

The inverted pendulum is stable when -0.3rad < Φ <0.3rad, and the swing angle Φ is very small, so:

image-20240921145818901

Therefore, the nonlinear dynamic equation (3) of the inverted pendulum system can be Linearize with (6) to obtain the linearized dynamic equation of the first-order linear inverted pendulum system:

image-20240921145850123

Remember the state vector:

image-20240921145927483

With u=F, according to equation group (7) The state space equation of the first-order linear inverted pendulum system is as follows:

image-20240921150027126

image-20240921150045738

Balance car mathematical model

The balance car is a small car that achieves self-balancing through two wheels. Its structure mainly consists of a car body and two wheels. The mathematical model can be regarded as a moving inverted pendulum.

xxxxxxxxxx
The MPU6050 detects its posture information, and after processing by the processor, it will control the robot's motor so that the robot can reach a stable state.

Wheel model

The force analysis diagram of the left and right wheels of the two-wheeled robot is shown in the figure. The horizontal force of the robot is the vector sum of the friction between the wheel and the ground and the horizontal force between the body and the wheel.

The movement of the balancing car is achieved by the rotation of the wheels. We choose a pair of coaxially installed wheels with the same parameters (mass, moment of inertia, radius).

Take the right wheel as an example for force analysis:

image-20240921141154399

The movement of the wheel can be decomposed into translation and rotation, and Newton's second law can be obtained:

image-20240825221517308

From the law of rigid body fixed axis rotation, it can be obtained:

image-20240825221535659

Explanation

image-20240825222110723

Combining (1) and (2), we get:

image-20240825222213573

When the wheel does not slip, the speed of the wheel is proportional to the speed of rotation, that is,

image-20240825222 238194

Combining (3) and (4), we get:

image-20240825222316354

Since the parameters of the left and right wheels are the same, the left wheel has a similar result, that is,

image-20240825222335244

Car body model

The movement of the car body can also be decomposed into forward movement (forward, pitch) and lateral movement (steering, yaw): yaw movement can be regarded as a special case of steering movement.

Forward motion

The forward motion of the car can be decomposed into forward motion and relative rotation (pitch) around the center of mass P of the car body:

image-20240921141426563

The horizontal displacement of the center O of the chassis of the car is:

image-20240825223350923

Add equations (5) and (6) together, and divide both sides of the equation by 2 to get:

image-20240825223450159

Apply Newton's second law to the car body, in the horizontal direction:

image-2024082 5223602940

Apply Newton's second law to the car body, in the vertical direction:

image-20240825223612137

Apply the law of rigid body fixed axis rotation to the car body and we get:

image-20240825223638158

Explanation

image-20240825223707991

The combined equations (9) and (10) yield:

image-20240825223846078

Among them:

image-20240825224005898

The equation contains nonlinear terms, so it is linearized. Considering that the inclination angle of the vehicle body is relatively small, it can be considered that:

image-20240825224317215

Therefore, equation (13):

image-20240825224343500

Substitute equations (10) and (11) into equation (12):

image-20240825224431803

Linearize equation (15):

image-20240825224509442

Substitute equation (16) into equation (14):

image- 20240825224544717

image-20240825224614937

In summary, for forward motion:

image-20240825224702844

Steering movement

image-20240921141547236

The steering movement is caused by the unequal magnitudes of the reaction forces HL and HR applied to the vehicle body by the left and right wheels in the horizontal direction. According to the law of rigid body fixed axis rotation, we can get:

image-20240825225038872

Explanation

image-20240825225058285

Subtract equations (5) and (6) to get:

image-20240825225134542

When the left and right wheels have different speeds, the vehicle body turns:

image-20240825225213278

According to the geometric relationship, we can get:

image-20240825225525566

From equations (19) and (25), we can get the state equation of the system:

image-20240825225632177

The state variables represent the displacement, forward speed, inclination angle, angular velocity, steering angle and steering speed of the car.

Since the magnitude of the motor output torque is difficult to control directly, it is converted into the acceleration of the two wheels through the law of rigid body fixed axis rotation:

image-20240825225719369

The left side of equation (27) is the magnitude of the linear velocity of the left/right wheel when there is no friction (in rad/s).

Therefore, the state space expression of the system becomes:

image-20240825230023208

Motor drive circuit design
Introduction to Linux system

COMPANY

  • About us
  • Team Style
  • Blog

LEARNING & EXPLORATION

  • Tutorials
  • Edge AI hardware
  • Educational robots
  • Embedded intelligent hardware

WHERE TO BUY

  • Yahboom Online Store
  • Amazon
  • Alibaba
  • AliExpress
  • Mercado

TECHNOLOGY SUPPORT

  • Email: support@yahboom.com

BE A DISTRIBUTOR

  • Email: sales@yahboom.com
QR Code
QR Code

Copyright © 2017-2026 Yahboom. All Rights Reserved.

EN/中文