Seeing the puck using OpenCV
To know where the puck is, you'll need vision. Fortunately, adding hardware and software for vision for Raspberry Pi is both easy and inexpensive. First, you'll need to connect to a USB webcam.
Installing a USB camera on Raspberry Pi
Connecting a USB camera is very easy. Just plug it in the USB slot. To make sure your device is connected, type lsusb
. You will see the following:
This shows a Logitech webcam located at Bus 001 Device 008: ID 046d:0825
. To make sure that the system sees this as a video device, type ls /dev/v*
and you will see something similar to the following:
The /dev/video0
is the webcam device. Now that your device is connected, let's see whether you can actually capture images and videos. There are several tools that can allow you to access the webcam, but a simple program with video controls is called guvcview. To install this, type sudo apt-get install guvcview
. Once the application is installed, you'll want to run it. To do this, you'll either...