Building Smart LEGO MINDSTORMS EV3 Robots
上QQ阅读APP看书,第一时间看更新

Following the beacon

The robot needs to steer itself while it follows the beacon. IR 1 will read the heading of the nearby beacon, and the robot will use the heading value to adjust its steering to keep itself on track with the beacon. IR 1 will also measure the distance to the beacon so that it can slow down when the beacon gets closer.

Add another IR sensor block and set its mode to Measure | Beacon. This time, make sure that the sensor port is set to 1. We will be using the first two outputs of this block: heading and proximity.