Unicycle Model
Introduction
Kinematic model of an unicycle:
\[ \begin{array}{l} \left\lbrack \begin{array}{c} \dot{x} \newline \dot{y} \newline \dot{\theta} \end{array}\right\rbrack =\left\lbrack \begin{array}{cc} r\cos (\theta ) & 0\newline r\sin (\theta ) & 0\newline 0 & 1 \end{array}\right\rbrack \left\lbrack \begin{array}{c} \dot{\phi} \newline \omega \end{array}\right\rbrack \ \ \ \ \left\lbrack \begin{array}{c} \dot{x} \newline \dot{y} \newline \dot{\theta} \end{array}\right\rbrack \ \text{from the state} \ q=\left\lbrack \begin{array}{c} x\newline y\newline \theta \end{array}\right\rbrack \ \end{array} \]
It’s possible to control the vehicle using \(v\) and \(\omega\) as used in the ROS topic cmd_vel using this formulation:
\[ \left\lbrack \begin{array}{c} \dot{x} \newline \dot{y} \newline \dot{\theta} \end{array}\right\rbrack =\left\lbrack \begin{array}{cc} \cos (\theta ) & 0\newline \sin (\theta ) & 0\newline 0 & 1 \end{array}\right\rbrack \left\lbrack \begin{array}{c} v\newline \omega \end{array}\right\rbrack \]
This is the basic mobile robot model
Code
The simulation will use the ode45 solver.
|
|
Bicycle Model
Introduction
The bicycle model is defined by the following equation
\[ \left\lbrack \begin{array}{c} \dot{x} \newline \dot{y} \newline \dot{\theta} \newline \dot{\phi} \end{array}\right\rbrack =\left\lbrack \begin{array}{cc} \cos (\theta ) & 0\newline \sin (\theta ) & 0\newline \frac{\tan (\phi )}{L} & 0\newline 0 & 1 \end{array}\right\rbrack \left\lbrack \begin{array}{c} v\newline \omega \end{array}\right\rbrack \]
Where v is vehicle speed and omega is the stering angle
If it is possible to directly control the stering angle phi, then the model become:
\[ \begin{array}{l} \left\lbrack \begin{array}{c} \dot{x} \newline \dot{y} \newline \dot{\theta} \end{array}\right\rbrack =\left\lbrack \begin{array}{cc} \cos (\theta ) & 0\newline \sin (\theta ) & 0\newline 0 & 1 \end{array}\right\rbrack \left\lbrack \begin{array}{c} v\newline \widehat{\omega} \end{array}\right\rbrack \\ \\ \widehat{\omega} =\frac{v}{L}\tan (\phi ) \end{array} \]The ideal center of the robot is inside the motored wheel.
It’s important to remeber to set the L parameter.
Code
|
|
Differential Drive (Roomba style)
Introduction
The differential drive robot model is a practical physical implementation of the kinematic unicycle model. It is based on decomposing the ideal unicycle into two independently actuated components. By separately controlling two driving wheels, the robot generates linear and rotational movements equivalent to those of a unicycle.
The front velocity will be the resulting composition of the effects from both left and right wheel angular velocity \(v=\frac{R(\omega_L +\omega_R )}{2}\).
Similar considerations apply to the resulting angular velocity, though with distinct operational differences. It is essential to maintain the right hand rule convention during formulation. In addition, one must note that the resulting angular momentum decreases as the distance between the wheels increases \(\omega =\frac{R(\omega_R -\omega_L )}{d}\).
\[ \begin{array}{l} \left\lbrack \begin{array}{c} \dot{x} \newline \dot{y} \newline \dot{\theta} \end{array}\right\rbrack =\left\lbrack \begin{array}{cc} \cos (\theta ) & 0\newline \sin (\theta ) & 0\newline 0 & 1 \end{array}\right\rbrack \left\lbrack \begin{array}{c} v\newline \omega \end{array}\right\rbrack \\ \\ v=\frac{R(\omega_L +\omega_R )}{2},~\omega =\frac{R(\omega_R -\omega_L )}{d} \end{array} \]The center of the robot is located on the middle point beetween the wheel axis. Usually some passive supports are added to maintain equilibrium (like a castor wheel or a spherical wheel).
It is possible to define wheel radius and distance. If controlled trought \(\left\lbrack \begin{array}{c} v\newline \omega \end{array}\right\rbrack\) the results will be the same of the unicycle. Those parameters will then have effects on \(\omega_R\) and \(\omega_L\).
Code
|
|
Model From Scratch
It is useful know how to derive and simulate a mobile robot kinematic model from first principles, entirely without relying on specialized robotics toolboxes. Developing a barebone model manually forces a deeper understanding of the system’s physics and eliminates restrictive software dependencies.
More importantly, this approach frees the code from proprietary platforms like MATLAB, making the core equations universally portable and easily translatable to open-source environments, custom software nodes, or directly into low-level embedded hardware.
Implementation of the Unicycle Model
|
|
Implementation of the Bicycle Model
|
|
Implementation of the Differential Drive Model
|
|
Validating Result
|
|
Considerations
By controlling using \(\left\lbrack \begin{array}{c} v\newline \omega \end{array}\right\rbrack\) we see that unicycle and differencial drive robots have basically the same output. The parameter L on the bicycle model is considerably influencing the path.
Using Simulink
Simulink provides a GUI helping dealing with this models.
Opening the corresponding block it is possible to configure it as previously done in code.
Using the Simulink interface can be preferred for its simplicity and immediacy during developement.
Using this model, a “drawer” function block calculates \(v\) and \(\omega\) starting from a trajectory,
then giving as an input to a Differential Drive Kinematic Model.
|
|