上QQ阅读APP看书,第一时间看更新
Proportional steering
The EV3 infrared sensor measures a beacon heading value from -25 to +25. A heading value of 0 indicates that the beacon is directly in front of the sensor. A positive value indicates that the beacon is to the right of the sensor, and a negative value indicates that the beacon is to the left. The magnitude of the heading value indicates how far the beacon is from the center. For example, a heading value of 5 means that the beacon is slightly to the right of the sensor, while a value of 23 would indicate that the beacon is far to the right of the sensor. The program will use both direction and magnitude to adjust its steering. This is called a proportional beacon follower, and it enables the robot to make smooth driving adjustments.
Proportional logic refers to a feedback loop in which the correction made by the system is proportional to the observed error. In our example, the tank will make a sharper turn if the beacon is farther away from the center of its vision. Here, proportional logic is applied to our beacon following program. Later in this book, we will apply it in other ways.