Ping-Pong Rally's On
Kieran Gupta, Kyle Kekelis, Truman Lam
Granada Hills High School
Oakland Technical High School
Lowell High School
COSMOS 2003: UC Davis, Cluster 5: July, 2003
Abstract
In this world today, technology is continually getting more advanced.
With the help of artificial intelligence long pain-staking labor has been
reduced to simple and easy tasks. For a long time people have dreaded
performing undesirable tasks, and robotics have been used to satisfy their
wants. However, many robotic prototypes are often expensive and difficult to
program, so, as a result, something had to be done. The solution was the
LEGO Mindstorms Robotics Invention System (RIS). This inexpensive and
easy-to-use robotics system was invented five years ago by an MIT research
lab. Having a variety of compilers, from simple click-and-drag based
software to NQC, LEGO Mindstorms allows for different levels of programming.
We devised an experiment involving three LEGO Mindstorm robots that could be
used to help the daily lives of people all around the world.
In this project, we use three different robots to perform the task of
moving three objects from Point A to Point B through communication. Each RCX
using their infrared receivers transmits raw readings from their sensors to
another RCX, which allows for easy cooperation. The objects that we will be
transporting are ping-pong balls. Each ping-pong ball will be a different
color (one white, one green, and one black) and will be sorted and placed in
their correct corresponding bin. To achieve this goal we have created a
robot that goes through a maze and gathers ping-pong balls, a robot that
moves these ping-pong balls from one robot to another, and another robot
that sorts the ping-pong balls into three cans. This paper includes the
programming involved in the task and additional comments including each
robots unique construction and design.
Introduction
All of mankind has often dreamed of creating completely autonomous robots
that can sufficiently accomplish some of the world's less-desirable tasks,
with little or no human intervention. Over the past years, many attempts
have been made at creating such robots, and many robot prototypes have been
developed. However the field was limited to scientists, and many of these
prototypes were extremely expensive and complicated. A solution had to be
made. Five years ago LEGO opened their new robots system to the public.
Designed by MIT (Massachusetts Institute of Technology), the LEGO Mindstorms
Robotics Invention System proved to be the perfect solution to the growing
need for affordable and easy-to-use artificial intelligence robots. This new
invention allowed children and adults to program and build their own robots
that could perform a multitude of tasks. The tasks varied from simple
backward and forward movements to more complex behavior based actions.
LEGOs were invented in the 1930s for children in Denmark, who had limited
recreational activities available during rainy days. Its name originated
from the German words "Leg" and "Godt," meaning, "play well." Gradually,
LEGO further developed their idea, and the LEGO TECHNIC system, which added
gears and pulleys to the easy to use platform, was created. The LEGO
Mindstorms were later developed and thus marked the beginning of affordable
AI systems.
The main component, or brain, of the RIS is the RCX (Robotic Command
Explorer) "brick". The programmable LEGO brick contains three sensor inputs
(for data input from touch sensors, light sensors, temperature sensors, and
rotation sensors), three sensor outputs (mainly used for motors), four user
buttons (to manually control the RCX), a simple LCD display (for limited
displayed information regarding the RCX's current status), an IR (infrared)
transceiver (for communication between PC and RCX), and a minicomputer with
32 kilobytes of RAM based on Hitachi H8 micro controller. As for
programming, there are a large variety of languages besides the standard
LEGO software used to program the RCX. The more popular include NQC (Not
Quite C), ROBOLAB, Python Robotics, and LEGOLOG.
Although the Robotics Invention System provides a great learning tool for
children it is also limited. The standard LEGO software, although visually
appealing, allows for only limited actions. In addition the RCX is subject
to the elements, which limits the environments it can function in. For
example, water is detrimental to the electrical components; therefore it is
only operational on land. Batteries also pose a problem. The removal of the
batteries during changing can easily erase the memory and when batteries
loose their charge, motors function differently. This could seriously affect
research experiments and programs.
We can, using the Mindstorms kit, build and program a "Rover-Bot",
"Crane-Bot", and "Sort-Bot" that can communicate and interact with each
other to transport ping-pong balls from one location to another without
human intervention.
In this paper, we present a unique network of three RCX robots "working"
in synchrony to accomplish a specific task. Each robot is assigned a certain
limited role, and when the actions of the three robots are united, the
robotic network should be able to successfully transport ping-pong balls
from a given area to a given dumping location, without any type of human
intervention. The specific robots described in this paper include a "Rover-Bot",
"Crane-Bot", and a "Sort-Bot". The Rover-Bot will seek out different color
ping-pong balls and then take them to the Crane-Bot who will pass them to
the Sort-Bot. Here the ping-pong balls are sorted by color and placed in
their respected cans.
Methods/Materials
It is necessary to follow precise steps in the creation of our three
robots. We created each robot with unique designs to perform specific tasks.
The first robot to function in our experiment is the "Rover-Bot." Resembling
the "Steer-Bot", the Rover-Bot has additional features that allow it to pick
up ping-pong balls with ease. The next robot that we will use in our
experiment is the "Crane-Bot". This robot functions as a stationary crane
and transfers ping-pong balls from our Rover-Bot to our next robot, the
"Sort-Bot". Our Sort-Bot's "sorter" will separate the ping-pong balls by
color and put them into one of three cans. The process will continue until
all three ping-pong balls are found and transported to their respected bins.
The Rover-Bot is one of the more agile and speedy of the three robots.
Designed to quickly seek out ping-pong balls in a maze, it moves smoothly
through its environment without running off course. This robot uses its
light sensor and the IR signal on its RCX to sense the objects before it
makes contact with them. In addition, due to its resemblance to the Steer-Bot,
the Rover-Bot will use "rack-and-pinion" steering, which is often used in
automobiles. Unlike other LEGO robots, this design uses one motor for
locomotion and another for steering. The largest difference between the
Rover-Bot and the Steer-Bot is its ping-pong holder and arm to gather and
move the ping-pong balls. The arm consists of one motor, which allows it to
pick up the balls and dump them on a track made of LEGOS. This track uses
its downward slope to transport the ping-pong balls into the behind
container without consuming energy. The container is small and therefore
limited to only one ping-pong ball at a time.
The programming for the robot is a little more complicated than that of
other robots, for it uses differentials, but it all pays off with its smooth
movements. Once an object is sensed, the robot will turn away from it in a
random direction and continue its function of searching for ping-pong balls.
The arm used to pick up the ping-pong balls will be like a scooper, for it
will scoop the ball into its ball-holder, located behind its RCX.
The next robot to function in this experiment is the "Crane-Bot". The
Crane-Bot consists of a large robotic arm and a stationary base. The large
base is constructed of the standard LEGO blocks with additional four wheels
on the underside for both grip and structure. The arm has four finger-like
structures with treads on the end allowing for superior grip. Although this
allows for the transportation of large objects it must use a pulley system
rather than a gear system to move up and down. A structure protrudes in the
other direction of the arm, which allows for counter balance and is also the
location of the motor and string. Its remarkable design allows for both
balance and considerably smooth movements (considering its weight) from one
location to another. All three motors are utilized in its main task. The
first motor is used for the opening and closing of the claws around the
ping-pong balls. The second motor is used for the up and down motions of the
robotic arm. Lastly, the third motor is used to swivel around the base
allowing for a full 360-degree rotation. In addition there are light sensors
that allows it to easily interact with the other two robots. The main
function of the Crane-Bot is to collect ping-pong balls from the Rover-Bot
and transport them to the Sort-Bot.
The Sort-Bot is the last to participate in this experiment. Following the
Crane-Bot’s transferring of ping-pong balls, the Sort-Bot uses its "sorting
capabilities" to place the ball into one of three cans. The Main structure,
which rests on a large platform base, is tilted which allows the ping-pong
ball to move without the consumption energy. The track changes using LEGO
arm-like pieces to direct the movement of each ping-pong ball corresponding
to its specific color. At the end of each track there are little cans made
of LEGOS, which stores each ping-pong ball. A yellow ball would go straight
and enter the can labeled "Green-Can". A blue ball would go to the right and
into a can labeled "White-Can". A black ball would continue down the track
and then drop into the last can labeled "Black-Can". When all three
ping-pong balls are sorted, the robot will stop.
Together, the Rover-Bot, the Crane-Bot, and the Sort-Bot will work and
communicate with each other to move and sort the three ping-pong balls from
point A to point B without human intervention.
Results and Conclusion
The results for this experiment proved that our hypothesis was incorrect.
The Rover-Bot did not move toward the ping-pong ball. The Rover-Bot was
unable to go through the maze due to the poor lighting conditions. As a
result, even with RAW values, the Rover-Bot could not distinguish between a
ping-pong ball and a wall. In addition we had problems with the
communication between the Crane-Bot and the Sort-Bot. They did communicate
but it was necessary for a human to continually press the run button in
order to place the ball into its designated can. Batteries and inconsistent
movements also proved to be a problem. The movements of the Crane-Bot were
timed and thus any small change would cause its task to become very
inaccurate.
The maze for the Rover-Bot was a spiral. The robot needed to only turn
left, so every time it sensed a wall, it should have turned left. The
materials used to build the maze were mostly colored paper sheets. The light
sensor was unable to tell the difference between the sheets. The IR signal,
located on the RCX, went right through the paper walls. We managed to make
the Rover-bot scoop the ping-pong ball, but that was only after 10
unsuccessful tries, and we did not have enough time to complete the program.
As a result, this aspect of the project was unsuccessful.
The Crane-Bot also had its problems. We succeeded in sending a message to
the Sort-Bot but the Sort-Bot could only complete its tasks by pressing run,
thus making our robots not completely autonomous. The Crane-Bot could
complete its tasks with a little more programming but it was quite difficult
to keep all variables consistent. In addition the Crane-Bot could only move
clockwise but this did not prevent it from performing its task. The robotic
arm did succeed in reading the color of each ping-pong ball and send its raw
reading to the Sort-Bot allowing it to make specific modifications before
the ping-pong ball reached it. Once the ping-pong ball finally arrived at
the Sort-Bot, after numerous attempts, the ping-pong ball was able to reach
its designated can. The Sort-Bot proved to have the least problems. Its
design was ingenious and could have easily performed flawlessly if the other
robots worked properly.
Unfortunately our robots could not be completed due to the lack of time.
We were allotted only one week to complete our robots and program them. We
believe that if we were given more time we could have finished the project
and present our experiment flawlessly in Freeborn Hall.
Unfortunately, we did not have the time to fix all of the errors in the
construction of the Rover-Bot and the Crane-Bot. The Rover-Bot had problems
colleting the ping-pong balls without a barrier to push up against. In
addition paper was used to create the mechanism to collect the ping-pong
balls. Despite the fact that it worked it was not very efficient. The Crane-Bot
also had its problems. Due to its large mass it had difficultly rotating
around its center axis and could only move clockwise. Despite these small
problems the designs could have beautifully if more time was given.
Source Code
ROVER-BOT
#define EYE SENSOR_3
#define DRIVE OUT_B
#define STRAIGHT_TIME 50
#define BACK_EYE SENSOR_2
#define CENTER SENSOR_1
#define STEER OUT_A
#define FULL_TURN_TIME 50
#define SHOVEL OUT_C
void left()
{
Fwd(STEER);
OnFor(STEER, FULL_TURN_TIME);
}
void right()
{
Rev(STEER);
OnFor(STEER,FULL_TURN_TIME);
}
void center()
{
Toggle(STEER);
On(STEER);
until(CENTER==0);
Off(STEER);
}
void pickup()
{
OnFwd(DRIVE);
Wait(50);
OnFwd(SHOVEL);
Wait(50);
Rev(SHOVEL);
}
int corners;
task amp()
{
SetTxPower(TX_POWER_HI);
while(true)
{
SendMessage(85);
}
}
task foo()
{
corners=0;
while(true)
{
OnFwd(DRIVE);
if(EYE<=528)
{
left();
corners += 1;
}
}
}
int i;
task main()
{
SetSensorType(EYE,SENSOR_LIGHT);
SetSensorMode(EYE,SENSOR_MODE_RAW);
while(true)
{
start foo;
if(EYE<=529)
{
stop foo;
pickup();
PlaySound(SOUND_UP);
center();
Rev(DRIVE);
for(i=0; i< corners ; i++)
{
if(BACK_EYE==530)
{
right();
}
else if(BACK_EYE>=1000)
{
Rev(DRIVE);
Wait(200);
}
}
}
}
}
CRANE-BOT
// CraneBot.nqc
// Final Project Robot 1
// Navigate maze to reach three ping-pong balls at the end
#define TURN_MOTOR OUT_A
#define CLAW_MOTOR OUT_B
#define LIFT_MOTOR OUT_C
#define LIGHT SENSOR_2
#define COUNTERCLOCK SENSOR_1
#define CLOCK SENSOR_3
// NOTES
// Motor A - turn crane around
// Motor B - opens/closes claws
// Motor C - lift/lowers crane
#define BLOCK_TIME
task main()
{
SetSensorType (SENSOR_2, SENSOR_TYPE_LIGHT);
SetSensorMode (SENSOR_2, SENSOR_MODE_RAW);
SetSensor (SENSOR_1, SENSOR_TOUCH); //Counter clockwise sensor
SetSensor (SENSOR_3, SENSOR_TOUCH); //Clockwise sensor
OnFwd (TURN_MOTOR); // turn counter clockwise until hit sensoe
until (COUNTERCLOCK == 1);
Off (TURN_MOTOR);
lift();
claw();
lift2();
OnRev (TURN_MOTOR); //turn clockwise until hit sensor
until (CLOCK == 1);
Off (TURN_MOTOR;
lift3();
claw2();
}
void lift()
{
OnRev (LIFT_MOTOR);
Wait (645);
Off (LIFT_MOTOR);
}
void detect() //detects colors of balls and transmits message to other
RCX
{
while(true)
{
if (LIGHT > 725 && LIGHT < 740) //white
{
SendMessage(1);
PlaySound (SOUND_UP);
}
else if (LIGHT > 880 && LIGHT < 900) //black
{
SendMessage(2);
PlaySound (SOUND_DOWN);
}
else if (LIGHT > 760 && LIGHT < 790) //orange
{
SendMessage(3);
PlayTone (440, 50);
}
}
}
void claw()
{
OnRev (CLAW_MOTOR);
Wait (75);
Off (CLAW_MOTOR);
}
void lift2()
{
OnFwd (LIFT_MOTOR);
Wait (650);
Off (LIFT_MOTOR);
}
void lift3()
{
OnRev (LIFT_MOTOR);
Wait (160);
Off (LIFT_MOTOR);
}
void claw2()
{
OnFwd (CLAW_MOTOR);
Wait (50);
Off (CLAW_MOTOR);
}
void calibrate()
{
OnFwd (LIFT_MOTOR);
Wait(800);
Off (LIFT_MOTOR);
}
SORT-BOT
#define GREEN OUT_A
#define WHITE OUT_C
#define WhiteTouch SENSOR_3
#define GreenTouch SENSOR_1
task main()
{
int x=Message();
SetSensor(WhiteTouch, SENSOR_TOUCH);
SetSensor(GreenTouch, SENSOR_TOUCH);
until(Message() !=0);
if(x==1) // White signal
{
OnRev(WHITE);
until(SENSOR_3==1);
Off(WHITE);
Wait(500);
OnFwd(WHITE);
Wait(10);
Off(WHITE);
}
else if(x==3) //Green signal
{
OnFwd(GREEN);
until(GreenTouch==1);
Off(GREEN);
Wait(500);
OnRev(GREEN);
Wait(10);
Off(GREEN);
}
//No operations are needed for the Black ball because no movements need
to be made
}