I am trying to use lineTrackForTime
command on claw robot but it seems like the robot just run over the line and can't detect it.
However when I switch to square robot, the lineTrackForTime
command worked.
The following code works on the square bot but not on the claw bot.
#pragma config(StandardModel, "RVW SQUAREBOT")
#pragma config(RenamedStdModelSensor, in1, leftline)
#pragma config(RenamedStdModelSensor, in2, centerline)
#pragma config(RenamedStdModelSensor, in3, rightline)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
// already set the line follower sensors and sonar sensor. Didn't rename the Sonar sensor
// set a forward function, will use it with waitInMilliseconds command later
void straight()
{
startMotor(leftMotor,127);
startMotor(rightMotor,127);
}
// set a turnright function, will use it with waitInMilliseconds command later
void turnRight()
{
startMotor(leftMotor,30);
startMotor(rightMotor,-30);
}
task main()
{
// move the robot out of the start area , go straight and turn right
straight();
waitInMilliseconds(2000);
turnRight();
waitInMilliseconds(2700);
// after robot out of start area, keep moving forward until meet the dark line
forward();
//use lineTrackForTime command to make the robot follow the line
lineTrackForTime(45,505,in1,in2,in3);
//after the line ends, robot will keep move forward until the sonar sensor detect the distance to the wall(less than 30cm), then it stops
forward();
untilSonarLessThan();
stop();
}
How can I make the code work with the claw bot to do the line following?