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