//Initial forward movement
celerate(4,0,48,2); //accelerate from 0 to 48 percent power in 2 seconds
goToAbsolutePosition(-230); //go to absolute position, -230 ticks
brake(4); //brake all motors
//Slow down process for gate halt
reverse(4); //reverse all motors
motorSpeed(4,65); //set all motors to 65 percent power
goFor(1); //go for one second at set power
brake(4); // brake all motors
//Wait for gate to open
reverse(4); //reverse all motors
motorSpeed(4,0); //set all motors to zero percent power
goFor(7.8); //wait for 7.8 seconds
//Second forward movement
motorSpeed(4,48); //set all motors to 48 percent power
goToAbsolutePosition(-465); //go to absolute position,-465 ticks
brake(4); //Brake all motors
//Slow down process for caboose latch
reverse(4); //reverse all motors
motorSpeed(4, 50); //set all motors to 50 percent power
goFor(1); //go for 1 second at set power
reverse(4); //reverse direction of the motors
//Wait for caboose latch process
motorSpeed(4,0); //set all motor power to zero
goFor(6); //wait for 6 seconds
reverse(4); //reverse all motors
//Initial movement with caboose
motorSpeed(4, 62); //all motors set to 62 percent power
goToAbsolutePosition(-418); //go to absolute position-418 ticks
brake(4); //brake all motors
//Slow down process with caboose at gate
reverse(4); //reverse all motors
motorSpeed(4,70); //all motors set to 70 percent power
goFor(1.5); //go for 1.5 seconds
brake(4); //brake all motors
reverse(4); //reverse all motors
//Wait at gate, then start Second movement (past gate) with caboose
motorSpeed(4,0); //set motors to zero percent power
goFor(7.8); //wait for 7.8 seconds
motorSpeed(4,60); //set all motors to 60 percent power
goToAbsolutePosition(-155); //go toabsolute position- 155 ticks
//end brake sequence
reverse(4); //reverse all motors
motorSpeed(4, 57); //set all motors to 57 percent power
goFor(3.0); //go for 3 seconds
reverse(4); //reverse motors
//end
brake(4); //brake all motors