我正在尝试lineTrackForTime
在爪形机器人上使用命令,但似乎机器人刚刚越过线路并且无法检测到它。
但是,当我切换到方形机器人时,该lineTrackForTime
命令起作用了。
以下代码适用于方形机器人,但不适用于爪形机器人。
#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();
}
如何使代码与爪机器人一起工作以执行以下行?