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

Tracking a circle


Using the beacon and the IR sensor, you can program your robot to drive in a circle while maintaining a constant radius relative to the beacon. To do this, the IR sensor should be mounted on the robot pointed to the side as shown in the following screenshot. The robot should be set up to drive a circumference of a circle.

Remember, the IR beacon has a limited cone of emission, so you will need to start the robot within about a 45 degree cone of the front of the beacon. This program will work better for larger distances (more than a meter). Your gain constant values will vary depending on the type of robot you use. If you were to set the beacon standing on its end, you can actually track a wider circle. However, the radius will be smaller when the robot travels around the back of the beacon since there is opaque plastic blocking some of the signal. To do this, you should use a smaller radius of about half a meter. The program starts out by sending the proximity to the beacon...