Michael wrote up a special how to and guide for MAKE about a robot you can program and control over the web right now! – “Before you roll your eyes and tell me about all the other robots you’ve seen on-line and at robot shows, let me tell you why this one is different. You have to program it, or it won’t do anything. And by that I mean you ssh into the robot, write a program, compile it on the robot, and run it on the robot.” Here’s how it works and how to try it out…Log into the robot via ssh. Do this now: it’s live, online. The robot is at robot.linuxrobots.org, user robot, password robot.
You’ll find source code in the src directory. Use one of the existing source files as an example (either moveTowardsLight.c or skeleton.c are good starting points), or write your own from scratch. Use nano or vi for editing, or copy the source file to your own computer using scp.
Compile your program on the robot by typing “make”. As you can see from the makefile, two other files are linked in: teleolib_linux_x86.a supports the hardware interface, and librobot.o consolidates much of the common stuff, so that your application can be as simple as possible.
Before you run your program, you should bring up the robot webcam on your browser by visiting robot.linuxrobots.org
Run your program. If you have instructed the robot to move, the picture on the webcam should change. It is updated every second.
More details on how to program it are at: http://www.linuxrobots.org/wiki/How_to_program_it. You can leave questions and comments there for me as well as adding your own content.
The robot has two driven wheels. You can control the speed and direction of each independently.
The robot has 4 photocells pointing in each of the four directions, and a distance measuring sensor pointing forward. You have access to the values from these sensors.
Your view of the world is only what the robot sees, so if you print out the sensor values, you will be able to “see” what the robot sees.
The image from the webcam is not yet available to the robot software. If you want to help adding this, let me know.
Use the values from these sensors, and your own ingenuity, to program the robot to find light, or to avoid walls, or to wander around my house.
The robot is very simple and unglamorous. My goal was to get something done quickly, without special equipment, so that we could start programming it.
Construction is primarily hot glue and foam core. Parts and materials are all off-the-shelf. You can make your own in a few hours for about $700.
Parts list, pictures, ideas for the future, and more information: http://www.linuxrobots.org/wiki/michael_shiloh
Here is an example program to move the robot towards light:
This sample program gives me an opportunity to emphasize what this project is, and is not.
This robot is not a remote controlled webcam driven by a joystick. This robot is a Linux computer on a motorized platform with 4 photocells (light sensors), a distance measuring sensor, and two motorized wheels. You decide how you want to control the motors. If you wish, you can write a program that animates the robot according to where your mouse is, and you have a remote controlled device. If you wish, you can make the robot drive in circles, ignoring all inputs.
I want to see what behavior you can give to an autonomous robot.
The robot is online and powered up all the time. Log in and make it do something. Impress me, scare my dog, have fun!
10 thoughts on “HOW TO – Program a robot and control it on the web right now!”
Wonderful idea and it’s the first time I’ve ever seen anyone do it!
Michael – looks great, as always…nice work!
Michael – looks great, as always…nice work!
Thanks Liam and Roschler,
I realize I forgot to put a picture of the robot in the article. He’s a link to a good picture
taken by Scott Beale of Laughingsquid
It’s cool when the robot suddenly starts moving, seemingly by itself. I hope some of you log in and try it.
I’ve noticed quite a few people logging in and running the robot. That’s great.
I’ve noticed a few shortcomings, mostly on my part:
1. Robot has no way to detect that it’s jammed against some obstruction. I simply must add some bump sensors. I’m going to try to build such a sensor with a soft hose around the perimeter, sealed and attached to a pressure switch. A bump will increase the pressure, triggering the switch.
2. If the distance measuring sensor sees something up close, it inhibits any motion. That’s not really useful, as it sees only in a narrow forward cone, so it completely misses the sides and back and even much of the front. I think I’ll disable this feature.
3. Webcam gives a poor picture if there isn’t enough light. I’ll add a light, either that can be controlled by the program, or that automatically turns on every time the webcam takes a new picture.
4. Finally, I see many people setting the speed at a low value. The robot doesn’t really start moving with a speed less than 60 or so. I should scale this automatically and better document this. Meanwhile, don’t be afraid to use a speed of 70
I’ve added a simple program to allow control of the robot directly via the h-j-k-l keys (vi users will know why). It’s called vi_control, and of course the source is available for you as well.
There are many other improvements I’d like to make over time. The robot wiki has a todo list, such as the ability to use data from the webcam in the program. I welcome your suggestions to this list. The robot is very much a work in progress.
Comments are closed.