Xtreme Robot Olympiad Programming with Sensors Dr. Peter Laz Associate Professor Department of...

15
Xtreme Robot Olympiad Programming with Sensors Dr. Peter Laz Associate Professor Department of Engineering University of Denver

Transcript of Xtreme Robot Olympiad Programming with Sensors Dr. Peter Laz Associate Professor Department of...

Xtreme Robot OlympiadProgramming with Sensors

Dr. Peter Laz Associate Professor

Department of EngineeringUniversity of Denver

Outline

• Microcontroller architecture• Digital versus analog signals

• Line sensors

• Ultrasonic sensors

• Programming with EasyC

Robot Control

• We programmed the vehicle to perform specific actions • Drive in a square• “dead reckoning”

• By adding sensors, we can make the vehicle “smart” by making decisions based on the readings of the sensor

Digital versus Analog

• Digital signals• Two levels: 0 or 1• Binary

• Analog signals• Infinite number of levels• Signals can be between 0 and 1000• Calibrate readings to physical meaning

Microcontroller• Ports have different types of signals

• Analog 1-4• Digital 5-10

Motors

InterruptsAnalog/Digital Signals (Sensors)

Line Sensor• Uses an Infrared (IR) LED emitter and detector

to measure intensity• LED = light emitting diode

• Distance of the sensor to surface will affect readings

Emitter Detector

Sensor

Ultrasonic Sensor

• Uses ultrasound to measure time for a pulse to bounce off of an object• Time and known speed to sound distance

• Sound waves must reflect off the object• Difficulty with curved objects

Emitter

Detector

Sensor Object

Exercises

• Download LinefollowerTest.ecp• What reading corresponds to white?• What reading corresponds to black?• Test how distance from the surface affects the

reading

• Download UltrasonicTest.ecp• How does the reading vary with distance?• How close can you get?• What reading do you get with a curved surface?

The Grand Challenge

• Two competitions• Autonomous maze

• Navigate through a maze using sensors and autonomous control

• Additional time bonus for stopping within 2” of the wall without touching it

• New adventure race with your team’s best driver

The Grand Challenge

• Teams will use the same vehicle for both competitions• Exception different programs will be downloaded

• Autonomous maze 50 pts

• Adventure race 50 pts

Line Follower Logic

Left Right Left Center Right

• Use multiple sensors together to make a “smart” line following robot

• What decisions are made based on the readings on the different sensors?

Two Sensor Configuration Three Sensor Configuration

Line Follower Logic

• If both see line • Then go _______

• If left sensor sees line• Then turn _______

• If right sensor sees line• Then turn _______

• If no sensors see line• Then _______

Left Right

Two Sensor Configuration

Line Follower Logic

• What sensor reading is on the line?• How much do you turn?• How fast can you go without losing the line?

• Develop a robust program• Consider what to do if you lose the line• Consider right angles and “T”s

• If … then … or If … then … else …

Exercises

1. Write a code to follow the line• Use the test field to test your program• Program and test

2. Develop a code to earn the stopping distance bonus

3. Make changes to your vehicle for the final mission• Again, hanging bonus is in play

This workforce solution was funded by a grant awarded under the Workforce Innovation in Regional Development (WIRED) as implemented by the U.S. Department of Labor’s Employment and Training Administration working in partnership with the Colorado Department of Labor and Employment, the Metro Denver Economic Development Corporation, and the City and County of Denver's Office of Economic Development.  The solution was created by the grantee and does not necessarily reflect the official position of the U.S. Department of Labor.  The Department of Labor makes no guarantees, warranties, or assurances of any kind, express or implied, with respect to such information, including any information on linked sites and including, but not limited to, accuracy of the information or its completeness, timeliness, usefulness, adequacy, continued availability, or ownership.  This solution is copyrighted by the institution that created it. Internal use by an organization and/or personal use by an individual for non-commercial purposes is permissible.  All other uses require the prior authorization of the copyright owner.