HOW TO – Program a robot and control it on the web right now!

Robotics Technology
HOW TO – Program a robot and control it on the web right now!

Webcam-1Michael 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.

Screenshot

Before you run your program, you should bring up the robot webcam on your browser by visiting robot.linuxrobots.org

Webcam

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.

Outputs:
The robot has two driven wheels. You can control the speed and direction of each independently.

Inputs:
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.

Construction:
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:
http://www.linuxrobots.org/downloads/moveTowardsLight.c

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!

What will the next generation of Make: look like? We’re inviting you to shape the future by investing in Make:. By becoming an investor, you help decide what’s next. The future of Make: is in your hands. Learn More.

Tagged

current: @adafruit - previous: MAKE, popular science, hackaday, engadget, fallon, braincraft ... howtoons, 2600...

View more articles by Phillip Torrone
Discuss this article with the rest of the community on our Discord server!

ADVERTISEMENT

Escape to an island of imagination + innovation as Maker Faire Bay Area returns for its 16th iteration!

Prices Increase in....

Days
Hours
Minutes
Seconds
FEEDBACK