54 void initialize(
bool calibrateAccels,
bool calibrateMags);
57 enum CALIBRATION_STATE {
78 void doStartBiasAndLeveling();
81 void doStartNoBiasLeveling();
84 void doStartOrientation();
87 void doStartSixPoint();
90 void doCancelSixPoint();
93 void doSaveSixPointPosition();
96 void doStartTempCal();
99 void doAcceptTempCal();
102 void doCancelTempCalPoint();
116 void setTempCalRange(
int r);
120 void calibrationBusy(
bool busy);
122 void toggleControls(
bool enable);
125 void toggleSavePosition(
bool enable);
128 void updatePlane(
int position);
131 void showSixPointMessage(QString message);
134 void showYawOrientationMessage(QString message);
137 void showLevelingMessage(QString message);
140 void yawOrientationProgressChanged(
int);
143 void levelingProgressChanged(
int);
146 void sixPointProgressChanged(
int);
149 void showTempCalMessage(QString message);
152 void tempCalProgressChanged(
int);
155 void calibrationCompleted();
159 void setMetadata(QMap<QString, UAVObject::Metadata> metaList);
162 void doStartLeveling();
171 void assignUpdateRate(
UAVObject *obj, quint32 updatePeriod);
179 bool calibrateAccels;
188 QMap<QString, UAVObject::Metadata> originalMetaData;
191 QMap<QString, UAVObject::Metadata> slowedDownMetaDataList;
204 double gyro_data_x[6], gyro_data_y[6], gyro_data_z[6];
205 double accel_data_x[6], accel_data_y[6], accel_data_z[6];
206 double mag_data_x[6], mag_data_y[6], mag_data_z[6];
208 static const int NUM_SENSOR_UPDATES_LEVELING = 300;
209 static const int NUM_SENSOR_UPDATES_YAW_ORIENTATION = 300;
210 static const int NUM_SENSOR_UPDATES_SIX_POINT = 100;
211 static const int SENSOR_UPDATE_PERIOD = 25;
212 static const int NON_SENSOR_UPDATE_PERIOD = 0;
214 double min_temperature_range;
215 double boardRotationMatrix[3][3];
216 double initialAccelsScale[3];
217 double initialAccelsBias[3];
218 double initialMagsScale[3];
219 double initialMagsBias[3];
229 void connectSensor(sensor_type sensor,
bool connect);
232 bool storeSixPointMeasurement(
UAVObject *obj,
int position);
235 bool storeYawOrientationMeasurement(
UAVObject *obj);
238 bool storeLevelingMeasurement(
UAVObject *obj);
241 int computeScaleBias();
243 int SixPointInConstFieldCal(
double ConstMag,
double x[6],
double y[6],
double z[6],
double S[3],
247 void rotate_vector(
double R[3][3],
const double vec[3],
double vec_out[3],
bool transpose);
250 void Euler2R(
double rpy[3],
double Rbe[3][3]);
255 return std::accumulate(list.begin(), list.end(), 0.0) / list.size();
259 void resetSensorCalibrationToOriginalValues();
262 bool storeTempCalMeasurement(
UAVObject *obj);
265 int computeTempCal();
268 void updateTempCompCalibrationDisplay();
271 #endif // CALIBRATION_H
The Calibration class is a UI free algorithm that can be connected to any interfaces. As such it only communicates with the UI via signals and slots, but has no direct handles to any particular controls or widgets.
static double listMean(QList< double > list)
Compute the mean value of a list.