Fixed up to ball search.
This commit is contained in:
@@ -78,7 +78,7 @@ public class RyABI {
|
||||
pilot = new CompassPilot(compass, WHEEL_DIAMETER, TRACK_WIDTH, Motor.A, Motor.C);
|
||||
|
||||
/* Create the feature detectors. */
|
||||
rangeDetector = new RangeFeatureDetector(sonar, 20, 200);
|
||||
rangeDetector = new RangeFeatureDetector(sonar, 30, 200);
|
||||
touchDetector = new TouchFeatureDetector(touch);
|
||||
lightDetector = new LightFeatureDetector(light, invertLightDetector);
|
||||
|
||||
|
@@ -96,7 +96,6 @@ public class SearchBallBehavior extends BaseBehavior {
|
||||
|
||||
@Override
|
||||
public void action() {
|
||||
while(!supress) {
|
||||
if(queue.hasNextRangeSensorEvent()) {
|
||||
/* If the pedestal has been found then stop the robot and set the state to BALL_FOUND. */
|
||||
if(pilot.isMoving())
|
||||
@@ -158,7 +157,6 @@ public class SearchBallBehavior extends BaseBehavior {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void suppress() {
|
||||
|
@@ -54,7 +54,7 @@ public class SensorCalibrationBehavior extends BaseBehavior {
|
||||
/* Calibrate the compass by turning slowly by 720 degrees. */
|
||||
System.out.println("Calib. compass");
|
||||
DifferentialPilot p = new DifferentialPilot(wheelDiameter, trackWidth, Motor.A, Motor.C);
|
||||
p.setRotateSpeed(25);
|
||||
p.setRotateSpeed(20);
|
||||
compass.startCalibration();
|
||||
p.rotate(720, false);
|
||||
compass.stopCalibration();
|
||||
|
@@ -36,8 +36,9 @@ public abstract class Rotations {
|
||||
diff = 90.0f - cMeasure;
|
||||
do {
|
||||
pilot.rotate(diff);
|
||||
cMeasure = compass.getDegreesCartesian();
|
||||
cMeasure = 360.0f - compass.getDegreesCartesian();
|
||||
diff = 90.0f - cMeasure;
|
||||
System.out.println(cMeasure + " " + diff);
|
||||
} while(Math.abs(diff) > 1.0f);
|
||||
|
||||
pilot.stop();
|
||||
@@ -60,6 +61,7 @@ public abstract class Rotations {
|
||||
pilot.rotate(diff);
|
||||
cMeasure = compass.getDegreesCartesian();
|
||||
diff = -90 + cMeasure;
|
||||
System.out.println(cMeasure + " " + diff);
|
||||
} while(Math.abs(diff) > 1.0f);
|
||||
|
||||
pilot.stop();
|
||||
|
Reference in New Issue
Block a user