... | ... | @@ -155,8 +155,6 @@ If both bumpers are pressed, the car backs off a little and turn slightly to the |
|
|
|
|
|
The physical base setup in this test is identical to previously tests. In order to detect light in both directions a horizontal motor has been added to avoid having the car turn in each direction. The light sensor has been removed from the front of the car and attached to the horizontal motor. The setup is seen in the following image.
|
|
|
|
|
|
[INSERT IMAGE]
|
|
|
|
|
|
A the class `Follow` is replaced by a new class called `FollowSensorTurn` which make use of the NXT motor abstraction to turn the light sensor. To ensure that the light sensor performs accurate turns the method `rotate()` is used. This method takes a value in degrees as input and then uses the tachometer as feedback when turning the motor.
|
|
|
The structure of the code is similar to the Follow class. The light sensor is rotated 45 degrees the left, then to the right and in both cases a light value is acquired. Finally the light sensor is rotated to its initial position (pointing forward) and the powers for the two main motors are calculated. The main part of the `FollowSensorTurn` class is shown in the code snippet below.
|
|
|
|
... | ... | |