It is useful in robotics to sense the movements of motors and wheels. We've driven a robot along a path, but it's unlikely that it has stayed on course. Detecting this and travelling a specific distance is useful in creating behaviors. In this chapter, we will investigate the sensors that can be used for this and then program the robot to move in a straight line, and for a specific distance. We will then look at how to make a specific turn. Please note that this chapter will contain math.
In this chapter, you will learn about the following topics:
- Distance and speed measuring sensors—encoders and odometry
- How to attach the sensors to your robot
- Creating code to work with these sensors and detect a basic distance (in ticks)
- Seeing how to correct for veer in a robot and actually drive in a straight line
- Calibrating the sensors...