Book Image

Learning Lego Mindstorms EV3

By : Gary Garber
Book Image

Learning Lego Mindstorms EV3

By: Gary Garber

Overview of this book

Table of Contents (19 chapters)
Learning LEGO MINDSTORMS EV3
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
10
Other Programming Languages
Index

Triangulation


In aviation, pilots can use two non-directional beacons to triangulate their position. The instrument that tells us the heading of the beacons on an airplane is called the Automatic Direction Finder (ADF). If you have two IR beacons, you can do a similar thing with just one IR sensor mounted on your robot. One disadvantage of the heading indicator from the beacon is that the values are not in the degrees that the Gyro Sensor uses. Still, with some effort you can use two beacons to do some basic triangulation.

In the following program, we use two IR beacons. Each beacon is set to a different channel. Set the first beacon to channel 1. Set the second beacon to channel 2. The IR sensor should be on the front of your robot. Choose a location that you want the robot to navigate back to and place your robot at that point. It is helpful to angle the beacons towards the robot. When you run the program, the robot will first turn towards beacon 1 and take a proximity measurement. Then...