In this model, the robot's state is represented by the position
and velocity
of the center of mass (COM) and the angular velocities of the wheels
In this model, the robot's state is represented by the position, velocity, and angular velocities (roll, pitch, and yaw)
of the center of mass (COM) and the angular velocities of the wheels
In the repository, I am only presenting the equations for the 3D model
.
Symbol | Unit | Description |
---|---|---|
Rad | Angle of the left and right wheels | |
ψ | Rad | Tilt angle of the robot body |
ϕ | Rad | Rotation angle of the robot |
The dynamics of the two wheeled self-balancing robot can be described by the following system of differential equations:
Symbol | Unit | Description |
---|---|---|
Kg | Mass of the wheel | |
Kg | Mass of the robot | |
M | Radius of the wheel | |
M | Width of the robot | |
M | Length of the robot | |
M | Height of the robot | |
M | Distance from the robot's center of mass to the axle | |
Friction coefficient between the wheel and the plane | ||
Friction coefficient between the robot and the DC motor | ||
kg·m² | Moment of inertia of the DC motor | |
Ohm | Resistance of the DC motor | |
V·sec/rad | EMF coefficient of the DC motor | |
Nm/A | Torque coefficient of the DC motor | |
Gear reduction ratio | ||
m/s² | Gravitational acceleration | |
Rad | Average angle of the left and right wheels | |
Rad | Angle of the left and right wheels | |
Rad | Tilt angle of the robot body | |
Rad | Rotation angle of the robot | |
M | Coordinates of the left wheel | |
M | Coordinates of the right wheel | |
M | Average coordinates | |
Nm | Torque generated in different directions | |
Nm | Torque generated by the left and right motors | |
A | Current through the left and right motors | |
V | Voltage across the left and right motors |
Apply the Euler-Lagrange equations to the robot's dynamics:
Where
$T$ : The sum of the kinetic energy components of the system.$V$ : The sum of the potential energy components of the system.$L_{\text{lagrange}} = T - V$ : The Lagrangian multiplier.$q_i$ : A generalized coordinate describing one of the degrees of freedom in the system.$F_k$ : The total external force acting on the system corresponding to the generalized coordinates$q_i$ .- For the 3-degree-of-freedom model, there are three generalized coordinates:
$q_1 = x$ (The horizontal motion);$q_2 = \theta$ (The tilt angle);$q_3 = \psi$ (The rotation angle of the robot body).
Assuming at time
We need to reformulate these equations as follows:
Solve equations (5.1), (5.2), and (5.3) using MATLAB software and the solve
function.
Result calculation
Apply the state-space function to the robot system as follows:
Where
and
Linearizing the robot at the equilibrium point (where all initial state variables are zero) allows for accurate determination of the matrices
The working point chosen to proceed with the linearization of the robot to a linear form
and
Using MATLAB to solve the system equations: The final state-space function equation will take the form:
Elements of both matrices will be calculated by MATLAB.