@Override
public void teleopPeriodic() {
Scheduler.getInstance().run();
- System.out.println("Heading: " + imu.getHeading() + " Init: "
- + imu.isInitialized() + " Calib: " + imu.isCalibrated());
+ if (imu.isInitialized()) {
+ System.out.println(imu.getHeading());
+ }
+ // System.out.println("Heading: "
+ // + imu.getHeading() + " Init: "
+ // + imu.isInitialized() + " Calib: " + imu.isCalibrated());
}
}
}
/**
- * Heading not relative to the starting angle of the robot.
+ * The default sensor heading not relative to the starting angle of the robot.
*
* @return
*/
- public double getRawHeading() {
+ public double getDefaultHeading() {
return xyz[0] + turns * 360;
}
/**
- * The heading of the sensor (x axis) in continuous format. Eg rotating the
+ * The heading of the sensor (x axis) in continuous format relative to the
+ * initial heading of the robot. Eg rotating the
* sensor clockwise two full rotations will return a value of 720 degrees.
* The getVector method will return heading in a constrained 0 - 360 deg
* format if required.
* @return heading in degrees
*/
public double getHeading() {
- double reading = getRawHeading();
+ double reading = getDefaultHeading();
return reading - zeroReferenceConst;
}