I've recently started working on a project focusing on swarmed exploration. Right now I am in the very early stages, but am having some trouble with the CompassSensor (I'm trying to avoid the CompassPilot since it has been deprecated, I am using the 0.9.0 build).
The issue I'm having is that the sensor doesn't seem to be behaving at all as it should. This is my calibration method, which seems to work correctly:
- Code: Select all
private void calibrate()
{
compass.startCalibration();
pilot.setRotateSpeed(18);
long start = System.currentTimeMillis();
pilot.rotateRight();
while((System.currentTimeMillis() - start) < 40*1000);
pilot.stop();
compass.stopCalibration();
}
The issues that I'm having come after this step. If I call
- Code: Select all
compass.resetCartesianZero();
float degree = compass.getDegreesCartesian();
degree will be some nonzero value. If I turn the robot by 90 degrees using a DifferentialPilot, the Cartesian degree value will change by some seemingly random interval, usually around 140 degrees.
Is this the expected behavior and I'm somehow misunderstanding, or am I doing something incorrectly? I could post the full code here, but there is a rather large amount of irrelevant code that isn't really relevant.
Also, the documentation mentions using a CompassSensor along with a PoseProvider, and I've been a little bit confused on how one would accomplish that. Can anyone shed some light for me?
Thanks for any help,
Jordan
