Exercises
The following exercises will deepen your understanding of the topics discussed in this chapter and make the robot code better:
- The IMU could be added by storing a previous state and calculating the delta. You could mix this into the
rot1
/rot2
values by taking the average of encoder calculations versus the IMU angles, or consider whether one sensor is more trusted than the others. You will need to calibrate the IMU before it can be used. - The robot’s pose guesses get stuck in local maxima – good but wrong guesses that are likely based on sensor positions. Consider throwing in 10 fresh guesses at every population to nudge the code to try other options.
- We are using only two observations per pose – having more distance sensors could improve this but will make the model slower.
- Could you add a target zone to the arena? Consider how PIDs could be used to steer the robot toward this. Perhaps feed the PID with the mean pose.
- You can improve...