Final Testing Code Run 2

reverse(4);

//motors reverse for polarity

motorSpeed(4,30);

goToAbsolutePosition(230);

motorSpeed(4,20);

//motor speed slows down in the middle before reaching the gate to achieve a consistent stop

goToRelativePosition(245);

reverse(4);

//motors reverse to brake

motorSpeed(4,65);

goFor(.5);

brake(4);

motorSpeed(4,0);

goFor(9);

//AEV is waiting at the gate

reverse(4);

//motors reverse for polarity

motorSpeed(4,30);

goToRelativePosition(465);

reverse(4);

//motors brake and coast a little to reach the R2D2

motorSpeed(4,65);

goFor(.5);

brake(4);

motorSpeed(4,0);

goFor(5);

//AEV picks up the R2D2

motorSpeed(4,50);

goToRelativePosition(-232);

//relative position marks are negative since it’s going backwards

motorSpeed(4,40);

//motor speed slows down

goToRelativePosition(-175);

reverse(4);

//AEV brakes to reach gate

motorSpeed(4,90);

goFor(.75);

brake(4);

motorSpeed(4,0);

goFor(9);

//AEV waits at gate

reverse(4);

//motors are reversed to achieve polarity

motorSpeed(4,50);

goToRelativePosition(-124);

motorSpeed(4,40);

//motor speed slows down

goToRelativePosition(-185);

brake(4);

//motors are complete off in order achieve a fully coasting stop