Joysticks are one of the most powerful input 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 will help you 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 the number of joystick events triggered per second and optimize our code so that it 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.
Joystick-controlled robots have a wide array of applications, ranging from remotely operating heavy vehicles on factory floors to performing delicate medical procedures using robotic arms. In the case of robot-assisted surgery, by controlling very small robotic arms, the doctor can perform surgical procedures that would not be possible otherwise.