for small robots
|I've designed several robots which implement the ideas presented below. You can download some of them to try for yourself. You'll find the download links scattered through this page. Of course, to run the programs, you'd need the right kind of robot but at least you can see how the languages work.|
I'm interested in robots for education - which means making them as cheap as possible. Schools are always broke and one robot per class isn't enough. Schools in developing countries have even less money. The ideal is a very cheap robot with an easy-to-learn but rich language that's tailored to real-time multi-tasking.
Lego certainly helps bring robotics to the masses. But I'm more interested in parents who will buy a $20 kit for their child but not a $230 Lego set. Or gadget-lovers who have found that Robosapiens is brain-dead and want more intellectual stimulation. My proudest creation is a complete programmable robot for a cost price of $10 - I'd love it if they were produced in India for $5 so every school there could afford them.
So what questions and challenges are we faced with?
A robot must respond to its environment otherwise it's not much more than a wind-up toy. If you're going to benefit from it, it must be programmable. What's the best programming language for beginners or children? I think the design of children's language for robotics is a fascinating problem. I haven't seen it discussed much anywhere. The very few papers I've read have been very disappointing.
What if the language has to run on a tiny processor with very little memory? In my smallest robots, the "user program" has to fit into the 128 bytes of EEPROM available on a cheap PIC. What's the best programming language? What is the best instruction set for the i-code.
What if the user doesn't have a PC and must do all their programming on the robot? What is the minimum useable programming interface?
With a small instruction set, you have to throw stuff out. What? A typical mission is "head towards the bright light until you hit an obstacle then turn right and follow the wall on your left until you come to a dead end". Do you really need variables?
As far as I know, these are not questions that have been answered, or even asked, in any book or website.
Most of this dobument is a historical list of robots that have tried to answer those questions.
Why bother with small processors?
My Big Question is: how have insects solved the "don't get stuck behind the couch" problem? Most AI workers see "machine vision" or "planning" as the big problems. I don't. I think they're the cherry on top of the cake. Even the most primitive animal in the world is better than the biggest, most expensive, most intelligent robot at solving the "don't get stuck behind the couch" problem.
Whenever I meet an AI worker showing off their robot, I ask them "if you let that loose in my lounge, how long would it last before it got stuck behing the couch?". And then they beging to look sheepish. For 40 years, AI workers (most but not all) have argued that bigger, better, faster computers with more intelligent algorithms are the answer. They haven't been in the past and I see no obvious solution just around the corner.
I think that working out how to live with a brain the size of a sandgrain is a lot more interesting than working out how to tell a photo of a chair from a photo of a table. I've worked on the latter and I reckon it's an easy problem compared with "don't get stuck behind the couch".
The Ladybot is the simplest programmable robot I've made. It's just a teach-and-replay bot.
You'd think it would be so simple, there wouldn't be any design issues. Well, there are a couple. You can get more functions if you press pairs of buttons. Should the robot "play" while it "records"?
There are four buttons for motion: forward, spin-left, spin-right, backwards. Pressing pairs of buttons produces other actions: forward-left, backwards-right, etc. The motors are turned on for a fixed time.
Pressing the Go button replays the recorded sequence just once. The robot starts in Record mode.
Pressing the Go button with the forward or backward button produces a beep.
If the bot is left turned-on, it will beep every few minutes to remind you to turn it off.
It wasn't clear whether the bot should "enact" the steps as they're recorded. I like it to do so. Other people like to record steps without them being enacted. So I made it so you could decide the mode by holding down a button while turning on the bot.
Having built the Ladybot, I immediatelt thought: could the buttons also be used as sensors? That leads us on to ...
The Sensorbot is a step up in complexity from the Ladybot - it has sensors.
Four bump switches act as bumpsensors. In "Record" mode, they also replace the four motor buttons of the Ladybot. The switches on the left control the left motor forward/backward and the switches on the right control the right motor.
There is a single middle button but it does not act as a Go button. Switching the robot on starts running the program - it is in "Run" mode. The bot's main program runs continuously. Switching the robot on with the middle button held down puts the robot into "Record" mode.
But how can you program the robot to respond to its sensors?
When a sensor is triggered, an "Event Handler" starts to run. The SensorBot performs an Event sequence just once then returns to running the main program repeatedly.
In Record mode, if you hold down one of the bump sensors for a second, the robot beeps and you are now recording the motor response to that Event. It's a fairly intuitive way of telling a robot how to respond.
The SensorBot can also respond to Light and Dark. The light levels which correspond to "Light" and "Dark" are set by potentiometers.
The Brainibot is the smallest of my robots that is prgrammable from a PC. It has three sensors: two antennae and a light sensor.
The instructions are each 4-bits wide so two fit into a byte. (There are a few 8-bit instructions.) The program fits into the 128 bytes of user memory on the small PIC chip.
The language is block-structured and has no variables. You create and edit it entirely by clicking with the mouse. As you can see, there is some syntax highlighting.
You can download a copy of the programming system.
The Brainibot is sometimes used to teach classes when there is no computer present so it is also possible to write and edit programs via the antennae. For instance, to add the Forward-Left instruction, you would click the antennae Left-Left-Left-Right. A built-in editor lets you read-back the program (you hear various beeps), and add or delete instructions by clicking the antennae.
There's even a run-time debugger of sorts. You can get the Brainibot to tell you which instruction it is currently executing.
The Picobotz is the next stage up from the Brainibot. It has an IR obstacle detector, a light-level sensor, a line-follower sensor and a microphone.
It can only be programmed from a PC. If you want to try out the programming system, you can download it.
I felt that the 4-bit instruction-set of the Brainibot wasn't quite right so with the Picobotz, I went for a 6-bit instruction-set.
The point-and-click editor and the language are very similar to that of the Brainibot but the way it responds to sensor input is different.
The Brainibot responds to sensors with traditional if...then...else boolean tests. The problem with that is that the program may be doing something else and may not be executing the if...then...else. So, in addition, the Picobotz language has Events (like the Sensorbot).
The Main program repeats continuously. An Event can be triggered at any time by sensor input; it then runs once. The Main program then restarts (from the start). So an Event is rather like an interrupt.
While the Picobotz is connected to the computer, it sends data from its sensors. The PC shows the result as scrolling charts.
The Brainiborg is a very primitive walking robot. It has two IR obstacle detectors, two light-level sensors and can monitor the current in its motors to see if they've stalled.
The programming system is almost identical to the Picobotz. You can download a copy.
The only real difference is that the the editor is point-and-click but it is producing actual text. Personally, I find a text editor much easier to use.
To make it easier to develop gaits, you can single-step the program or send direct commands to the leg motors.
Once again, the PC can display charts of the sensors and motor currents.
The IR Brainibot is a replacement for the classic Brainibot. It has two IR obstacle detectors and two light-level sensors (compared with the Brainibot's two antennae and one light sensor).
The programming system is copied from the Brainiborg bit it has the if and while tests removed. Sensors can only be tested by using Events. You can download a copy of the programming system.
The language has an extra feature: "Behaviours". The BrainBot, Picobotz and Brainiborg can only carry out a single task. From talking with people who use BrainBots for education, is seemed they wanted to present "missions" like head towards the light until you hit a wall then turn right and follow the wall until it stops then ...". They needed to be able to program a sequence of different behaviours.
A Behaviour is like a complete program. Imagine different Behaviours on different sheets of paper. In responding to an Event, you can select a new Behaviour to run.
The IR Brainibot also introduced a single variable called 'N'. 'N' is used as a parameter for some instructions. It makes the instruction set more compact and orthogonal.
As usual, you can single-step the program and display charts of the sensors values.
I then changed tack completely and started thinking about how to control servos. Sure, there are plenty of servo controllers around but they aren't programming languages. They can't respond to sensors.
The first servo robot I built was a 4-servo biped. A 4-servo biped is a good place to start because you can treat each servo independently - they don't have to move in a coordinated manner. Brainibiped has two IR obstacle detectors and two light-level sensors taken from the IR Brainibot.
With the BrainiBiped, I started a completely new family of languages. The languages started off primitive and have progressed a little. You can download a copy of the programming system.
The user's program is held in the processor's main memory which means it can be more than 1k bytes long. Each instruction is 4 bytes long (i.e. the number of servos). The most important instruction simply sends those 4 byte values to the servos as the new target position. The robot moves the servos to the new position at constant fixed speed.
Other instructions measure the sensor values and allow if sensorvalue > const goto label. The are also goto statements and labels and commands to make beeps, sleep, etc.
That's it, it's a very simple language.
The innovation is in the IDE. The IDE allows you to nudge the servos to a position you like then press a button to add that position to the user's program. It's very quick and easy to create a sequence of positions to make the robot walk and turn.
The user's program can be created and edited as text but you can click buttons to insert syntacally correct statements into the text window.
You can test a sequence by running it on the IDE computer - either single-stepped or at full speed. The IDE reads servo commands from the user's PC and sends them to the robot. The robot tells thePC when it has finished moving the servos and the PC sends the next command. The PC can test sensor values and jump accordingly.
So it's very quick and easy to develop a program. Once its works, it can be downloaded into the robot and the robot will run it as a stand-alone program.
There is no scrolling chart of sensor values but the values are shown as small bars in the main window.
The BrainiBiped's processor monitors the servo currents and turns off the servos if they are jammed.
The Arm is a small, simple robot arm with 4 DOF and a gripper. It as two sensors: one to detect if there is an object between the fingers and another to measure the colour of the object.
The programming system is very similar to that of the BrainiBiped but the program can be displayed as a flowchart or as text. You can download a copy of the programming system.
As in the Brainibiped, the PC-program acts as a teach-and-replay sequencer. You press buttons (on the left of the screen above) to move the servos then, when you have a position you like, press a button to add it to the "user program". The program can also contain if ... goto and Goto commands.
The Arms instructions are each 5 bytes long - one byte per servo.
The Quadruped has four legs (naturally!) each with 3 DOF. That's a total of 12 servos. It doesn't yet have any sensors but it will eventually get some like the BrainiBiped.
At first sight, it appears similar to the BrainiBiped but it contains a new problem. There are a lot more servos and they have to move in a coordinated manner.
The programming system is similar to the Brainibiped and Arm but the language is completely different. You can download a copy of the programming system.
The Brainibiped has 4 servos and 4-byte instructions. The Arm has 5 servos and 5-byte instructions. That really isn't going to work for the Quadruped's 12 servos.
A simple BASIC like language is compiled into interpreted instructions. Each instruction is 3 bytes long. The BASIC has 26 8-bit variables: 'a'..'z' and can perform simple arithmetic and comparisons using 'Zero' and 'Carry' flags. It's not elegant to do comparisons that way and I'll probably add some syntactic sugar later.
Servo[n]=exp,v assigns a new target position, exp, to servo n. 'v' is the velocity that the servo should move at to the target position. If 'v' is zero then the servo moves there instantly (or as fast as the motor can turn). The BrainiBiped always moves its servos at constant speed (less than their maximum) but a quadruped walker needs to maintain balance by coordinating all its feet.
As usual, the IDE can send individual commands to nudge the Quadruped's servos. It can single-step through the user's program or can run it at full speed. When the program is working well, it is downloaded to the robot and run stand-alone.
Questions or comments ? E-mail me at email@example.com
No part of this web page may be reproduced in any form or by any means, including photocopying and recording, for any purpose without the express written permission of Analogue Information Systems Ltd.
This web page is copyright © 2008 Analogue Information Systems Ltd., 1 Warrender Park Crescent, Edinburgh EH9 1DX, Scotland, UK, Tel: +44 (0) 131 228 6008. All Rights Reserved