×

PC Control These demos and projects allow the robot to be controlled via a computer.

ArbotiX Commander Control - These demos and projects control the Robot using the ArbotiX Commander, the handheld Arduino based remote control.

Direct Control - These demos and projects control the Robot directly from sensors connected directly to the Robot's control board.

Pose Control - These demos and projects allow you to create and playback a sequence of poses.

Serial Control - These demos and projects control the robot using a serial packet protocol.

Standalone - These demos and projects are deisgned to let your robot function without a computer or additional microcontroller.

Wireless Control - These demos and projects allow you to control the robot wirelessly - usually by replacing the Serial Connection with XBee modules.

Reference - These articles have technical details regarding the control and operation of the robot.

×

More info here

Geekbot Demo 4 - Line Explorer

GB-built.jpg
mt_ignore
Pose Control

This demonstration shows how to run the Geekbot Line Explorer, which allows you to send your Geekbot on a predefined mission! Give your Geekbot turn-by-turn instructions in code, and it will comply to the letter! We will be building off of the lessons learned in the Simple Line Follower and Line Router demos, so if you haven't gone through them, it is advisable to go back and do those first. This is one of our most versatile demos, allowing you a great amount of control over the automated movements of the geekbot. Versions of this code will later be used to accomplish tasks when the geekbot receives a serial command over wifi! This code will give you access to the navigation elements for handling intersections with turn instructions, as well as timed driving elements that do not rely on the lines at all to drive forward, back, and turn clockwise and counter-clockwise. You can set the movement to be activated via a button press, or to begin when the geekbot is switched on.

Contents:
  1. Project Parts List
  2. Assemble your Geekbot
  3. Download the Sketch
  4. Configuration
  5. Coding the Movement Instructions

Project Parts List:

RobotGeek Geekbot Kit

Everything you'll need to get started with this demo is included in the RobotGeek Geekbot Kit! We'll be using the Sparkfun Line Follower Array and the RobotGeek LCD Control Panel on the standard Geekbot Base.

Assemble your Geekbot

Geekbot V3 Assembly Guide

Follow and complete the Geekbot V3 Assembly Guide, making sure to follow the directions for mounting the Line Follower Array and RobotGeek LCD Control Panel. If you haven't already done so, go through the Geekduino Getting Started Guide and the Geekbot Getting Started Guide.

Download the Sketch

Geekbot Sketches

A .zip file with all of the Geekbot Sketches can be found here.

If you haven't already done so, download and install the RobotGeek Libraries and Tools here.

Unzip the file and you will have a folder called geekbot-master We recommend that you find the RobotGeek Sketches folder in your Arduino user folder and put the geekbot-master in there. The rest of this guide will assume you've placed your sketches in the following folder.

  Arduino -> RobotGeek Sketches -> geekbot-master

This will be the same 'Arduino' folder you put your libraries and robotgeek tools in, and NOT the folder where the Arduino application is.

Open:

File -> Sketchbook -> RobotGeek Sketches -> geekbot-master -> Geekbot_V3 -> geekbotV3LineExplorer
and upload the code to your Geekduino.

Configuration

You'll need to place a black line on light flooring, or a white line on dark flooring for the geekbot to follow. A good test pattern is an infinity ∞ line. This gives you a single 4 way intersection that feeds back into itself, so you can make sure your geekbot is taking intersections If you have a light line on dark flooring, you'll have to set invert bits in the code. Check out line 51 in config.h:

const bool LINE_COLOR =  0;
For a dark line on light floor, change the 0 to 1. For a light line on a dark floor, keep LINE_COLOR set to 0

You'll need to put your lines down before coding your movement instructions.

Setting up intersections:

Intersections have been covered in Demo 3. If you need to revisit the instructions for setting up intersections, you can click here

You can adjust the trim on the fly with the Rotation Knob. If your geekbot is having trouble finding the line, you can adjust the sensitivity of the Line Following Array by turning the blue knob on it.

There are 3 parameters that can be changed easily in Config.h that affect your driving speed

const unsigned int DRIVE_SPEED         = 50;   //Forward/Reverse Driving Speed Value, 0-100
const unsigned int TURN_SPEED       = 50;   //Turning while Driving Speed, 0-100
const unsigned int ROTATE_SPEED     = 50;   //Turning in place (rotating) Speed, 0-100

These are values between 0 and 100, 0 being the slowest, 100 being the fastest, and each is clearly labeled. Changing the DRIVE_SPEED variable affects the speed at which the Geekbot drives forward. Changing the TURN_SPEED variable affects the speed at which the Geekbot turns while driving (affects how quickly the robot corrects to center during line following). Changing the ROTATE_SPEED variable affects the speed at which the Geekbot turns in place, changing how quickly it turns at intersections.

A nice little feature of the Geekbot in this code base is the ability to return home! If the geekbot sits in place for a minute, it will automatically return to where it came from. If you don't like this feature, you can comment it out on line 59:

#define AUTO_RETURN_HOME

There are also advanced parameters, from line 67-80. These affect more specific things in Motors.cpp and Motors.h, and most can be ignored for normal operation of the Geekbot. When changing the drive and rotate speeds, you will need to change the BLIND_DRIVE_TIME and BLIND_TURN_TIME variables on lines 79-80. At faster speeds, the geekbot will overshoot the line, at slower speeds, the geekbot may pick up the line it was already on, assuming it has found another.

Coding the Movement Instructions

Once you've laid down your tape, it's time to define your route! This is done in geekbotV3Explorer.ino. You will see in void loop():

void loop()
{

  playButtonState = digitalRead(LCD_PLAY_PIN);
  upButtonState = digitalRead(LCD_UP_PIN);
  downButtonState = digitalRead(LCD_DOWN_PIN);
  stopButtonState = digitalRead(LCD_STOP_PIN);
  
  if (playButtonState == LOW)
  {
  customFunction0();
  }  
  if (stopButtonState == LOW)
  {
  customFunction1();
  }  
  if (upButtonState == LOW)
  {
  customFunction2();
  }  
  if (downButtonState == LOW)
  {
  customFunction3();
  }
}
This is where we put all of our Function calls. If you load the code onto the Geekbot as is, you can follow along by pressing a button and reading the line of code that is being executed by the Geekbot! We put all of our instructions in the function so that we can call them up whenever we like! Let's take a look at customFunction0()

void customFunction0()
{
  myGeekBot.lineFollow(NAV_LEFT); //Follow Line until Intersection, state = NAV_CMD for next action.
  myGeekBot.lineFollow(NAV_FWD); //Follow Line until Intersection, state = NAV_CMD for next action.
  myGeekBot.lineFollow(NAV_RIGHT); //Follow Line until Intersection, state = NAV_CMD for next action.
  myGeekBot.lineFollow(NAV_UTURN); //Follow Line until Intersection, state = NAV_CMD for next action.
  myGeekBot.lineFollow(NAV_STOP); //Follow Line until Intersection, state = NAV_CMD for next action.
}

In this function, we go through all the standard instructions. This is the turning logic you can use to handle your paths. A normal path will utilize forward, left, and right commands throughout, and end with a Stop followed by a U-turn command. If you run the code as is, this section will run when you hit the Play Button on the RobotGeek LCD Control Panel. The geekbot accepts the following navigation commands:

    Insert these commands myGeekbot.lineFollow(HERE); in the order you would like them to be carried out.
  • NAV_LEFT Turn 90 degrees Left at the intersection and keep going
  • NAV_RIGHT Turn 90 degrees Right at the intersection and keep going
  • NAV_FWD Go Straight at the intersection and keep going
  • NAV_UTURNTurn the geekbot 180 degrees at the intersection and stop
  • NAV_STOPStop the geekbot on the intersection
  • void customFunction1()
    {
      myGeekBot.sound(soundWhistle);  
    }
    

    In this function, we make the Geekbot whistle when you press the stop button. Your geekbot likes to cause a ruckus!

    void customFunction2()
    {
      myGeekBot.timedDrive(2000, 50); //time in mS, travel speed -100 to 100 (Drive Forward)
      myGeekBot.timedDrive(2000, -50); //time in mS, travel speed -100 to 100 (Drive Backward)
      myGeekBot.recoverLine(1); //Follow Line until Intersection, state = NAV_CMD for next action.
      myGeekBot.lineFollow(NAV_STOP); //Follow Line until Intersection, state = NAV_CMD for next action.
    }
    

    In this function, we have the geekbot demonstrate timed driving when you press the up button. Timed driving is a method of control for handling movement without using the line. While it is less accurate than following the line, it does allow for unique movement choices in situations where you are trying to accomplish a specific task with your geekbot. We use this to have the geekbot activate a switch that dispenses drinks! You can alter the values in myGeekbot.timedDrive(milliseconds,Travel speed); to change the behavior.

    void customFunction3()
    {
      myGeekBot.timedRotate(1000, 50); // time in mS, rotation speed CCW -100 to CW +100 (Clockwise Turn)
      myGeekBot.timedRotate(1000, -50); // time in mS, rotation speed CCW -100 to CW +100 (Counter Clockwise Turn)
      myGeekBot.recoverLine(1); //Follow Line until Intersection, state = NAV_CMD for next action.
      myGeekBot.lineFollow(NAV_STOP); //Follow Line until Intersection, state = NAV_CMD for next action.
    }
    

    In this function, we have the geekbot demonstrate timed rotation when you press the down button. Timed rotation is a method of control for handling movement without using the line. While it is less accurate than following the line, it does allow for unique movement choices in situations where you are trying to accomplish a specific task with your geekbot. You can alter the values in myGeekbot.timedRotate(milliseconds,Travel speed); to change the behavior.

×

PC Control These demos and projects allow the robot to be controlled via a computer.

ArbotiX Commander Control - These demos and projects control the Robot using the ArbotiX Commander, the handheld Arduino based remote control.

Direct Control - These demos and projects control the Robot directly from sensors connected directly to the Robot's control board.

Pose Control - These demos and projects allow you to create and playback a sequence of poses.

Serial Control - These demos and projects control the robot using a serial packet protocol.

Standalone - These demos and projects are deisgned to let your robot function without a computer or additional microcontroller.

Wireless Control - These demos and projects allow you to control the robot wirelessly - usually by replacing the Serial Connection with XBee modules.

Reference - These articles have technical details regarding the control and operation of the robot.

×

More info here

Feedback Form


Search