7 Joystick controlled robots
This chapter covers
- Reading joystick data using Pygame
- Reading and parsing raw joystick event data
- Measuring the rate of joystick events
- Creating a remote joystick robot controller
Joysticks are one of the most powerful human interaction devices. When it comes to controlling robot motors they offer much more superior control compared to keyboards and mice. The scenarios covered in this chapter help the reader create a fully functional joystick controlled robot. This chapter will teach you multiple ways of reading events from joystick hardware. We can then create our own event handlers that will perform different robot movements based on specific joystick movements. Along the way we will also learn how to measure how many joystick events get triggered per second and create an optimization in our code that prevents the robot motors from getting flooded with movement requests. Finally we end the chapter by creating an application that moves the robot using a joystick over the network.
7.1 Hardware Stack
Figure 7.1 shows the hardware stack with the specific components used in this chapter highlighted.
Figure 7.1 Hardware stack: The Joystick will be used to control the robot movements
