third_party/phoenixsuite/cpp/src/Sensors/PigeonIMU.cpp
/**
 * Get the status of the current (or previousley complete) calibration.
 *
 * @param statusToFill Container for the status information.
 * @return Error Code generated by function. 0 indicates no error.
 */
Get the status of the current (or previousley complete) calibration.
@param statusToFill Container for the status information.
@return Error Code generated by function. 0 indicates no error.
Get the status of the current ( or previousley complete ) calibration . @param statusToFill Container for the status information . @return Error Code generated by function . 0 indicates no error .
int PigeonIMU::GetGeneralStatus(PigeonIMU::GeneralStatus & statusToFill) {
	int state;
	int currentMode;
	int calibrationError;
	int bCalIsBooting;
	double tempC;
	int upTimeSec;
	int noMotionBiasCount;
	int tempCompensationCount;
	int lastError;
	int errCode = c_PigeonIMU_GetGeneralStatus(_handle, &state, &currentMode,
			&calibrationError, &bCalIsBooting, &tempC, &upTimeSec,
			&noMotionBiasCount, &tempCompensationCount, &lastError);
	statusToFill.currentMode = (PigeonIMU::CalibrationMode) currentMode;
	statusToFill.calibrationError = calibrationError;
	statusToFill.bCalIsBooting = bCalIsBooting;
	statusToFill.state = (PigeonIMU::PigeonState) state;
	statusToFill.tempC = tempC;
	statusToFill.noMotionBiasCount = noMotionBiasCount;
	statusToFill.tempCompensationCount = tempCompensationCount;
	statusToFill.upTimeSec = upTimeSec;
	statusToFill.lastError = errCode;
	if (errCode != 0) { 
		statusToFill.description =
				"Status frame was not received, check wired connections and web-based config.";
	} else if (statusToFill.bCalIsBooting) {
		statusToFill.description =
				"Pigeon is boot-caling to properly bias accel and gyro.  Do not move Pigeon.  When finished biasing, calibration mode will start.";
	} else if (statusToFill.state == UserCalibration) {
		switch (currentMode) {
		case BootTareGyroAccel:
			statusToFill.description =
					"Boot-Calibration: Gyro and Accelerometer are being biased.";
			break;
		case Temperature:
			statusToFill.description =
					"Temperature-Calibration: Pigeon is collecting temp data and will finish when temp range is reached.  "
							"Do not move Pigeon.";
			break;
		case Magnetometer12Pt:
			statusToFill.description =
					"Magnetometer Level 1 calibration: Orient the Pigeon PCB in the 12 positions documented in the User's Manual.";
			break;
		case Magnetometer360:
			statusToFill.description =
					"Magnetometer Level 2 calibration: Spin robot slowly in 360' fashion.  ";
			break;
		case Accelerometer:
			statusToFill.description =
					"Accelerometer Calibration: Pigeon PCB must be placed on a level source.  Follow User's Guide for how to level surfacee.  ";
			break;
		}
	} else if (statusToFill.state == Ready) {
		statusToFill.description =
				"Pigeon is running normally.  Last CAL error code was ";
		statusToFill.description += std::to_string(calibrationError);
		statusToFill.description += ".";
	} else if (statusToFill.state == Initializing) {
		statusToFill.description =
				"Pigeon is boot-caling to properly bias accel and gyro.  Do not move Pigeon.";
	} else {
		statusToFill.description = "Not enough data to determine status.";
	}
	return errCode;
}
int PigeonIMU :: GetGeneralStatus ( PigeonIMU :: GeneralStatus & statusToFill ) { int state ; int currentMode ; int calibrationError ; int bCalIsBooting ; double tempC ; int upTimeSec ; int noMotionBiasCount ; int tempCompensationCount ; int lastError ; int errCode = c_PigeonIMU_GetGeneralStatus ( _handle , & state , & currentMode , & calibrationError , & bCalIsBooting , & tempC , & upTimeSec , & noMotionBiasCount , & tempCompensationCount , & lastError ) ; statusToFill . currentMode = ( PigeonIMU :: CalibrationMode ) currentMode ; statusToFill . calibrationError = calibrationError ; statusToFill . bCalIsBooting = bCalIsBooting ; statusToFill . state = ( PigeonIMU :: PigeonState ) state ; statusToFill . tempC = tempC ; statusToFill . noMotionBiasCount = noMotionBiasCount ; statusToFill . tempCompensationCount = tempCompensationCount ; statusToFill . upTimeSec = upTimeSec ; statusToFill . lastError = errCode ; if ( errCode != 0 ) { statusToFill . description = " " ; } else if ( statusToFill . bCalIsBooting ) { statusToFill . description = " " ; } else if ( statusToFill . state == UserCalibration ) { switch ( currentMode ) { case BootTareGyroAccel : statusToFill . description = " " ; break ; case Temperature : statusToFill . description = " " " " ; break ; case Magnetometer12Pt : statusToFill . description = " " ; break ; case Magnetometer360 : statusToFill . description = " " ; break ; case Accelerometer : statusToFill . description = " " ; break ; } } else if ( statusToFill . state == Ready ) { statusToFill . description = " " ; statusToFill . description += std :: to_string ( calibrationError ) ; statusToFill . description += " " ; } else if ( statusToFill . state == Initializing ) { statusToFill . description = " " ; } else { statusToFill . description = " " ; } return errCode ; }
Get the status of the current (or previousley complete) calibration.
Get the status of the current ( or previousley complete ) calibration .
/* build description string */ // same as NoComm /* mode specific descriptions */ /* definitely not doing anything cal-related.  So just instrument the motion driver state */ /* definitely not doing anything cal-related.  So just instrument the motion driver state */