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

IR sensor navigation and beacon tracking


One of the simplest uses of the IR sensor and the IR beacon is to have the robot seek out the beacon. The program to have the robot seek the beacon is simple and again uses a proportional controller. The sensor block values of heading for the beacon range from -25 to 25. In the following program, my correction is going into the steering plug of a Move Steering block. Since the steering input values of the Move Steering block range from -100 to 100, you want to have a gain of 4 in the program. Make sure your beacon is set to the same channel as your sensor block, which in this case is channel 1.

If your robot turns in the wrong direction, you can either swap which cable the motors are connected to or change the gain constant to -4.

Navigating a field with the IR sensor and the beacon may not be as obvious as using the Ultrasonic motion sensor and the Gyro Sensor. However, if you read about approach paths used in aviation using non-directional beacons...