Sam Evans, Anthony Lokar, External Sensors
Alejandro Nunez, Benjamin Schneider
Group A – Instr. Richard Busick, GTA Jin Yang February 12, 2015
Executive Summary
During the external sensor experiment, the team became familiar with the hardware of the sensor and tested it before running it on the monorail system. The team also performed troubleshooting techniques and learned how to observe errors that the sensor may be causing. Basic program functions were also used to create a code that would have the Advanced Electronic Vehicle (AEV) travel to the Jurassic Park gate. This experiment allowed the team to learn how to identify issues in both hardware and software components of a system.
While testing the AEV on the track, a program was used to run both of the AEV’s motors at 25% power for 2 seconds and then run them at 20% power for 16 feet, from the starting point. This last command utilized the sensors installed on the AEV to record how far it had traveled. The code then reversed the motors, ran the motors at 30% power for 1.5 seconds, and then had the motors brake. See the “External Sensors Code” in the Appendix for exact program utilized. At first, the AEV went half the expected distance due to a faulty sensor. Once switched, it ran as expected. This code was the first time the AEV executed commands based on distance, not time. In previous trials with the AEV, the motors ran until a certain time period had been reached. Now with the “goToAbsolutePosition ()” and “goToRelativePosition()” commands the AEV will be able to adjust motors speed based on distance traveled.
The programming methods learned through the lab are critical for the preliminary coding of the AEV. The code will allow for the AEV to move to a certain distance before the motors are shut off. This can require the AEV tol stop at the entrance gate, as directed in the mission concept. The group will also be able to calculate the distance required for the AEV to travel to the storage facility. The commands will prohibit the AEV from crashing into the storage facility, and can be used to approach the magnetic caboose slowly.
While uploading the code to the AEV and testing it on the track, the team encountered a few errors. When the code was uploaded to the AEV, only the first COM port was available. However, this port was reserved for the computer and could not be used. The team solved this issue by switching out the cord used to upload the program to the AEV. The new cord successfully downloaded drivers to the computer and allowed a new port to be detected. Another error was noticed when testing the AEV on the sample track. The vehicle only went half as far as it should using the “goToAbsolutePosition()” command, leading the team to think that one of the sensors was too sensitive. After the team switched out the defective sensor for a new one, the AEV ran on the track without an issue.
During the installation of the sensors on the AEV, there was lots of room for error. The team recommends that when installing the sensors, they are checked to ensure that they are plugged into the correct slots on the Arduino. If they are reversed, faulty data may be recorded forcing the motors to continuously run. Also during the lab the team was required to convert the marks picked up by the sensors to feet. It is recommended that one or more group members check the math. If there is a faulty conversion factor, or an error in the calculation the AEV could potentially go too far, making contact with the gate and potentially damaging a motor. This experiment gave the team first hand experience both installing and coding the reflective sensors. With this toolset, the team will be able to execute programs moving the AEV to certain positions on the track, which is critical for final testing. Also, it exposed the team to common bugs prevalent among the external sensors, and strategies for dealing with them.
Appendix
External Sensors Code
void myCode()
{
//—————————————————————————————-
// myCode();
reverse(4); // Reverses all motors so that they propel the AEV forward
motorSpeed(4,25); // Sets all motors to 25 % power
goFor(2); // Keeps the motors running at 25% power for two seconds
motorSpeed(4,20); // Sets all motors to 20% power
goToAbsolutePosition(394); // the AEV travels until an absolute distance of 16 feet at 20% power
reverse(4); // Reverses all motors
motorSpeed(4,30); // Runs all motors at 30% power output
goFor(1.5); // Repeats the previous command for two seconds
brake(4); // Brakes all motors
// And here——————————————————————————–
} // DO NOT REMOVE. end of void myCode()