Linux Format

ROBOT PROJECTS

-

Web control

A roundabout way to control your Pi is to have it run a small webserver with an HTML form to control it. If your robot has a camera attached too, then you can stream the video to this webpage for a delightful first-person video driving experience.

A streaming video processor in Python is less complicate­d than you’d think, but more complicate­d than we’d like to get into in this summary. Study the Diddyborg web UI example at http://bit.ly/ Lxf260didd­y to see how the magic happens. If you are lucky enough to have a Diddyborg then you can copy that script to it.

Gamepad control

Controllin­g your robot with a gamepad is a little easier to get along with. We ran into some difficulti­es with our Bluetooth controller when we tried this back in LXF236 and had to resort to Sshing into our robot to manually pair it via the bluetoothc­tl command. A wireless USB controller requires zero configurat­ion and can be picked up for around £10. We quite like the retro Ps2-style ones, but that’s just us.

Ball following

Opencv is an astounding­ly powerful computer vision framework that includes Python bindings. It’s actually used to draw the image in the earlier Web UI example, but we can use it for more advanced purposes too. It’s capable of detecting objects within an image, which means we can make our robot drive towards them. If those objects move, then it will follow them. For this to work, those objects will need to be fairly distinct, such as a brightly coloured ball. You will find just such an example at www.piborg.org/blog/diddyborg-v2examples-ball-following.

 ??  ?? We need to convert the image to HSV so that Opencv can better detect any red ball-like objects to follow.
We need to convert the image to HSV so that Opencv can better detect any red ball-like objects to follow.

Newspapers in English

Newspapers from Australia