Jump to content


Photo

Problem With My Robot

Robot Problem.

  • Please log in to reply
18 replies to this topic

#1 Rider

Rider

    Member

  • Members
  • PipPip
  • 11 posts

Posted 20 October 2014 - 02:00 AM

 
Hey!  
My Grandpa bought me your robot kit a last week and I finally put it together using your Arduino Tutorial  because I am kind of new with this stuff :)
 
I have built the robot according  to your instructions but I built the base diff rent to provide me more space and Added a separate battery pack because when I Split the pack something was causing my Ardiono To get to hot.  
 
Well I have it built and It is doing the exact opposite of what it should do (Drive Forward until it detects an object then turn) Well At the moment its turning right and going straight when it detects something. I have used the Exact code in your Tutorial and built it pretty much the same. Yet I cant find out why its doing this. Do you have any ideas why? 
 
Thanks
~Rider  ;)
 
P.S. I took a video and photo of it. Sorry about the low Qulity.

Attached Files


  • 0

#2 Nathan House

Nathan House

    Administrator

  • Administrators
  • 122 posts
  • LocationLynchburg, VA

Posted 20 October 2014 - 10:59 PM

Hey Rider,
 
Sorry for not getting back with you sooner. I've been sick the past couple of days :-(
 
That's a cool looking robot!
 

Added a separate battery pack because when I Split the pack something was causing my Ardiono To get to hot.

 
Something was probably wired incorrectly if the Arduino was getting hot, but using a separate battery pack is better anyway.
 

Well I have it built and It is doing the exact opposite of what it should do (Drive Forward until it detects an object then turn) Well At the moment its turning right and going straight when it detects something. I have used the Exact code in your Tutorial and built it pretty much the same. Yet I cant find out why its doing this. Do you have any ideas why?

 

So when the robot is supposed to drive straight, it turns, and when it's supposed to turn, it drives straight..

 

Since you're using the exact code from the tutorial, there must be something different with your wiring. Let's try to debug the problem!

 

When you're trying to debug a problem like this, the best thing to do is break it down into smaller steps to make the debugging easier. So let's start by trying to make the robot drive straight. If you look on the tutorial page, you can find this code:

#include <Servo.h>

// create servo objects
Servo leftMotor;
Servo rightMotor;

void setup()
{
    leftMotor.attach(13);
    rightMotor.attach(12);
}


void loop()
{
    leftMotor.write(180);
    rightMotor.write(180);
} 

 Try uploading that to your Arduino and see if it drives forward (or backward). If not, then we can try to figure out why it's not driving straight. If it does drive straight, then we know this part works and can move on to trying something else. The key is to break the problem down into sub-problems and attack them one at a time.

 

Good luck, and let me know how it goes!


  • 1

#3 Rider

Rider

    Member

  • Members
  • PipPip
  • 11 posts

Posted 20 October 2014 - 11:22 PM

Hey,
Its fine!

Ok So I tried the code. It drives straight without a problem.
  • 0

#4 Nathan House

Nathan House

    Administrator

  • Administrators
  • 122 posts
  • LocationLynchburg, VA

Posted 20 October 2014 - 11:26 PM

Alright, so that means the servos are wired correctly. The next thing I want you to test is the ultrasonic sensor. Here's code from the page I linked to before:

const int serialPeriod = 250;       // only print to the serial console every 1/4 second
unsigned long timeSerialDelay = 0;

const int loopPeriod = 20;          // a period of 20ms = a frequency of 50Hz
unsigned long timeLoopDelay   = 0;

// specify the trig & echo pins used for the ultrasonic sensors
const int ultrasonic2TrigPin = 8;
const int ultrasonic2EchoPin = 9;

int ultrasonic2Distance;
int ultrasonic2Duration;


void setup()
{
    Serial.begin(9600);
  
    // ultrasonic sensor pin configurations
    pinMode(ultrasonic2TrigPin, OUTPUT);
    pinMode(ultrasonic2EchoPin, INPUT);
}


void loop()
{
    debugOutput(); // prints debugging messages to the serial console
    
    if(millis() - timeLoopDelay >= loopPeriod)
    {
        readUltrasonicSensors(); // read and store the measured distances
        
        timeLoopDelay = millis();
    }
}


void readUltrasonicSensors()
{
    // ultrasonic 2
    digitalWrite(ultrasonic2TrigPin, HIGH);
    delayMicroseconds(10);                  // must keep the trig pin high for at least 10us
    digitalWrite(ultrasonic2TrigPin, LOW);
    
    ultrasonic2Duration = pulseIn(ultrasonic2EchoPin, HIGH);
    ultrasonic2Distance = (ultrasonic2Duration/2)/29;
}


void debugOutput()
{
    if((millis() - timeSerialDelay) > serialPeriod)
    {
        Serial.print("ultrasonic2Distance: ");
        Serial.print(ultrasonic2Distance);
        Serial.print("cm: ");
        Serial.println();
        
        timeSerialDelay = millis();
    }
}

Upload the code, then open the serial monitor in the Arduino IDE and see what prints out when you move something back and forth in front of it. It should print out the distance.


  • 1

#5 Rider

Rider

    Member

  • Members
  • PipPip
  • 11 posts

Posted 21 October 2014 - 01:20 AM

Ok, Sorry I took a little long to reply..

Ok So I uploaded the code and getting a response of my distance in the Serial Monitor.


  • 0

#6 Nathan House

Nathan House

    Administrator

  • Administrators
  • 122 posts
  • LocationLynchburg, VA

Posted 21 October 2014 - 01:27 AM

And the distance looks correct? I.e. if you put your hand right in front of it, the distance is close to 0cm, then as you move away it keeps increasing?


  • 1

#7 Rider

Rider

    Member

  • Members
  • PipPip
  • 11 posts

Posted 21 October 2014 - 01:29 AM

Looks pretty good to me, Here is What Output as I moved my hand away.

 

 

ultrasonic2Distance: 4cm: 
ultrasonic2Distance: 4cm: 
ultrasonic2Distance: 4cm: 
ultrasonic2Distance: 5cm: 
ultrasonic2Distance: 5cm: 
ultrasonic2Distance: 5cm: 
ultrasonic2Distance: 6cm: 
ultrasonic2Distance: 7cm: 
ultrasonic2Distance: 8cm: 
ultrasonic2Distance: 8cm: 
ultrasonic2Distance: 9cm: 
ultrasonic2Distance: 10cm: 
ultrasonic2Distance: 11cm: 
ultrasonic2Distance: 12cm: 
ultrasonic2Distance: 13cm: 
ultrasonic2Distance: 13cm: 
ultrasonic2Distance: 13cm: 
ultrasonic2Distance: 14cm: 
ultrasonic2Distance: 15cm: 
ultrasonic2Distance: 15cm: 
ultrasonic2Distance: 15cm: 
ultrasonic2Distance: 16cm: 
ultrasonic2Distance: 17cm: 
ultrasonic2Distance: 18cm: 
ultrasonic2Distance: 19cm: 
ultrasonic2Distance: 20cm: 
ultrasonic2Distance: 22cm: 
ultrasonic2Distance: 23cm: 
ultrasonic2Distance: 25cm: 
ultrasonic2Distance: 26cm: 
ultrasonic2Distance: 26cm: 
ultrasonic2Distance: 27cm: 
ultrasonic2Distance: 29cm: 
ultrasonic2Distance: 29cm: 
ultrasonic2Distance: 30cm: 
ultrasonic2Distance: 30cm: 
ultrasonic2Distance: 32cm: 
ultrasonic2Distance: 30cm: 
ultrasonic2Distance: 31cm: 
ultrasonic2Distance: 32cm: 
ultrasonic2Distance: 32cm: 
ultrasonic2Distance: 48cm: 
ultrasonic2Distance: 48cm: 
ultrasonic2Distance: 48cm: 
ultrasonic2Distance: 48cm: 
ultrasonic2Distance: 48cm: 
ultrasonic2Distance: 48cm: 
ultrasonic2Distance: 48cm: 
ultrasonic2Distance: 48cm: 
ultrasonic2Distance: 47cm: 
ultrasonic2Distance: 47cm: 
 
Wow that alot more then I wanted xD

Edited by Rider, 21 October 2014 - 01:30 AM.

  • 0

#8 Nathan House

Nathan House

    Administrator

  • Administrators
  • 122 posts
  • LocationLynchburg, VA

Posted 21 October 2014 - 01:39 AM

Looks good.
 
Hmph. This is strange. The motors are working, the ultrasonic is working, but the robot is turning when it should be driving straight..
 
Ok, here's what I want you to do. Copy the full program (from the tutorial page) to the IDE and put debug statements in every function and in every logical branch (inside each if/else statement). So, for example, put a statement inside setup() like "Serial.println("inside setup()");". Do the same type of thing at the beginning of loop(). Inside the if(state == DRIVE_FORWARD) branch, put a line like "Serial.println("inside DRIVE_FORWARD state")".

 

Do this throughout the entire program, upload it to your robot, hold down the reset button on the Arduino, clear the serial monitor window, then release the reset button on the Arduino. Printing out debug statements like this is the best way to debug programs on an Arduino board.By doing this, we can trace the execution of the program and see what's happening.

 

After you release the reset button, let the robot move without anything in front of the sensor, then put something in front of the sensor. Post the output here and we can analyze it together.

 

Don't get discouraged... Debugging programs is common in programming and robotics, and it's a really valuable skill to develop!


  • 0

#9 Rider

Rider

    Member

  • Members
  • PipPip
  • 11 posts

Posted 21 October 2014 - 01:58 AM

Sorry,
I am really not understanding where to put the code. I houstly have no knowledge on Arduino coding, I been copying and pasting.  :(


  • 0

#10 Nathan House

Nathan House

    Administrator

  • Administrators
  • 122 posts
  • LocationLynchburg, VA

Posted 21 October 2014 - 02:09 AM

No problem, this can be a learning experience then!

 

Here's the full program from the tutorial page:

#include <Servo.h>

// create servo objects
Servo leftMotor;
Servo rightMotor;

const int serialPeriod = 250;       // only print to the serial console every 1/4 second
unsigned long timeSerialDelay = 0;

const int loopPeriod = 20;          // a period of 20ms = a frequency of 50Hz
unsigned long timeLoopDelay   = 0;

// specify the trig & echo pins used for the ultrasonic sensors
const int ultrasonic2TrigPin = 8;
const int ultrasonic2EchoPin = 9;

int ultrasonic2Distance;
int ultrasonic2Duration;

// define the states
#define DRIVE_FORWARD     0
#define TURN_LEFT         1

int state = DRIVE_FORWARD; // 0 = drive forward (DEFAULT), 1 = turn left

void setup()
{
    Serial.begin(9600);
  
    // ultrasonic sensor pin configurations
    pinMode(ultrasonic2TrigPin, OUTPUT);
    pinMode(ultrasonic2EchoPin, INPUT);
    
    leftMotor.attach(13);
    rightMotor.attach(12);
}


void loop()
{
    if(digitalRead(2) == HIGH) // if the push button switch was pressed
    {
        while(1)
        {
            leftMotor.write(90);
            rightMotor.write(90);
        }
    }

    debugOutput(); // prints debugging messages to the serial console
    
    if(millis() - timeLoopDelay >= loopPeriod)
    {
        readUltrasonicSensors(); // read and store the measured distances
        
        stateMachine();
        
        timeLoopDelay = millis();
    }
}


void stateMachine()
{
    if(state == DRIVE_FORWARD) // no obstacles detected
    {
        if(ultrasonic2Distance > 6 || ultrasonic2Distance < 0) // if there's nothing in front of us (note: ultrasonicDistance will be negative for some ultrasonics if there's nothing in range)
        {
            // drive forward
            rightMotor.write(180);
            leftMotor.write(0);
        }
        else // there's an object in front of us
        {
            state = TURN_LEFT;
        }
    }
    else if(state == TURN_LEFT) // obstacle detected -- turn left
    {
        unsigned long timeToTurnLeft = 500; // it takes around .5 seconds to turn 90 degrees
        
        unsigned long turnStartTime = millis(); // save the time that we started turning

        while((millis()-turnStartTime) < timeToTurnLeft) // stay in this loop until timeToTurnLeft (.5 seconds) has elapsed
        {
            // turn left
            rightMotor.write(180);
            leftMotor.write(180);
        }
        
        state = DRIVE_FORWARD;
    }
}


void readUltrasonicSensors()
{
    // ultrasonic 2
    digitalWrite(ultrasonic2TrigPin, HIGH);
    delayMicroseconds(10);                  // must keep the trig pin high for at least 10us
    digitalWrite(ultrasonic2TrigPin, LOW);
    
    ultrasonic2Duration = pulseIn(ultrasonic2EchoPin, HIGH);
    ultrasonic2Distance = (ultrasonic2Duration/2)/29;
}
//

void debugOutput()
{
    if((millis() - timeSerialDelay) > serialPeriod)
    {
        Serial.print("ultrasonic2Distance: ");
        Serial.print(ultrasonic2Distance);
        Serial.print("cm");
        Serial.println();
        
        timeSerialDelay = millis();
    }
}

So what we want to do is add debugging statements throughout the program so that when it runs we can following the path of execution (so we can see where it went wrong). In the code below, you can see how I added the debugging statements at each important point in the program:

#include <Servo.h>

// create servo objects
Servo leftMotor;
Servo rightMotor;

const int serialPeriod = 250;       // only print to the serial console every 1/4 second
unsigned long timeSerialDelay = 0;

const int loopPeriod = 20;          // a period of 20ms = a frequency of 50Hz
unsigned long timeLoopDelay   = 0;

// specify the trig & echo pins used for the ultrasonic sensors
const int ultrasonic2TrigPin = 8;
const int ultrasonic2EchoPin = 9;

int ultrasonic2Distance;
int ultrasonic2Duration;

// define the states
#define DRIVE_FORWARD     0
#define TURN_LEFT         1

int state = DRIVE_FORWARD; // 0 = drive forward (DEFAULT), 1 = turn left

void setup()
{
    Serial.println("inside setup()");
    Serial.begin(9600);
  
    // ultrasonic sensor pin configurations
    pinMode(ultrasonic2TrigPin, OUTPUT);
    pinMode(ultrasonic2EchoPin, INPUT);
    
    leftMotor.attach(13);
    rightMotor.attach(12);
}


void loop()
{
    Serial.println("inside loop()");
    if(digitalRead(2) == HIGH) // if the push button switch was pressed
    {
        Serial.println("kill switch is pressed");
        while(1)
        {
            leftMotor.write(90);
            rightMotor.write(90);
        }
    }

    debugOutput(); // prints debugging messages to the serial console
    
    if(millis() - timeLoopDelay >= loopPeriod)
    {
        readUltrasonicSensors(); // read and store the measured distances
        
        stateMachine();
        
        timeLoopDelay = millis();
    }
}


void stateMachine()
{
    Serial.println("inside stateMachine()");
    if(state == DRIVE_FORWARD) // no obstacles detected
    {
        Serial.println("state = DRIVE_FORWARD");
        if(ultrasonic2Distance > 6 || ultrasonic2Distance < 0) // if there's nothing in front of us (note: ultrasonicDistance will be negative for some ultrasonics if there's nothing in range)
        {
            Serial.println("no obstacles, continuing forward");
            // drive forward
            rightMotor.write(180);
            leftMotor.write(0);
        }
        else // there's an object in front of us
        {
            Serial.println("there is an object in front of us");
            state = TURN_LEFT;
        }
    }
    else if(state == TURN_LEFT) // obstacle detected -- turn left
    {
        Serial.println("state = TURN_LEFT");
        unsigned long timeToTurnLeft = 500; // it takes around .5 seconds to turn 90 degrees
        
        unsigned long turnStartTime = millis(); // save the time that we started turning

        while((millis()-turnStartTime) < timeToTurnLeft) // stay in this loop until timeToTurnLeft (.5 seconds) has elapsed
        {
            Serial.println("turning left...");
            // turn left
            rightMotor.write(180);
            leftMotor.write(180);
        }
        
        state = DRIVE_FORWARD;
    }
}


void readUltrasonicSensors()
{
    Serial.println("inside readUltrasonicSensors()");
    // ultrasonic 2
    digitalWrite(ultrasonic2TrigPin, HIGH);
    delayMicroseconds(10);                  // must keep the trig pin high for at least 10us
    digitalWrite(ultrasonic2TrigPin, LOW);
    
    ultrasonic2Duration = pulseIn(ultrasonic2EchoPin, HIGH);
    ultrasonic2Distance = (ultrasonic2Duration/2)/29;
}
//

void debugOutput()
{
    if((millis() - timeSerialDelay) > serialPeriod)
    {
        Serial.print("ultrasonic2Distance: ");
        Serial.print(ultrasonic2Distance);
        Serial.print("cm");
        Serial.println();
        
        timeSerialDelay = millis();
    }
}

Try uploading and running that program as I described before, then the output should show how the program executed. We can use the output to try and determine what's going wrong.


  • 0

#11 Rider

Rider

    Member

  • Members
  • PipPip
  • 11 posts

Posted 21 October 2014 - 02:15 AM

Ok, This is going to be long, Ok so when Nothing is front of it I see output like "inside loop()

inside loop()
inside loop()
inside loop()
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
 
 
 
Then When I put something in front of it I get  state = TURN_LEFT
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
 
 
Heres a full thing,.
 
 
inside loop()
inside loop()
inside loop()
inside loop()
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 9cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 9cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 10cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 9cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 9cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 9cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 9cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 10cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 11cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 10cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 11cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 9cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 9cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 10cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 119cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 13cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 20cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 16cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 16cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 71cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 74cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 79cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 81cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 83cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
there is an object in front of us
inside loop()
ultrasonic2Distance: 6cm
inside readUltrasonicSensors()
inside stateMachine()
state = TURN_LEFT
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
inside loop()
ultrasonic2Distance: 5cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
there is an object in front of us
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = TURN_LEFT
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
inside loop()
ultrasonic2Distance: 3cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
there is an object in front of us
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = TURN_LEFT
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
inside loop()
ultrasonic2Distance: 5cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
there is an object in front of us
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = TURN_LEFT
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
inside loop()
ultrasonic2Distance: 3cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
there is an object in front of us
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = TURN_LEFT
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
inside loop()
ultrasonic2Distance: 3cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
there is an object in front of us
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = TURN_LEFT
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
inside loop()
ultrasonic2Distance: 3cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
there is an object in front of us
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = TURN_LEFT
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
turning left...
inside loop()
ultrasonic2Distance: 5cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 77cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 78cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 77cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 78cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 78cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 77cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 78cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 78cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 78cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 78cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 77cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 78cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 78cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 77cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 77cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 26cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 73cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 73cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 72cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 72cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 72cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 72cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 71cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 70cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 72cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 72cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 71cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 71cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 70cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 71cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 71cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 71cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 72cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 22cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 72cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 72cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 71cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 71cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 71cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 71cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 71cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 70cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 71cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 71cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 71cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 70cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 70cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 70cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 70cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 70cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 69cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 69cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 68cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 68cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 67cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 67cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 13cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 15cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 12cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 11cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 11cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 12cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 11cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 10cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 10cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 10cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 10cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 10cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
ultrasonic2Distance: 10cm
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
inside loop()
inside loop()
inside readUltrasonicSensors()
inside stateMachine()
state = DRIVE_FORWARD
no obstacles, continuing forward
.....

  • 0

#12 Rider

Rider

    Member

  • Members
  • PipPip
  • 11 posts

Posted 21 October 2014 - 02:17 AM

Of my Low knowledge of this it looks like its doing what it "Should" Do?


  • 0

#13 Nathan House

Nathan House

    Administrator

  • Administrators
  • 122 posts
  • LocationLynchburg, VA

Posted 21 October 2014 - 02:33 AM

Yep, the output looks entirely correct to me.

 

When there's nothing in front of it, the robot is still turning right?


  • 0

#14 Rider

Rider

    Member

  • Members
  • PipPip
  • 11 posts

Posted 21 October 2014 - 02:35 AM

Actually its turning Right


  • 0

#15 Rider

Rider

    Member

  • Members
  • PipPip
  • 11 posts

Posted 21 October 2014 - 02:37 AM

Ok. Well I switched the Servo wires and Now i have it turning left when nothings in front of it and forward when their is.


  • 0

#16 Nathan House

Nathan House

    Administrator

  • Administrators
  • 122 posts
  • LocationLynchburg, VA

Posted 21 October 2014 - 02:37 AM

Oh snap! I know what the problem is! Your servos must somehow be in a different orientation than in the tutorial.

 

Change this:

// drive forward
            rightMotor.write(180);
            leftMotor.write(0);

To this:

// drive forward
            rightMotor.write(180);
            leftMotor.write(180);

And this:

// turn left
            rightMotor.write(180);
            leftMotor.write(180);

To this:

// turn left
            rightMotor.write(0);
            leftMotor.write(180);

  • 1

#17 Rider

Rider

    Member

  • Members
  • PipPip
  • 11 posts

Posted 21 October 2014 - 02:46 AM

Haha! 

It works!
Thanks Sooo Much Nate for helping and providing this kit!
Im gonna keep you and this website in mind for next time I need some good parts and help!


  • 0

#18 Nathan House

Nathan House

    Administrator

  • Administrators
  • 122 posts
  • LocationLynchburg, VA

Posted 21 October 2014 - 02:54 AM

Awesome!!

 

So now I would encourage you to start trying to learn how the program works bit by bit (i.e. the motor code, ultrasonics code, etc). I think programming is one of the most fun parts of robotics as you get to tell the robot what to do. You can modify the state machine in the program to make the robot do different things, like turn the other direction or 180 degrees when an obstacle is detected. If you point the sensor to the left or right of the robot, you can make it into a wall following robot, and if you buy one more ultrasonic sensor you could make a maze navigation robot!

 

Have fun!


  • 0

#19 Rider

Rider

    Member

  • Members
  • PipPip
  • 11 posts

Posted 21 October 2014 - 02:58 AM

Ah! I will! Xmas is coming around the corner, I'm looking for some things I would like! I think I got some parts in mind for my Family to buy :P
I hope you wont see the last of me! Thanks again Nate


  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users