Differential drive configuration consists of two wheels which are in-line with each other. Both are independently powered so the desired movements will rely on how these wheels are commanded. It is probably the simplest approach and that is why its use has become widespread among most of the robotic competitors. In this post a kinematic model for this configuration will be presented and applied to a simulation carried out in Simulink. The resulting system takes voltage as a motor input, hence the rotational speed of the wheels may vary and so will the robot’s position whose central point is represented in a Cartesian plane (XY).
Since the motor voltage is regarded as the input of the system, a DC motor simulation has been deemed necessary. For those of you who are only interested in the Kinematic model and/or have a good insight into DC motors, you can skip this part.
In a nutshell, a DC motor is an electro-mechanical device which, as its name suggest, converts electrical energy into mechanical energy. Its working principle lies in the Lorenz force created as a consequence of having an electric current going through a conductor which is placed within an external magnetic field. The electrical diagram of a DC motor with permanent magnets and the differential equations that describe its dynamics are indicated bellow:
From these equations we can notice that there is a proportional relationship between the current in the winding and the rotor torque (K_i) and it also exits a correspondence between the back EMF and the rotor rotational speed (K_v). The torque is exerted to accelerate the rotor and ultimately this mechanical power will be transmitted through a gear set to the wheel. Therefore part of the torque will cause a rotational acceleration of the rotor, depending on its inertia (J_m), and the other of the energy will be dissipated in the bearings according to its viscous friction (B_m) and the rotational speed. As mentioned, our application will require certain reduction in order to adapt the speed (reduced) and torque (increased) and meet the wheel kinematic needs. Therefore, what we would be interested in modelling would be:
If we study the gear reduction effect in more detail we will happily realise that not only does it adapt our mechanical variables but it also reduces quadratically the dynamic effect of the wheel inertial and viscous friction on the motor. This equations express this idea precisely:
At this point we have the whole set of equations that we need to describe the motor-wheel dynamics. So, we are pretty much ready to arrange all the equations and apply Laplace transform. Working out the calculations, the outcome could be represented in a block diagram as follows:
Let’s recap, our target was to relate the voltage with the speed. The input of this diagram is the voltage of the motor (V) and it has as outputs the linear speed generated by the rotation of the wheel (m/s) and its displacement (m), which is merely its integral. The large transfer function relates the rotor torque with the rotor speed considering the wheel dynamic influence and also the gear efficiency. Actually the diagram above constitutes a subsystem of the kinematic model, we will need two of these for a differential drive robot. I would like to mention that at the end of this post I will attach a copy of the Simulink and Matlab files containing all the information needed to develop and follow the stated ideas.
Now that we are able to control independently the speed and/or position of each wheel, let’s study what kinematic equations exist for our robots to perform the desire trajectories. The kinematic model of a differential drive robot is pretty forward indeed.
The image above depicts an example of a robot turning around a certain point due to a difference in the linear velocity of each wheels. Where:
- D is the distance between wheels.
- V is the robot speed.
- V_r and V_l, are the linear speed of the right and left wheels, respectively.
- R is the wheel radius.
- C is the turning radius.
- W is the rotational speed of the robot.
The average speed and rotational speed of the mobile platform are quite simple to calculate.
Bearing in mind that the linear velocity is the cross product of the rotational velocity and the distance from the turning point to the centre, in other words the turning radius. As we just need its absolute value:
This is it, there isn’t much mystery in the kinematic model of a differential drive robot. What I did next was to write down all this equations in Simulink and related the different blocks. Therefore, we could track the location of the centre of the robot.
The subsystem at bottom of the picture represents the position of the robot in function of its angle through time. The good thing of having a dynamic model of the motors is that it would allow us to design theoretical regulators in order to improve its transient response. Back to the model we could roughly analyse the influence of the construction parameters. For instance, widen the chassis or reducing the diameter of the wheels.
It is quite obvious that a complete model would not neglect the effect of the forces that are exerted while the robot is in motion. Unfortunately, a dynamic model entails higher complexity but it might be worth as it would provide precious information and enhance the reliability and consistency of the model. Even an ideal simulator is likely to neglect uncertainties that arise from model inaccuracies, other considerations can be added; however, the problem is already challenging. Under this circumstance the designer has to consider matters such as the location of the centre of mass, weight transfer, friction, centripetal forces,…
In the real world if we want to put this into practice we should have a pretty accurate method to calculate the speed of our robots, for that purpose there are encoders. Jorge’s designs are characterized by simplicity, as well as a remarkable performance, and in order to supply a constant voltage reference to the motor driver his approach relies on a DC/DC step-up converter. In this case, I am not sure if any correspondence might be determined by ensuring a constant level as the current variations for the same voltage input will cause a variation of the EMF. In any case, the encoders work quite well for motion control, nevertheless they are prone to accumulate small angle errors. In order to deal with this issue, there are techniques which combine the best of the encoders (linear motion) with other sensors, like a gyroscope to figure out the orientation more accurately.
The files included to successfully run the example in MATLAB are a .m containing the motor-wheel parameters, this file should be executed first, and a .mdl to be open in Simulink. If you have any questions feel free to ask.
The motor modelling equations and diagrams have been extracted from the Book: Platero C., Apuntes de Regulación Automática I, Servicio de Publicaciones EUITI-UPM, 2006.