A good performing robot needs tuning
Tuning & Testing
When building a robot with multiple functions and systems there is often a need for tuning and testing to get the robot working optimally. One of the most important features with this lawn mowing robot is the perimeter wire system that needs tuning to get the robot to change direction at the correct distance from the wire. Below you will find information about how you test and tune the perimeter system and other important functions on the robot.
Driving straight
This robot is equipped with motor encoders on the two big front wheel motors to read out the motor axle speed. One problem with this is that you can not read out the absolute left/right ground speed as there is a gearbox and a wheel connected to the axle that could have slightly different dimensions because of small production differences and this could make one side move just a fraction faster than the other. To make the robot drive straight there is a need for manual testing and tuning of the left and right speed data from the encoders. On the left image you find the two parameters in the source code that you use to tune the encoder data and here you can see a video under Building Steps of how you can tune the robot
In the left image you have the parameter m_fLeftSensorSpeedInCmPerSec where the value is multiplied by 0.96f to make the robot not turn to the left all the time. If you build your own robot it might be that your robot turns to the right all the time and you will then have to change this row to m_fRightSensorSpeedInCmPerSec and first test to multiply it by 0.95f to see if it still turns to the right and then tune it in multiple test runs to see that you get the robot to drive straight.
Digital fence
In the image to the right you find the parameters in the robot source code to adjust the perimeter wire pulse values to get the robot to identify the pulses from the wire and then change direction at the right distance from the wire.
If the robot changes direction to late then you should lower the iHighPulseValue to maybe 700 and then test again. And if you think it turns to early then you can change the value to 800.
This video shows how the robot should change driving direction when testing the system.