mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-11 19:24:10 +01:00
9b28f2d72c
Calibration should take less time now too (using second moments to estimate variance in one pass). Now need to change to multiple messages to get the calibration in to keep the request message size minimal. Also currently running sensor calibrate doesn't store the gyro bias so if you want to use this you'll have to tweak it manually. I'll fix that step tomorrow. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1741 ebee16cc-31ac-478f-84a7-5cbb03baadba
148 lines
6.9 KiB
C
148 lines
6.9 KiB
C
/**
|
|
******************************************************************************
|
|
* @addtogroup UAVObjects OpenPilot UAVObjects
|
|
* @{
|
|
* @addtogroup AHRSCalibration AHRSCalibration
|
|
* @brief Contains the calibration settings for the @ref AHRSCommsModule
|
|
*
|
|
* Autogenerated files and functions for AHRSCalibration Object
|
|
|
|
* @{
|
|
*
|
|
* @file ahrscalibration.h
|
|
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
|
* @brief Implementation of the AHRSCalibration object. This file has been
|
|
* automatically generated by the UAVObjectGenerator.
|
|
*
|
|
* @note Object definition file: ahrscalibration.xml.
|
|
* This is an automatically generated file.
|
|
* DO NOT modify manually.
|
|
*
|
|
* @see The GNU Public License (GPL) Version 3
|
|
*
|
|
*****************************************************************************/
|
|
/*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful, but
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
* for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
*/
|
|
|
|
#ifndef AHRSCALIBRATION_H
|
|
#define AHRSCALIBRATION_H
|
|
|
|
// Object constants
|
|
#define AHRSCALIBRATION_OBJID 1408636690U
|
|
#define AHRSCALIBRATION_NAME "AHRSCalibration"
|
|
#define AHRSCALIBRATION_METANAME "AHRSCalibrationMeta"
|
|
#define AHRSCALIBRATION_ISSINGLEINST 1
|
|
#define AHRSCALIBRATION_ISSETTINGS 1
|
|
#define AHRSCALIBRATION_NUMBYTES sizeof(AHRSCalibrationData)
|
|
|
|
// Object access macros
|
|
/**
|
|
* @function AHRSCalibrationGet(dataOut)
|
|
* @brief Populate a AHRSCalibrationData object
|
|
* @param[out] dataOut
|
|
*/
|
|
#define AHRSCalibrationGet(dataOut) UAVObjGetData(AHRSCalibrationHandle(), dataOut)
|
|
#define AHRSCalibrationSet(dataIn) UAVObjSetData(AHRSCalibrationHandle(), dataIn)
|
|
#define AHRSCalibrationInstGet(instId, dataOut) UAVObjGetInstanceData(AHRSCalibrationHandle(), instId, dataOut)
|
|
#define AHRSCalibrationInstSet(instId, dataIn) UAVObjSetInstanceData(AHRSCalibrationHandle(), instId, dataIn)
|
|
#define AHRSCalibrationConnectQueue(queue) UAVObjConnectQueue(AHRSCalibrationHandle(), queue, EV_MASK_ALL_UPDATES)
|
|
#define AHRSCalibrationConnectCallback(cb) UAVObjConnectCallback(AHRSCalibrationHandle(), cb, EV_MASK_ALL_UPDATES)
|
|
#define AHRSCalibrationCreateInstance() UAVObjCreateInstance(AHRSCalibrationHandle())
|
|
#define AHRSCalibrationRequestUpdate() UAVObjRequestUpdate(AHRSCalibrationHandle())
|
|
#define AHRSCalibrationRequestInstUpdate(instId) UAVObjRequestInstanceUpdate(AHRSCalibrationHandle(), instId)
|
|
#define AHRSCalibrationUpdated() UAVObjUpdated(AHRSCalibrationHandle())
|
|
#define AHRSCalibrationInstUpdated(instId) UAVObjUpdated(AHRSCalibrationHandle(), instId)
|
|
#define AHRSCalibrationGetMetadata(dataOut) UAVObjGetMetadata(AHRSCalibrationHandle(), dataOut)
|
|
#define AHRSCalibrationSetMetadata(dataIn) UAVObjSetMetadata(AHRSCalibrationHandle(), dataIn)
|
|
#define AHRSCalibrationReadOnly(dataIn) UAVObjReadOnly(AHRSCalibrationHandle())
|
|
|
|
// Object data
|
|
typedef struct {
|
|
uint8_t measure_var;
|
|
float accel_bias[3];
|
|
float accel_scale[3];
|
|
float accel_var[3];
|
|
float gyro_bias[3];
|
|
float gyro_scale[3];
|
|
float gyro_var[3];
|
|
float mag_bias[3];
|
|
float mag_scale[3];
|
|
float mag_var[3];
|
|
|
|
} __attribute__((packed)) AHRSCalibrationData;
|
|
|
|
// Field information
|
|
// Field measure_var information
|
|
/* Enumeration options for field measure_var */
|
|
typedef enum { AHRSCALIBRATION_MEASURE_VAR_SET=0, AHRSCALIBRATION_MEASURE_VAR_MEASURE=1, AHRSCALIBRATION_MEASURE_VAR_ECHO=2 } AHRSCalibrationmeasure_varOptions;
|
|
// Field accel_bias information
|
|
/* Array element names for field accel_bias */
|
|
typedef enum { AHRSCALIBRATION_ACCEL_BIAS_X=0, AHRSCALIBRATION_ACCEL_BIAS_Y=1, AHRSCALIBRATION_ACCEL_BIAS_Z=2 } AHRSCalibrationaccel_biasElem;
|
|
/* Number of elements for field accel_bias */
|
|
#define AHRSCALIBRATION_ACCEL_BIAS_NUMELEM 3
|
|
// Field accel_scale information
|
|
/* Array element names for field accel_scale */
|
|
typedef enum { AHRSCALIBRATION_ACCEL_SCALE_X=0, AHRSCALIBRATION_ACCEL_SCALE_Y=1, AHRSCALIBRATION_ACCEL_SCALE_Z=2 } AHRSCalibrationaccel_scaleElem;
|
|
/* Number of elements for field accel_scale */
|
|
#define AHRSCALIBRATION_ACCEL_SCALE_NUMELEM 3
|
|
// Field accel_var information
|
|
/* Array element names for field accel_var */
|
|
typedef enum { AHRSCALIBRATION_ACCEL_VAR_X=0, AHRSCALIBRATION_ACCEL_VAR_Y=1, AHRSCALIBRATION_ACCEL_VAR_Z=2 } AHRSCalibrationaccel_varElem;
|
|
/* Number of elements for field accel_var */
|
|
#define AHRSCALIBRATION_ACCEL_VAR_NUMELEM 3
|
|
// Field gyro_bias information
|
|
/* Array element names for field gyro_bias */
|
|
typedef enum { AHRSCALIBRATION_GYRO_BIAS_X=0, AHRSCALIBRATION_GYRO_BIAS_Y=1, AHRSCALIBRATION_GYRO_BIAS_Z=2 } AHRSCalibrationgyro_biasElem;
|
|
/* Number of elements for field gyro_bias */
|
|
#define AHRSCALIBRATION_GYRO_BIAS_NUMELEM 3
|
|
// Field gyro_scale information
|
|
/* Array element names for field gyro_scale */
|
|
typedef enum { AHRSCALIBRATION_GYRO_SCALE_X=0, AHRSCALIBRATION_GYRO_SCALE_Y=1, AHRSCALIBRATION_GYRO_SCALE_Z=2 } AHRSCalibrationgyro_scaleElem;
|
|
/* Number of elements for field gyro_scale */
|
|
#define AHRSCALIBRATION_GYRO_SCALE_NUMELEM 3
|
|
// Field gyro_var information
|
|
/* Array element names for field gyro_var */
|
|
typedef enum { AHRSCALIBRATION_GYRO_VAR_X=0, AHRSCALIBRATION_GYRO_VAR_Y=1, AHRSCALIBRATION_GYRO_VAR_Z=2 } AHRSCalibrationgyro_varElem;
|
|
/* Number of elements for field gyro_var */
|
|
#define AHRSCALIBRATION_GYRO_VAR_NUMELEM 3
|
|
// Field mag_bias information
|
|
/* Array element names for field mag_bias */
|
|
typedef enum { AHRSCALIBRATION_MAG_BIAS_X=0, AHRSCALIBRATION_MAG_BIAS_Y=1, AHRSCALIBRATION_MAG_BIAS_Z=2 } AHRSCalibrationmag_biasElem;
|
|
/* Number of elements for field mag_bias */
|
|
#define AHRSCALIBRATION_MAG_BIAS_NUMELEM 3
|
|
// Field mag_scale information
|
|
/* Array element names for field mag_scale */
|
|
typedef enum { AHRSCALIBRATION_MAG_SCALE_X=0, AHRSCALIBRATION_MAG_SCALE_Y=1, AHRSCALIBRATION_MAG_SCALE_Z=2 } AHRSCalibrationmag_scaleElem;
|
|
/* Number of elements for field mag_scale */
|
|
#define AHRSCALIBRATION_MAG_SCALE_NUMELEM 3
|
|
// Field mag_var information
|
|
/* Array element names for field mag_var */
|
|
typedef enum { AHRSCALIBRATION_MAG_VAR_X=0, AHRSCALIBRATION_MAG_VAR_Y=1, AHRSCALIBRATION_MAG_VAR_Z=2 } AHRSCalibrationmag_varElem;
|
|
/* Number of elements for field mag_var */
|
|
#define AHRSCALIBRATION_MAG_VAR_NUMELEM 3
|
|
|
|
|
|
// Generic interface functions
|
|
int32_t AHRSCalibrationInitialize();
|
|
UAVObjHandle AHRSCalibrationHandle();
|
|
|
|
#endif // AHRSCALIBRATION_H
|
|
|
|
/**
|
|
* @}
|
|
* @}
|
|
*/
|