Week 10 Code

Week 10 Code

Code:

void myCode()

{

reverse(1);

reverse(2);

celerate(4,0,30,2);

motorSpeed(4,30);

goToAbsolutePosition(-245);

brake(1);

brake(2);

reverse(1);

reverse(2);

celerate(4,0,45,3);

brake(1);

brake(2);

reverse(1);

reverse(2);

motorSpeed(4,0);

goFor(6);

 

celerate(4,0,40,2);

celerate(4,40,30,1);

motorSpeed(4,30);

goToAbsolutePosition(-675);

brake(1);

brake(2);

reverse(1);

reverse(2);

celerate(4,0,40,2);

celerate(4,40,0,1);

motorSpeed(4,0);

goFor(1);

brake(1);

brake(2);

reverse(1);

reverse(2);

reverse(1);

reverse(2);

celerate(4,0,50,2);

celerate(4,50,40,2);

motorSpeed(4,40);

goToRelativePosition(-300);

brake(1);

brake(2);

reverse(1);

reverse(2);

celerate(4,0,55,4);

}

Comments: The AEV travels forward towards the gate, successfully activates the first sensor, waits for the gate to open, proceeds through the gate, travels towards the caboose, picks up the caboose, and travels very slowly back towards the gate with the caboose in tow. A more forceful stop could be edited into the code before the AEV attaches to the caboose as there was a small collision between the vehicle and the caboose. In addition, the code may have to be edited to increase the power supplied to the motors of the AEV as it travels back to the gate with the caboose due to the added weight of the caboose.