## 4 Four-Mecanum-Wheeled Mobile Platform
### Simulation Tool  
Obviously, the best way to test the proposed path-tracking algorithm is by using a real four-mecanum wheeled vehicle. The main issue is that it is not easy to measure the real position of the vehicle. Outdoor positioning (e.g., GPS) does not have enough precision to measure XY coordinates of a small size vehicle. Indoor positioning (e.g., beacons or LIDAR) provides the position with a great amount of noise. To prove the validity of the proposed solutions, a precise way of determining the position and orientation of the vehicle is needed. Simulation tools can be an especially useful alternative, but the simulation model must imitate the behavior of the real model as precisely as possible. Using transfer functions and kinematic equations of the vehicle excludes some important characteristics of the real vehicle. Nonlinearities of the motors, the limited resolution of the encoders, and the sliding of the wheels play a significant role in the trajectory described by the real vehicle and must be included in the simulation model. Simscape Multibody, a well-known Matlab/Simulink library, is used to develop a simulation model in this work. In this case, the main challenge is to simulate the real behavior of the mecanum wheel. In a conventional wheel, the friction between the wheel surface and the ground generates the forces and torques that move the vehicle. An example of this for a two-wheeled vehicle can be found in [23]. However, in the case of the mecanum wheel, the forces and torques are generated by the friction with the rollers of the wheel (see Figure 5). The rollers, attached with a 45\({}^{\circ}\) angle, allow the wheel to generate a twisting force that makes the vehicle to move in 3 DOF (forward-backwards, right-left, rotation around the vertical axis). Figure 6 shows the Simscape Multibody model of the mecanum wheel. As can be seen, each one of the rollers has a revolute joint to allow it to turn over the hub in which it is mounted. The contact forces of each one of the rollers can also be seen. These blocks are the ones that generate the combination of forces/torques that make the wheel behave as in the real world. Each one of the four wheels of the simulated vehicle has its own angular velocity control, as shown in Figure 7. The revolute joint allows the wheel to turn over the vehicle chassis. The damping coefficient in this revolute joint was adjusted to emulate the dynamic behavior of the motor used in the real vehicle. Saturation and dead-zone blocks were included for a better simulation of the real behavior. As the motors used in the real vehicle  
Figure 5: Mecanum wheel: real and modeled. Figure 6: Internal assembly of modeled mecanum wheel. have good linearity, it was considered necessary to include any other nonlinearities. A PI controller was used to assure that the wheel angular velocity follows its desired reference. This control loop uses the same sample time as the real control loop, implemented in the microcontroller mounted in the vehicle. The parameters on this PI controller are the ones used in the angular velocity control loops of the real vehicle. In the real motor, the angular velocity was measured by means of a built-in encoder. The resolution of this encoder, which depends on the number of pulses-per-revolution, was included in the feedback so that the simulated control loop works with the same information as in the real world. The simulated control loop was validated by comparison with the real one. With the wheels-in-the-air (i.e, no contact with the ground) and the wheels-on-the-ground, the results provided by the real and simulated encoder are shown in Figure 7(a),b. As can be seen, real results have a great amount of noise, but the dynamical behavior is quite similar to the simulated results in the transient and steady state. Joining four of these structures to the CAD (Computer-Aided Design) model of the chassis, the simulated vehicle is completed, as shown in Figure 9. A Cartesian joint was included to provide XYZ DOF.