Full Track Code
reverse(4); //Reverse polarity of all motors
rotateServo(0); //Rotate servo motor to default zero degree position
motorSpeed(4,35); //Run all motors at constant speed of 35% power
goFor(4); //Execute previous command for 4 seconds
motorSpeed(4,0); //Run all motors at constant speed of 0% power
goToAbsolutePosition(375); //Travel a total distance of 15.2 feet (from the starting point)
rotateServo(40); //Rotate servo motor to 40 degree position
goFor(1); //Execute previous command for 1 second
rotateServo(0); //Rotate servo motor to default zero degree position
brake(4); //Remove power from all motors
goFor(7); //Execute previous command for 7 seconds
//Reach Gate
motorSpeed(4,35); //Run all motors at constant speed of 35% power
goFor(3.7); //Execute previous command for 3.7 seconds
motorSpeed(4,0); //Run all motors at constant speed of 0% power
goToAbsolutePosition(775); //Travel a total distance of 31.5 feet (from the starting point)
motorSpeed(4,0); //Run all motors at constant speed of 0% power
goFor(5); //Execute previous command for 5 seconds
//Reach the cart
reverse(4); //Reverse polarity of all motors
motorSpeed(4,50); //Run all motors at constant speed of 50% power
goFor(4.5); //Execute previous command for 4.5 seconds
motorSpeed(4,0); //Run all motors at constant speed of 0% power
goToAbsolutePosition(440); //Travel a total distance of 17.9 feet (from the starting point)
rotateServo(40); //Rotate servo motor to 40 degree position
goFor(1); //Execute previous command for 1 second
rotateServo(0); //Rotate servo motor to default zero degree position
brake(4); //Remove power from all motors
goFor(7); //Execute previous command for 7 seconds
//Reach Gate
motorSpeed(4,50); //Run all motors at constant speed of 35% power
goFor(4.5); //Execute previous command for 4.5 seconds
motorSpeed(4,0); //Run all motors at constant speed of 0% power
goToAbsolutePosition(50); //Travel a total distance of 2.0 feet (from the starting point)
rotateServo(40); //Rotate servo motor to 40 degree position
brake(4); //Remove power from all motors
rotateServo(0); //Rotate servo motor to default zero degree position
Motor Warm Up:
celerate(4,0,50,10); //Accelerate all motors from 0% to 50% in 10 seconds