The task for Performance Test 2 was to create two separate codes to determine which commands are more efficient than others. Team D decided to primarily focus on the latter half of the track, due to the fact that goToAbsolutePosition is used at the beginning of the run. The two separate functions used for the latter half of the track were decided to be the goFor command and the goToAbsolutePositionCommand. The goal of this test was to see which of these two codes were more efficient.

Looking at the graph above, the graphs start out very similarly given that the beginning commands used are the exact same. However, after the stop, it is clear that goToRelativePosition spikes at a much higher rate than the goFor command. Team D hypothesizes that this could be due to extra processing power used in calculating how many marks have passed. With goFor however, that extra power was not needed and thus lowered the overall number of joules used. The final joule total for the goFor commands is 60 joules whereas the goToRelativePosition rests at 77 marks. This makes it clear that Team D should from now on use goFor commands for any coasting portions of the track, such as the final coast to the end. The code testing will primarily help to achieve the team goal of making the craft far more efficient. This is done by reducing the overall energy consumption and decreasing the overall number of commands.

Testing Code: (For a list of these funcitons and how they work, go here.)

goFor

reverse(4); | Reverses all motors |

aevServo.write(0); | Resets the brake |

servoProp.write(0); | Resets the prop |

delay(100); | Waits 100 milliseconds |

servoProp.write(7); | Pitchs the prop to 7 degrees |

motorSpeed(4,36); | Sets the motor speed to 36% |

goToAbsolutePosition(88); | Goes forward 88 marks |

servoProp.write(9); | Pitchs the prop to 9 degrees |

motorSpeed(4,38); | Sets the motor speed to 38% |

goToAbsolutePosition(176); | Goes forward 176 marks |

servoProp.write(10); | Pitchs the prop to 10 degrees |

motorSpeed(4,40); | Sets the motor speed to 40% |

goToAbsolutePosition(352); | Goes forward 352 marks |

servoProp.write(13); | Pitchs the prop to 13 degrees |

motorSpeed(4,40); | Sets the motor speed to 40% |

goToAbsolutePosition(537); | Goes forward 537 marks |

motorSpeed(4,0); | Sets the motor speed to 0% |

aevServo.write(50); | Brakes the motor |

goFor(1); | Waits 1 second |

aevServo.write(0); | Unbrakes the motor |

motorSpeed(4,0); | Sets the motor speed to 0% |

goFor(7.5); | Go for 7.5 seconds |

servoProp.write(7); | Pitchs the prop to 7 degrees |

motorSpeed(4,36); | Sets the motor speed to 36% |

goFor(1); | Go for 1 seconds |

servoProp.write(9); | Pitchs the prop to 9 degrees |

motorSpeed(4,38); | Sets the motor speed to 38% |

goFor(1); | Go for 1 seconds |

servoProp.write(10); | Pitchs the prop to 10 degrees |

motorSpeed(4,40); | Sets the motor speed to 40% |

goFor(0.8); | Go for 0.8 seconds |

motorSpeed(4,0); | Sets the motor speed to 0% |

servoProp.write(18); | Pitchs the prop to 18 degrees |

goFor(8); | Go for 8 seconds |

goToRelativePosition

reverse(1); | Reverses All Motors |

aevServo.write(0); | Resets brake servo |

servoProp.write(0); | Resets prop servo |

delay(100); | Delays by 100 milliseconds |

servoProp.write(10); | Pitchs the prop to 10 degrees |

motorSpeed(1,38); | Sets the motor speed to 38% |

goToAbsolutePosition(8); | Goes forwards 8 marks |

servoProp.write(11); | Pitchs the prop to 11 degrees |

motorSpeed(1,38); | Sets the motor speed to 38% |

goToAbsolutePosition(16); | Goes to a position of 16 marks |

servoProp.write(12); | Pitchs the prop to 12 degrees |

motorSpeed(1,38); | Sets the motor speed to 38% |

goToAbsolutePosition(32); | Goes to a position of 32 marks |

servoProp.write(12); | Pitchs the prop to 12 degrees |

motorSpeed(1,38); | Sets the motor speed to 38% |

goToAbsolutePosition(64); | Goes to a position of 64 marks |

servoProp.write(13); | Pitchs the prop to 13 degrees |

motorSpeed(1,39); | Sets the motor speed to 39% |

goToAbsolutePosition(128); | Goes to a position of 128 marks |

servoProp.write(14); | Pitchs the prop to 14 degrees |

motorSpeed(1,39); | Sets the motor speed to 39% |

goToAbsolutePosition(256); | Goes to a position of 256 marks |

servoProp.write(15); | Pitchs the prop to 15 degrees |

motorSpeed(1,39); | Sets the motor speed to 39% |

goToAbsolutePosition(280); | Goes to a position of 280 marks |

servoProp.write(16); | Pitchs the prop to 16 degrees |

motorSpeed(1,39); | Sets the motor speed to 39% |

goToAbsolutePosition(292); | Goes to a position of 296 marks |

servoProp.write(32); | Pitchs the prop to 32 degrees |

motorSpeed(1,0); | Sets the motor speed to 0% (Coasting) |

goToAbsolutePosition(480); | Goes to a position of 480 marks |

motorSpeed(1,0); | Sets the motor speed to 0% |

aevServo.write(50); | Brakes the AEV |

goFor(1); | Waits for 1 second |

aevServo.write(0); | Releases the motor brake |

motorSpeed(1,0); | Sets the motor speed to 0% |

goFor(7.5); | Goes for 7.5 seconds |

servoProp.write(11); | Pitchs the prop 11 degrees |

motorSpeed(1,32); | Sets the motor speed to 32% |

goToRelativePosition(11); | Goes forward 11 marks |

servoProp.write(11); | Pitchs the prop 11 degrees |

motorSpeed(1,32); | Sets the motor speed to 32% |

goToRelativePosition(11); | Goes forward 11 marks |

servoProp.write(12); | Pitchs the prop 12 degrees |

motorSpeed(1,34); | Sets the motor speed to 34% |

goToRelativePosition(22); | Goes forward 22 marks |

servoProp.write(12); | Pitchs the prop 12 degrees |

motorSpeed(1,36); | Sets the motor speed to 36% |

goToRelativePosition(44); | Goes forward 44 marks |

servoProp.write(13); | Pitchs the prop 13 degrees |

motorSpeed(1,38); | Sets the motor speed to 38% |

goToRelativePosition(88); | Goes forward 88 marks |

servoProp.write(14); | Pitchs the prop 14 degrees |

motorSpeed(1,40); | Sets the motor speed to 40% |

motorSpeed(1,0); | Sets the motor speed to 0% (Coasting) |

servoProp.write(30); | Pitchs the prop to 30 degrees |

goFor(6.45); | Go for 6.45 seconds |

aevServo.write(48); | Brakes the motor |

goFor(0.5); | Go for 0.5 seconds |

aevServo.write(0); | Releases the motor brake |

servoProp.write(10); | Pitchs the prop to 10 degrees |

motorSpeed(1,20); | Sets the motor speed to 20% |

goFor(0.8); | Go for 0.8 seconds |

motorSpeed(1,0); | Sets motor speed to 0% |

goFor(5); | Wait 5 seconds |

reverse(1); | Reverses the motor |

servoProp.write(11); | Pitchs the prop to 11 degrees |

motorSpeed(1,58); | Sets the motor speed to 58% |

goToRelativePosition(-11); | Goes backwards 11 marks |