ROBOTC.net forumshttp://www.robotc.net/forums/ Obstacle Coursehttp://www.robotc.net/forums/viewtopic.php?f=1&t=5227 Page 1 of 1

Author:  sunnymee9 [ Fri Dec 07, 2012 1:19 am ]
Post subject:  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

Author:  JohnWatson [ Fri Dec 07, 2012 1:27 pm ]
Post subject:  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.

 Author: ellencavanaugh [ Thu Jul 18, 2013 9:13 pm ] Post subject: 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:task main(){ //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); //FOLLOW LINE 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);}

 Author: parkway [ Fri Jul 19, 2013 6:55 pm ] Post subject: Re: Obstacle Course Does your entire robot make it into the goal area?

 Author: ellencavanaugh [ Fri Jul 19, 2013 7:44 pm ] Post subject: 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"https://docs.google.com/file/d/0B19jMvB ... sp=sharing

 Author: pcheng [ Fri Nov 29, 2013 5:25 am ] Post subject: 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?

 Page 1 of 1 All times are UTC - 5 hours [ DST ] Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Grouphttp://www.phpbb.com/