有关详细信息,请阅读Robocup 文档。
我正在做高级救援,如果你能帮助我,我会很高兴。
谢谢。
int diff;
long redValue1;
long greenValue1;
long blueValue1;
long redValue2;
long greenValue2;
long blueValue2;
task main()
{
repeat(forever)
{
getColorRGB(S1, redValue1, greenValue1, blueValue1);
getColorRGB(S2, redValue2, greenValue2, blueValue2);
diff = greenValue1-greenValue2;
diff = diff*2;
motor[motorA] = -30 -diff;
motor[motorB] = diff+ -30;
if (getUSDistance(S3)<10)
{
motor[motorA] = -20;
motor[motorB] = 20;
delay(800);
motor[motorA] = -20;
motor[motorB] = -20;
delay(1200);
motor[motorA] = 20;
motor[motorB] = -20;
delay(800);
motor[motorA] = -20;
motor[motorB] = -20;
delay(3000);
motor[motorA] = 20;
motor[motorB] = -20;
delay(800);
motor[motorA] = -20;
motor[motorB] = -20;
delay(1200);
motor[motorA] = -20;
motor[motorB] = 20;
delay(800);
}
if (greenValue1>14 && redValue1<10 && blueValue1<10
&& greenValue2>14 && redValue2<10 && blueValue2<10){
playTone(200, 10);
motor[motorA] = -20;
motor[motorB] = -20;
delay(2000);
motor[motorA] = -20;
motor[motorA] = 20;
delay(3000);
motor[motorA] = -20;
motor[motorA] = 20;
waitUntil(getUSDistance(S3)<40);
motor[motorA] = -60;
motor[motorA] = -60;
motor[motorB] = -60;
motor[motorA] = -60;
motor[motorB] = -60;
delay(1000);
motor[motorA] = 60;
motor[motorB] = 60;
delay(600);
}else{
}
if (greenValue1>14 && redValue1<7 && blueValue1<7){
delay(100);
motor[motorA] = 40;
motor[motorB] = -40;
delay(250);
}else{
}
if (greenValue2>14 && redValue2<7 && blueValue2<7){
delay(100);
motor[motorA] = -40;
motor[motorB] = 40;
delay(250);
}else{
}
}
}
Linefollowing 是从第 1 行到第 10 行。我正在尝试将速度提高到 100。但我无法获得正确的比例。