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!


Recent Entries

Comments

Oldest comments listed first.

Posted by: roschler on January 6, 2006 at 6:50 AM

Phillip Torrone,

Wonderful idea and it's the first time I've ever seen anyone do it!


Posted by: liamstask on January 6, 2006 at 9:18 AM

Michael - looks great, as always...nice work!


Posted by: liamstask on January 6, 2006 at 9:19 AM

Michael - looks great, as always...nice work!


Posted by: MichaelShiloh on January 6, 2006 at 1:10 PM

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.


Posted by: MichaelShiloh on January 7, 2006 at 3:04 PM

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.


Leave a comment


Subscribe to MAKE!Subscribe to MAKE Magazine!

Subscribe today, save 42% and get web access to MAKE free. MAKE Digital Edition is available only to subscribers.

$34.95 / 1 year
(4 Quarterly Issues)

Subscribe now


Void your warranty, violate a user agreement, fry a circuit, blow a fuse, poke an eye out. Make: The risk-takers, the doers, the makers of things... Welcome to Make: Online!


CRAFT Maker Shed Maker Faire MAKE television
MAKE: en EspaƱol MAKE: Japan


Check out all of the episodes of Make: television

Make: Science Room

Connect with MAKE

Be a MAKE fan on Facebook MAKE on Facebook
Visit our Facebook page and become a fan of MAKE!
MAKE on Twitter MAKE on Twitter
Follow our MAKE tweets!
MAKE Flickr Pool MAKE on Flickr
Join our MAKE Flickr Pool!
    make_tips on Twitter

    MAKE's RSS feed is here.
    Add MAKE to iGoogle - GoogleGoogle.
    How to add MAKE to your RSS reader - Real simple.
    Add MAKE on FriendFeed




    Maker SHED

    Advertise here with FM.

    Why advertise on MAKE?
    Read what folks are saying about us!

    Click here to advertise on MAKE!



    Subscribe to MAKE Magazine!

    Make: Online authors!

    Gareth BranwynGareth Branwyn
    Senior Editor


    Phillip TorronePhillip Torrone
    Senior Editor
    | AIM | Twitter


    Becky SternBecky Stern
    Associate Editor
    | AIM | Twitter


    Marc de VinckMarc de Vinck
    Contributing Writer
    | AIM | Twitter


    John ParkJohn Park
    Contributing Writer
    | Twitter


    Sean RaganSean Ragan
    Contributing Writer
    | Twitter


    Matt MetsMatt Mets
    Contributing Writer
    | AIM | Twitter


    Dale DoughertyDale Dougherty
    Editor & Publisher
    | Twitter


    Shawn ConnallyShawn Connally
    Managing Editor
    | Twitter


    Goli MohammadiGoli Mohammadi
    Associate Managing Editor

    Kip KayKip Kay
    Weekend Projects
    | AIM | Twitter


    Collin CunninghamCollin Cunningham
    Contributing Writer
    | AIM | Twitter

    Adam FlahertyAdam Flaherty
    Contributing Writer
    | AIM | Twitter



    More contributors: Mark Frauenfelder (Editor-in-Chief, MAKE magazine), Kipp Bradford (Technical Consultant/Writer), Chris Connors (Education), Diana Eng (Guest Author), Peter Horvath (Intern), Brian Jepson (O'Reilly Media), Robert Bruce Thompson (Science Room)

    Suggest a Site!

    Current Podcast

    itunesdl.gif Weekend Project: Making Char Cloth Learn how to make a cheap and effective fire starter made from an old t-shirt. To download The Char Cloth video click here and subscribe in iTunes. See Char Cloth in action with the Fire Piston from William Gurstelle.... More...

    Get the Make: Online sent via email
    Enter your email to receive Make: Online each day:



    MAKE Fascination video series brought to you by Dow

    Make: Education

    Important please read


    Subscribe to MAKE Magazine!

    Recent Posts from the Craft: Blog