Robotics

This lab will introduce you to the field of Robotics.  Robotics is a field that combines Artificial Intelligence with Engineering.  To do this lab you will be experimenting with the LEGO® MINDSTORM NXT robot.  You will need to include in your report a copy of all tables and observations, and a copy of all your NXT programs

 

At the end of this lab you should be able to answer the following questions in your Observations and Conclusions sections of your lab report.

·         How does a robot differ from other computing machines, such as your lab computer?

 

·         How does a robot sense and react to its environment?

 

·         What are some current robot applications?

 

Introduction:

The idea of the robot, entering our lives, and by doing so, saving us from the mundane chores of daily life, has captured the fancy of many of us.  How many of us have admired Rosie, the robot maid made famous in the classic cartoon, The Jetsons, and wished she lived at our home? 

rosie.jpg    502-r2d2.jpg    C3PO.jpg

How would you like R2D2 or C3PO help you with your problems?  On the other side of the fence we have the Cylons from the TV series Battlestar Galactica and HAL the robot in the movie 2001 a space odyssey as examples of what can happen when robots go wrong. (To see a video of HAL click here.)  The robots of science fiction have engaged scientists and robotocists to create robots that approach our dreams.  But this begs the question, what is a robot?

The term robot is actually derived from the Czech word robota which means forced or menial labor.  It was first used by the Czech playwright Karel Capek, in his play R.U.R. (Rossum's Universal Robots).  In Karel’s play the robots acquire emotions and then plot to overthrow the humans.  The struggle between humans and robots has been a familiar theme in science fiction.  Isaac Asimov tried to look at robots from a less menacing point of view.  He developed the three laws of robotics, later adding a zeroth law that put bounds on ethical robotic behavior.  His laws were as follows:

Law Zero: A robot may not injure humanity, or, through inaction, allow humanity to come to harm.

Law One: A robot may not injure a human being, or, through inaction, allow a human being to come to harm, unless this would violate a higher order law.

Law Two: A robot must obey orders given it by human beings, except where such orders would conflict with a higher order law.

Law Three: A robot must protect its own existence as long as such protection does not conflict with a higher order law.

Currently, there has been much philosophical discussion about the military use of robots, since most of these uses violate the three laws. 

Finding a rigorous definition of what constitutes a robot is not as easy as one might think.  According to Rodney Brooks, the director of the Massachusetts Institute of Technology’s Computer Science and Artificial Intelligence laboratory, a robot is “something that senses the world in some way, does some sort of computation, deciding what to do, and then acts on the world outside itself as a result."  Gregory Dudek, the director of the Centre for Intelligent Machines at McGill University in Montreal thinks an entity needs to meet three criteria in order to be considered a robot.  It needs to be able to measure the world, make decisions, and take actions.  Probably the best definition of a robot was given by Joseph Engelberger, who is by some considered to be the father of robotics, “I can't define a robot, but I know one when I see one." 

How would you define a robot?

Notwithstanding, today, robots have been developed to help in manufacturing, explore Mars, assist the elderly, search for disaster victims and more.  Although not as sophisticated as Rosie, Professor Imberman swears by her Roomba Robot Vacuum.  The robot lives in her family room, along with her three VERY messy birds.  Each night at midnight, the robot disengages herself from her charging station and proceeds to vacuum all the seeds and shells thrown out of the three bird cages.  When she runs low on battery power, Roomba finds her way back to her charging station to charge until the next evening.  The Roomba, created by iRobot, is the first commercially successful robot built, with over 2 million sold. 

IMG_0610.JPG    IMG_0612.JPG

Going my way?

Roomba cleans while 2 out if 3 birds watch!

 

 

There are many current robot applications.  Use the internet to find one and describe the robot, what the robot does, and how successful the robot is.  Include a picture of the robot.

In this lab you are going to program a robot so that it will be able to explore Mars.  Have fun!!!

Robotic Investigations:

Where To Start!!

Let’s first look at the NXT brick.

 

 

 

  This diagram was taken from the Caitlin Gabel Robotics NXT tutorial,

 http://www.team1540.org/ext/?url=http://cgsweb.catlin.edu/msrobotics

 

 

 

 

 

Double click the MINDSTORMS  NXT icon on your desktop to start the NXT software.

To begin a new NXT program, type in the name of your program into the Start New Program text box.  Call your program gobotgo.  Then click on the Go>> button in the Start New Program box. 

 

After pressing the Go>> button, your screen should look like this:

GO BOT GO!!

The icons on the left side of your screen comprise what is known as the “Common Palette”.  The Common Palette contains most of the common behaviors you can use to program into the NXT. 

To write an NXT program you drag a block icon onto the gray grid area. 

Move your cursor over the top icon.  This is the move icon.  Click on the icon and a move block will appear.

 

 

Place the move block into the blue start position.

 

 

When we select the block by placing the cursor over the block, you will notice that the bottom part of the screen displays the settings for that block. 

Notice that Port B and C’s radio buttons are selected.  This means that the motors are connected into ports B and C on the NXT brick.  If the motors aren’t connected as such, please reconnect the motors correctly.

The direction the robot will go is forward.  This is indicated by the up    arrow’s radio button being selected. 

The power setting is at 75% of full power. 

Connect your robot to the computer using the USB cable provided into NXT’s USB port. 

IMG_0574

Download this program into your NXT.  Press the orange button on the NXT to turn the robot on.  To download a program, click the download arrow located in the lower right of the gray grid.  The arrow will be highlighted in orange when selected. 


 

Now you can run your program. 

 

DSC01456

 

 

 

a. Place your robot on the floor.  Select My Files from the NXT menu by pressing the orange button.

 

DSC01457

 

 

 

b. Select Software Files

DSC01465b

 

 

 

c. Select gobotgo

DSC01466b

 

 

 

 

d. Select run

Text Box: To stop robot programDSC01467b

 

 

 

e. If you need to stop your program, press the dark gray back button.

 

 

What did your program do?

When you move your cursor onto the motor icon in your program it becomes highlighted in blue. 

 

 

You can see information about the motor icon on the move panel in the lower part of the screen.  The Port radio buttons indicate which ports the motors are plugged into.  The Direction radio buttons controls how the robot moves.  The              button stops the motors. 

 

Click on the down arrow’s      radio button.  Download and run the program.  What does your robot do? 

Click on the up arrow’s     radio button.  Download and run the program.  What does your robot do? 

The Steering slider controls right and left movement.  The C motor is on the robot’s left.  Move the slider all the way to the left. 

Download and run the program.  What does your robot do? 

 

Move the slider all the way to the right.  Download and run the program.  What does your robot do? 

 

The Power selection box shows how much power goes to each motor.  The Duration pull down menu controls how long the motors run.  Experiment with each.

 

What is the difference between Time, Rotation or Degrees?

 

Unlimited will run the motors until you add another motor block to stop it.

 

You can add more than one block to a program. 

 

Add a second move block to your program.  Download and run the program.  What does your robot do? 

 

Going Loopy

 

It’s nice to add a lot of move blocks to your program but this can become quite tedious

 

 Using a loop block will allow the blocks placed inside the block to continually repeat.


 


 

 

 

Click on the loop block.

 

 

 

 

Move the loop block onto the sequence beam.


 

 

 

 

Now we are going to drag the two move blocks inside the loop.  Select the blocks by first placing your mouse on the grid above and to the left of the blocks. Holding down your left mouse button, select the blocks.  As you do so, a turquoise rectangle will surround the blocks.

 

 

 

 

When you release the mouse button, the blocks will be edged in turquoise. 

 

 

You can now drag the blocks inside the loop.  Download and run this program.  What does your robot do?  Remember to stop your program, press the dark gray back button.

 

 

Modify the move blocks inside your loop so that your robot moves in a square.  Show your running program to your professor and have him/her initialize your Robo Checkoff Sheet.  Use the File and Print options from the main menu bar to print your program.  Include this printout in your lab report.

 

Sensitivity

 

It is nice to make a robot move, but robots show their real intelligence by sensing and reacting to their environment.  Your robot is equipped with four different sensors.    Click on Help and then Contents and Index to bring up the NXT help menus.  Use the help menu to fill in the following chart with each sensor’s function.

 

LIGHT_SENSOR

Light Sensor

SONIC_SENSOR

Ultrasonic Sensor

SOUND_SENSOR

Sound Sensor

TOUCH_SENSOR

Touch Sensor

 

 

We are going to work with the light sensor.

 

Different environments can cause the sensor to give different readings.  That is why we sometimes need to adjust the sensors to the environment they are used in.  For example, a classroom with the room lights on is going to have a different level of surrounding light than when the lights are turned off.  This is called calibrating the sensors.

 

Follow the directions from the help menu and calibrate the light sensor.  Remember to change the port to 3 since our light sensors are connected to port 3.  Use the black paper provided for your min value, and the white paper for your max value.

 

Save and Close the gobotgo program.

 

To close the program click on the x

 

 

 

 

 

 

 

Start a new program by typing Findblack in the Start New Program box.

 

 

 

 

 

Select a light sensor block and move it to the start block.


 

 

 

 

 

 

 

 

 

 

 

 

 

Download this program into your robot but DO NOT disconnect your robot from the computer.

 

Select the light sensor by moving your cursor over it

 

The values that the light sensor reads are visible here.

 

 

 

 

What readings do you get from a white piece of paper?, A black piece of paper? Green?  Place two other objects of you own choosing under the sensor.  What were the objects and their readings?

 

If you want the robot to take some action based on a light reading, you need to adjust its until parameter.  For example, your black reading should have been close to zero.  If we change the relational operator to < and set the numeric threshold to 20, then this sensor will be set to find the color black.  What settings would you need to detect white?

 

 

Sound blocks are fun to play with. 

 

Move a sound block onto the sequence beam after the sensor block. 

 

Choose an appropriate sound file for your robot to play. 

 

Make sure your sensor is set to detect black.

Download and run this program, making sure you start the program while the robot’s light sensor is over white.  What happens when you move black under the sensor?

 

Modify your program by placing a move block on the sequence beam BEFORE the sensor block.  Set the duration to continuous.

 

Download and run this program on the black stripped road.  What did your robot do?

To get your robot to “stop on a dime”, add a move block AFTER the sensor block, setting its direction to

 

Download and run this program on the black striped road.  What did your robot do?

Now modify your program so that it detects all the black lines on the road.  Hint:  You will need to use a loop.  You may also need to add another move block to nudge your robot past a line it has already read.  Show your running program to your professor and have him/her initialize your Robo Checkoff Sheet.  Print out and hand in the program with your lab report.

 

Exploring Mars

 

You have landed a robot on Mars!!.  The robot now sits on a Martian plateau.  Your mission is to program the robot so that it continually explores the plateau, without falling off.   Your instructor will provide you with a suitable Martian landscape;   it consists of white foam board bordered in black.  If your robot’s wheels touch the black surface, it is considered to have fallen off the plateau.

 

Show your running program to your professor and have him/her initialize your Robo Checkoff Sheet.  Print out and hand in the program with your lab report

Have more fun!!! 

 

Since 1964 the US has successfully landed robots on Mars that explored and photographed the Martian Landscape.  Choose one of these robots and compare it to your robot. 

1.    How are the robots structurally alike? Different?

2.    What types of sensors did this robot need to explore Mars?

3.    What navigation problems did the robot have to solve?  How was this similar to how your robot navigated?

Below are several links that can help you with this.

 

http://phoenix.lpl.arizona.edu  Phoenix mars rover just launched

http://marsprogram.jpl.nasa.gov/missions/past/pathfinder.html pathfinder mission, sojourner

http://marsprogram.jpl.nasa.gov/MPF/roversci/site-map-Image.html map of sojourner’s path with clickable pictures of mars

http://pancam.astro.cornell.edu/pancam_instrument/index.html color photos from spirit and opportunity

 

Extra Credit – Finding life on Mars

 

One of the more powerful programming constructs allows the robot to take two different courses of action based on some event that it detects.  The robot does this using a switch block.  The switch block is the bottom block on the common palette.  Start a new robot program called decisions.  Select a switch block and place it onto the sequence beam.

 

 

 

The default sensor for the switch is the touch sensor.  Use the drop down menu and select the light sensor. 

 

 

Notice that inside the switch block there are two sequence beams.  The compare section determines which sequence beam is followed.  In this case when the light sensor reading is greater than 50, the top beam is executed.  If not, the bottom beam is executed.

Let’s say we wanted to have the robot tell us when it senses black or white.  Since the white reading us close to 100, we can set the threshold in the compare section to > 90.

 

Put a sound block on the top beam and set it to say “white.”

 

Put a sound block on the bottom beam and set it to say “black.”

 

Place this inside a loop.  Download and run the program.  What did your robot do when you placed a white sheet of paper under the sensor?, a black piece? A green piece of paper?

 

Your robot can’t distinguish black from green.   In order to do this we need to add another switch block.

 

Delete the bottom sound block.  Since black readings are close to zero, we can detect black by setting the threshold in the compare section to < 20.  Now when the robot senses black it will execute the top sequence beam in the second switch block.  Place a sound block on this sequence beam and have it say “black”.  Place a sound block on the bottom beam of the second switch block and have it say green.  Download and run your program.  Test it with white, black, and green paper.  What did your robot do?

 

Find life on Mars –

 

Add to your Mars exploration program so that it finds life on your Martian plateau.  Life is represented by the “little green men” on the white foam board background.  (We apologize to all Martians for the stereotyping.)  Once your robot finds life, it stops exploring and sends a signal
(a sound of your own choosing) to NASA.

 

Show your running program to your professor and have him/her initialize your Robo Checkoff Sheet.  Print out and hand in the program with your lab report

 

Written by Dr. Susan Imberman 

Copyright ã October 2007, All rights reserved