The second performance test the team was tasked with required the team to create two codes. The task at hand was to create a code which built upon the first performance tests tasks, with additionally added tasks being to connect to the caboose at the far end with minimal bounce back, and move in the direction back to the initial position with the caboose connected. The codes were allowed to be similar, with one key difference being tested to determine which is better moving forwards. The team decided to test relative vs absolute position in these performance codes. After a few trials, the team decided to move forward using the relative positioning codes. Although these codes had a slight variance built in due each successive code being based off of the previous code, which was never performed perfectly uniform each time, the team felt it was easier to work with relative positioning and made the most sense moving forward.
Code 1:
celerate(4,0,40,2); //accelerate all motors from 0% to 40% power in 2 seconds.
goToRelativePosition(139); //power the motors until the AEV has moved 139 marks on the track relative to current position
reverse(4); //reverse all motors
goFor(1); //power motors for 1 second
celerate(4,40,0,2); //decelerate all motors from 40% to 0% power in 2 seconds
goFor(7); //have the AEV wait for 7 seconds at the gate
reverse(4); //reverse all motors
celerate(4,0,30,2); //accelerate all motors from 0% to 30% power in 2 seconds to pass through the gate
goToRelativePosition(61); //power the motors until the AEV has moved 61 marks on the track relative to current position
celerate(4,30,0,2); //decelerate all motors from 30% to 0% power in 2 seconds
goFor(8); //let the AEV go for 8 seconds with no power to the motors to allow it to coast to the caboose and connect while waiting at the end for 5 seconds
reverse(4); //reverse all motors
celerate(4,0,40,2); //accelerate all motors from 0% to 40% in 2 seconds
goToRelativePosition(-100); //power the motors until the AEV has travelled -100 marks towards the initial position relative to its current position
Code 2:
celerate(4,0,40,2); //accelerate all motors from 0% to 40% power in 2 seconds.
goToAbsolutePosition(138); //power the motors until the AEV has moved 138 marks on the track relative to initial position
reverse(4); //reverse all motors
goFor(1); //power motors for 1 second
celerate(4,40,0,2); //decelerate all motors from 40% to 0% power in 2 seconds
goFor(7); //have the AEV wait for 7 seconds at the gate
reverse(4); //reverse all motors
celerate(4,0,30,2); //accelerate all motors from 0% to 30% power in 2 seconds to pass through the gate
goToAbsoutePosition(200); //power the motors until the AEV has moved 200 marks on the track relative to initia position
reverse(4); //reverse all motors
celerate(4,30,0,2); //decelerate all motors from 30% to 0% power in 2 seconds
goFor(8); //let the AEV go for 8 seconds with no power to the motors to allow it to coast to the caboose and connect while waiting at the end for 5 seconds
reverse(4); //reverse all motors
celerate(4,0,50,2); //accelerate all motors from 0% to 50% in 2 seconds
goToAbsolutePosition(180); //power the motors until the AEV has travelled 180 marks from its initial position