# Control the Chassis (MATLAB task)

This example task is focused on chassis control. This task will set the wheel values so that the rover goes around the given radius. The task itself is already implemented in the application as a function called by the "TurningRadius" command or in the wheel UI in the "Turning Settings" panel. However, it is possible to design the task in such a way that it will be possible to use only commands for individual adjustment of rotation and speed of the wheels, and thus replicate the task using the MATLAB environment and language. To create the task, it is necessary to know the ratio of the radii of the individual wheels during rotation. These ratios are based on the already mentioned Ackermann principle for cornering and the dimensions of the chassis. A center circle is prepared in the laboratory environment, which serves as a calibration of this function. In this case, the circle has a diameter of 20 meters.An example of calculating the turning radius of a wheel:

From the calculated radii, the individual turning angles of the corner wheels can now be set. The angles are calculated using the arcus sine trigonometric function of the vertical component of the wheel position to the radius of the circle along which the wheel moves. Here it is necessary to consider in which direction the rover will turn and introduce this data into the calculation. If the wheels should turn to the left, the resulting turning angles must be negative.

Since the wheels rotate in circles of different radii, it is also necessary to adjust the individual rotation speeds of the wheels to prevent them from slipping. The fastest possible movement a wheel can perform is 100 degrees per second. This is the speed at which the wheel that orbits at the largest radius will move. The other wheels will be set to the speed multiplied by the ratio of the own radii to the largest. All calculated values can now be sent using the UDP server as commands. For example, the command to set the rotation will look like this: engine FrontRightWheel (value). Further, the command to set the speed similarly: engine FrontRightTire (value).