Team D2 completed this test outside of class because we ran out of time during the allotted testing time. Because of this, we decided to plan better for our upcoming meetings. The first task that was completed was to attach the sensors to the AEV as shown below. These sensors will track how far the vehicle is moving.
Reflectance Sensor Attachment
Then Zach wrote the code for the lab and we opened up the program to test if the sensors were working correctly. Once we established that the sensors we were able to put the AEV on the test track to execute the following code.
Code Used:
Refer here for information on command functions.
Code | Explanation |
motorSpeed(4,25);
goFor(2); |
Sets all motor speed to 25%, then runs previous function for 2 sec |
motorSpeed(4,25);
goToAbsolutePosition(295) |
Sets all motor speed to 25% and moves the AEV 12ft |
reverse(4); | Reverses both motors |
motorSpeed(4,30);
goFor(1.5); |
Sets all motor speed to 30% runs this function for 1.5 sec |
brake(4); | Brakes all motors |
Takeaways
The sensors are extremely important to programming and completing the project. The sensors have two functions. One of them is relative and the other is absolute. Relative position measures the distance from the point where the code begins to execute. For example, if the AEV is 50 units from the starting point and the code tells the AEV to go 100 units from the relative position, the AEV will move 100 units for a total of 150 units from the starting point. Absolute function measures the distance from the starting point. For example, ff the AEV is again at 50 units from the starting point and program tells the AEV to go 100 units from the absolute position, the AEV will move 50 units to be at 100 units from the starting point.
Measuring the distance that the AEV moves is very important to the goals that we have to accomplish. The AEV must travel down the length of the track and pick up a payload. Then the AEV must work its way back down the track. There is also a point on the track where the AEV must stop and wait for a gate to open. If we did not have the sensors, these tasks would be extremely difficult to complete. We would have to guess how far the AEV would need to move. This would make it very difficult to make sure that the AEV stopped before the gate to allow time for it to open. Having these sensors allows us to measure the distance that we have to go and then write a code that will perform the tasks that are needed. Even though there are no brakes on the AEV, knowing how far it travels before we cut the motors will make it easier to predict where it will come to a stop. The sensors give us better control of the vehicle when it is on the track and the better control we have on the AEV, the more successful we will be.