View unanswered posts | View active topics It is currently Wed Aug 12, 2020 9:12 am

 Page 1 of 1 [ 6 posts ]
 Print view Previous topic | Next topic
Obstacle Course
Author Message
Rookie

Joined: Sun Nov 18, 2012 11:49 pm
Posts: 6
Obstacle Course
After the lining tracking ends in the obstacle course, my robot turns in circles instead of stopping. I already watched and did what the video said to do but it's still spinning in circles. Can you help? Thanks!
Here's my code

Fri Dec 07, 2012 1:19 am

Joined: Thu May 24, 2012 12:15 pm
Posts: 722
Re: Obstacle Course
The problem you are seeing lies in this section of code:

 Code: while(SensorValue(touchSensor)== 0)       {       if(SensorValue(lightSensor) < 45)         {       motor[motorC] = 100;       motor[motorB] = 20;        }     else      {       motor[motorC] = 20;       motor[motorB] = 100;      }    }

The questions you have to ask yourself are: What is the robot doing? What do I want it to do? What is this code telling the robot to do?

Remember, the robot will do only and exactly what you program it to do; it does not make assumptions.

Hint: Usually when a robot continues an action, it is stuck in a loop and the condition to stop it cannot be met.

_________________
Check out our Blog! And our Facebook page!
Need help? Take a look at our updated help documentation and the ROBOTC Forums.

Fri Dec 07, 2012 1:27 pm
Rookie

Joined: Thu Jul 18, 2013 9:01 pm
Posts: 4
Re: Obstacle Course
I am not sure why "Challenge Incomplete - Try Again... You did not complete the challenge on the intended path"

I completed the challenge by touching wall, following line, using sonar to get to calibration area, and made it to goal. Code:

{
//FORWARD UNTIL PUSH

wait1Msec(2000); // Robot waits for 2000 milliseconds before executing program

while(SensorValue(touch) == 0) // Loop while robot's bumper/touch sensor isn't pressed in
{
motor[rightMotor] = 100; // Motor on motorB is run at half (50) power forward
motor[leftMotor] = 100; // Motor on NXT is run at half (50) power forward
}
motor[rightMotor] = 0; // Motor on motorB is run at half (50) power forward
motor[leftMotor] = 0; // Motor on NXT is run at half (50) power forward
wait1Msec(2000); // Robot waits for 2000 milliseconds before executing program

//TURN LEFT

wait1Msec(2000); // Robot waits for 2000 milliseconds before executing program

motor[rightMotor] = 80;
motor[leftMotor] = -80;
wait1Msec(750);

motor[rightMotor] = 0;
motor[leftMotor] = 0;
wait1Msec(2000);

//FORWARD UNTIL LINE

wait1Msec(2000); // 2 Second Delay

//Clear Encoders
nMotorEncoder[rightMotor] = 0;
nMotorEncoder[leftMotor] = 0;

while(nMotorEncoder[leftMotor] < 600)
{
//...Move Forward
motor[rightMotor] = 50;
motor[leftMotor] = 50;
}
motor[rightMotor] = 0;
motor[leftMotor] = 0;
wait1Msec(2000);

wait1Msec(2000);

int threshold = 45;

ClearTimer(T1);
while(time1[T1] < 28000)
{
// sensor sees light:
if(SensorValue(light) < 47)
{
// counter-steer left:
motor[leftMotor] = 0;
motor[rightMotor] = 35;
}
// sensor sees dark:
else
{
// counter-steer right:
motor[leftMotor] = 35;
motor[rightMotor] = 0;
}
}

motor[rightMotor] = 0;
motor[leftMotor] = 0;
wait1Msec(2000);

//TURN LEFT

wait1Msec(2000);

motor[rightMotor] = 40;
motor[leftMotor] = -40;
wait1Msec (170);

//FORWARD UNTIL SONAR

while(SensorValue(sonar) > 5|| SensorValue(sonar) == -1) // while the sonarSensor sensor is reading in values larger than our
{ // threshold, or reading out of range (-1 = no object in sight)
// move forward:
motor[rightMotor] = 55; // set motorB to speed 55
motor[leftMotor] = 55; // set motorC to speed 55
}
// stop the robot:
motor[rightMotor] = 0; // set motorB to speed 0
motor[leftMotor] = 0; // set motorC to speed 0
wait1Msec (1000);

// BACKWARD
motor[rightMotor] = -20;
motor[leftMotor] = -20;
wait1Msec(500);

//TURN RIGHT

wait1Msec(2000);

motor[rightMotor] = -40;
motor[leftMotor] = 40;
wait1Msec(1500);

motor[rightMotor] = 0;
motor[leftMotor] = 0;
wait1Msec(2000);

//FORWARD UNTIL ULTRASONIC

while(SensorValue(sonar) > 5|| SensorValue(sonar) == -1) // while the sonarSensor sensor is reading in values larger than our
{ // threshold, or reading out of range (-1 = no object in sight)
// move forward:
motor[rightMotor] = 55;
motor[leftMotor] = 55;
}
// stop the robot:
motor[rightMotor] = 0;
motor[leftMotor] = 0;
wait1Msec (1000);

//TURN RIGHT

wait1Msec(2000);

motor[rightMotor] = -70;
motor[leftMotor] = 70;
wait1Msec(700);

motor[rightMotor] = 0;
motor[leftMotor] = 0;
wait1Msec(2000);

//...Move Forward
nMotorEncoder[rightMotor] = 0;
nMotorEncoder[leftMotor] = 0;

while(nMotorEncoder[leftMotor] < 3000)
{
//...Move Forward
motor[rightMotor] = 80;
motor[leftMotor] = 80;
}
motor[rightMotor] = 0;
motor[leftMotor] = 0;
wait1Msec(2000);

}

Thu Jul 18, 2013 9:13 pm
Moderator

Joined: Mon Oct 04, 2010 2:18 pm
Posts: 196
Re: Obstacle Course
Does your entire robot make it into the goal area?

Fri Jul 19, 2013 6:55 pm
Rookie

Joined: Thu Jul 18, 2013 9:01 pm
Posts: 4
Re: Obstacle Course
The robot goes the whole way in the goal area (I tried programming it to make it go farther to no avail) then says "Fail"

Fri Jul 19, 2013 7:44 pm
Rookie

Joined: Tue Feb 14, 2012 3:08 am
Posts: 5
Re: Obstacle Course
I have the same problem in my setup. I touch the wall follow the line move to the end of the exercise and I get the error that I did not follow the intended path.

I even tried doing it without touching the wall but it still doesn't work.

Any ideas?

Fri Nov 29, 2013 5:25 am
Display posts from previous:  Sort by
 Page 1 of 1 [ 6 posts ]

#### Who is online

Users browsing this forum: No registered users and 1 guest

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ ROBOTC Applications    ROBOTC for LEGO MINDSTORMS       Third-party sensors    ROBOTC for CORTEX & PIC    ROBOTC for VEX IQ    ROBOTC for Arduino    Robot Virtual Worlds    Multi-Robot Communications    Issues and Bugs Competitions & Partners    Mini Urban Challenge    CS2N Robot Virtual Worlds Competitions       VEX Skyrise Competition 2014-2015       VEX Toss Up 2013-2014       FTC Block Party! 2013-2014    Competitions using VEX - BEST, TSA, VEX, and RoboFest!    FTC Programming    RoboCup Junior and Other ROBOT Competitions Virtual Brick Robotics Discussions    General Discussions    Project Discussions Off-Topic ROBOTC Forum & ROBOTC.net Suggestions/Feedback    ROBOTC Forums Suggestions/Comments    ROBOTC.net Suggestions/Comments       NXT Programming: Tips for Beginning with ROBOTC       VEX Programming: Tips for Beginning with ROBOTC    2013 Robotics Summer Of Learning       VEX Toss Up Programming Challenge       FTC Ring It Up! Programming Challenge    International Forums       Spanish Forums          ROBOTC for MINDSTORMS          ROBOTC for VEX       French Forums          ROBOTC pour Mindstorms          ROBOTC pour IFI VEX       Japanese Forums （日本語のフォーラム）       German Forums    2015 Spring Carnival Event    PLTW (Project Lead The Way)    Robotics Merit Badge    2014 Robotics Academy Summer of Learning