Tutorial.RobotLineFollowing History

Hide minor edits - Show changes to markup

May 18, 2013, at 07:58 AM by Scott Fitzgerald -
Changed lines 39-111 from:
to:
May 18, 2013, at 07:57 AM by Scott Fitzgerald -
Changed lines 116-121 from:

The Robot has five infrared sensors at the bottom, those will send invisible light to the floor and detect what the reflection is. That information will be used to decide whether to continue straight or to correct the wheels' speeds because of the line turning to one or the other direction.

Hint

The robot has a special feature, when detecting a black shape covering all the five sensors at once, it will stop. Use this feature to draw your tracks with a places will the robot will stop to perform actions.

to:

The Robot has five infrared sensors on the bottom of the motor board that detect where light reflects back. That information is be used to decide whether to continue straight or to change the wheel speeds to turn.

Stopping

When the robot detects a black shape covering all the five sensors at once, it will stop. Use this feature to create tracks for the robot to stop and perform actions.

May 17, 2013, at 09:38 AM by Scott Fitzgerald -
May 17, 2013, at 09:37 AM by Scott Fitzgerald -
Changed lines 5-8 from:

Take a large paper (you can also make one by taping smaller pieces together) and draw a shape on it using a thick black marker. This will be your racing track.

Put the robot on top of the line and turn it on. It will first scan the floor to detect the line and directly after it will start following it.

to:

Take a large piece of paper (or tape smaller pieces together to make a big one) and draw a shape on it using a thick black marker. This shape will be your racing track.

Put the robot on top of the line and turn it on. It will scan the floor to detect the line. When it finds the line, it will start following it the path.

Changed line 14 from:
  • Large paper
to:
  • Large piece of white paper
Changed line 16 from:
  • Paper tape
to:
  • tape
Changed lines 20-21 from:
  1. Prepare the track. Draw a thick line on the paper, make sure the ends of the line goes together. Use multiple pieces of paper if one is not big enough. The line should be around 3cm wide.
  2. Tape the paper to a flat surface, preferably on the ground, so the robot will not accidentally drop off heights. The surface should have light colour.
to:
  1. Prepare the track. Draw a thick line on soem white paper, making sure the ends of the line goes together. Use multiple pieces of paper if one is not big enough. The line should be around 3cm (1 inch) wide.
  2. Tape the paper to the ground so the robot will not cause the paper to slip. The surface should have light color.
Changed lines 23-26 from:
  1. Place the robot on the track, so it's heading along the line.
  2. After the starting screen, the robot will first calibrate itself. It'll wag around a few times, detecting colour of the line.
  3. Then the robot will start following the line. If everything goes OK, it'll be continuously going around the track. If the robot goes out of the track, see lineFollowConfig() for details about how to calibrate it.
to:
  1. Place the robot on the track, so it is facing down the line.
  2. After the starting screen, the robot will calibrate itself. It'll wag around a few times, detecting the line.
  3. The robot will start following the line. If everything goes OK, it'll be continuously going around the track. If the robot goes off the line, see lineFollowConfig() for details about how to calibrate it.
May 15, 2013, at 01:02 PM by Scott Fitzgerald -
Deleted lines 37-38:

First, explain the code line by line

Changed lines 40-110 from:

place the actual code in here

to:

/* Robot Line Follow

 This sketch demonstrates the line following capabilities
 of the Arduino Robot. On the floor, place some black 
 electrical tape along the path you wish the robot to follow.
 To indicate a stopping point, place another piece of tape
 perpendicular to the path.

 Circuit:
 * Arduino Robot

 created 1 May 2013
 by X. Yang
 modified 12 May 2013
 by D. Cuartielles

 This example is in the public domain
 */

  1. include <ArduinoRobot.h> // include the robot library

long timerOrigin; // used for counting elapsed time

void setup() {

  // initialize the Robot, SD card, display, and speaker 
  Robot.begin();
  Robot.beginTFT();
  Robot.beginSD();
  Robot.beginSpeaker();

  // show the logots on the TFT screen
  Robot.displayLogos();

  Robot.drawBMP("lf.bmp", 0, 0); // display background image

  // These are some general values that work for line following 
  Robot.lineFollowConfig(11, 5, 50, 10);

  //set the motor board into line-follow mode
  Robot.setMode(MODE_LINE_FOLLOW);  

  Robot.playFile("chase.sqm");  // play a song from the SD card

  // add the instructions
  Robot.text("Line Following\n\n place the robot on\n the track and \n see it run", 5, 5);
  Robot.text("Press the middle\n button to start...", 5, 61);
  Robot.waitContinue();

  // start
  Robot.fill(255, 255, 255);
  Robot.stroke(255, 255, 255);
  Robot.rect(0, 0, 128, 80); // erase the previous text
  Robot.stroke(0, 0, 0);
  Robot.text("Start", 5, 5);

  Robot.stroke(0, 0, 0); // choose color for the text
  Robot.text("Time passed:", 5, 21); // write some text to the screen

  timerOrigin=millis(); // keep track of the elapsed time

  while(!Robot.isActionDone()) {  //wait for the finish signal
    Robot.debugPrint(millis()-timerOrigin, 5, 29);  // show how much time has passed
  }

  Robot.stroke(0, 0, 0);  
  Robot.text("Done!", 5, 45);

} void loop() {

  //nothing here, the program only runs once. Reset the robot 
  //to do it again!

}

May 10, 2013, at 12:51 PM by Xun Yang -
Changed lines 25-26 from:
  1. Then the robot will start following the line. If everything goes OK, it'll be continuously going around the track. If the robot goes out of the track, see [/Reference/RobotLineFollowConfig|lineFollowConfig]() for details about how to calibrate it.
to:
  1. Then the robot will start following the line. If everything goes OK, it'll be continuously going around the track. If the robot goes out of the track, see lineFollowConfig() for details about how to calibrate it.
May 10, 2013, at 12:51 PM by Xun Yang -
Added line 16:
  • Paper tape
Added lines 19-26:

Instruction

  1. Prepare the track. Draw a thick line on the paper, make sure the ends of the line goes together. Use multiple pieces of paper if one is not big enough. The line should be around 3cm wide.
  2. Tape the paper to a flat surface, preferably on the ground, so the robot will not accidentally drop off heights. The surface should have light colour.
  3. Upload the example, unplug USB and turn on power.
  4. Place the robot on the track, so it's heading along the line.
  5. After the starting screen, the robot will first calibrate itself. It'll wag around a few times, detecting colour of the line.
  6. Then the robot will start following the line. If everything goes OK, it'll be continuously going around the track. If the robot goes out of the track, see [/Reference/RobotLineFollowConfig|lineFollowConfig]() for details about how to calibrate it.
May 03, 2013, at 11:34 AM by Xun Yang -
Changed lines 1-2 from:

Examples > Lottie Lemon?

to:

Examples > Robot

Changed line 46 from:
to:
May 03, 2013, at 06:38 AM by David Cuartielles -
Added lines 1-46:

Share