Lab Exercise 2: Reflectance Sensors

Objectives:

  1. Become familiar with the external sensor hardware components.
  2. Become familiar with troubleshooting techniques.
  3. Program function calls for using external sensors with AEV control.

Arduino Code:

void myCode()
{
//—————————————————————————————-
// myCode();
//
// This is the tab where the programming of your vehicle operation is done.
// Tab _00_AEV_key_words contains a compiled list of functions/subroutines used for vehicle
// operation.
//
// Note:
// (1) After running your AEV do not turn the AEV off, connect the AEV to a computer, or
// push the reset button on the Arduino. There is a 13 second processing period. In
// post processing, data is stored and battery recuperation takes place.
// (2) Time, current, voltage, total marks, position traveled are recorded approximately
// every 60 milliseconds. This may vary depending on the vehicles operational tasks.
// It takes approximately 35-40 milliseconds for each recording. Thus when programming,
// code complexity may not be beneficial.
// (3) Always comment your code. Debugging will be quicker and easier to do and will
// especially aid the instructional team in helping you.
//—————————————————————————————-

// Program between here——————————————————————-

// Run motors at a constant speed (25% power) for 2 second.
motorSpeed(4,25);
goFor(2);

// Run motors at a constant speed (20% power) for 12 feet.
motorSpeed(4,20);
goToAbsolutePosition(295);

//Reverse all motors
reverse(4);

//Run all motors at constant speed (30% power) for 1.5 seconds
motorSpeed(4,30);
goFor(1.5);

// Brake motors.
brake(4);

// And here——————————————————————————–

} // DO NOT REMOVE. end of void myCode()

 

Image of the installed reflectance sensors

Questions:

1.Discuss how the commands used in this lab may limit the success of the AEV in its completion of the scenario Hint: by applying the brake command, will an AEV stop right away?

 

The commands used in this lab seem to take a while to process, therefore the commands are not immediate and might limit the success of the AEV in its completion of the scenario. For example, when applying the brake command it will take a few seconds for the AEV to actually stop.

2. Describe the function of the reflectance sensors and their importance in completing the MCR.

The function of the reflectance sensors is to establish distance. The reflectors in the wheel send signals to the sensors, and every time they pass, the sensor detects it as a “mark”, the unit it uses for distance.