mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-04-11 03:02:20 +02:00
OP-1149 Move accel/gyro calibration setting to a separate object, to be reused also for CC3D
This commit is contained in:
parent
558e2e1437
commit
7ac2f9f87f
@ -55,6 +55,7 @@
|
|||||||
#include <attitudestate.h>
|
#include <attitudestate.h>
|
||||||
#include <attitudesettings.h>
|
#include <attitudesettings.h>
|
||||||
#include <revocalibration.h>
|
#include <revocalibration.h>
|
||||||
|
#include <accelgyrosettings.h>
|
||||||
#include <flightstatus.h>
|
#include <flightstatus.h>
|
||||||
#include <taskinfo.h>
|
#include <taskinfo.h>
|
||||||
|
|
||||||
@ -78,6 +79,7 @@ static void settingsUpdatedCb(UAVObjEvent *objEv);
|
|||||||
// Private variables
|
// Private variables
|
||||||
static xTaskHandle sensorsTaskHandle;
|
static xTaskHandle sensorsTaskHandle;
|
||||||
RevoCalibrationData cal;
|
RevoCalibrationData cal;
|
||||||
|
AccelGyroSettingsData agcal;
|
||||||
|
|
||||||
// These values are initialized by settings but can be updated by the attitude algorithm
|
// These values are initialized by settings but can be updated by the attitude algorithm
|
||||||
|
|
||||||
@ -116,12 +118,13 @@ int32_t SensorsInitialize(void)
|
|||||||
MagSensorInitialize();
|
MagSensorInitialize();
|
||||||
RevoCalibrationInitialize();
|
RevoCalibrationInitialize();
|
||||||
AttitudeSettingsInitialize();
|
AttitudeSettingsInitialize();
|
||||||
|
AccelGyroSettingsInitialize();
|
||||||
|
|
||||||
rotate = 0;
|
rotate = 0;
|
||||||
|
|
||||||
RevoCalibrationConnectCallback(&settingsUpdatedCb);
|
RevoCalibrationConnectCallback(&settingsUpdatedCb);
|
||||||
AttitudeSettingsConnectCallback(&settingsUpdatedCb);
|
AttitudeSettingsConnectCallback(&settingsUpdatedCb);
|
||||||
|
AccelGyroSettingsConnectCallback(&settingsUpdatedCb);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -437,32 +440,32 @@ static void SensorsTask(__attribute__((unused)) void *parameters)
|
|||||||
static void settingsUpdatedCb(__attribute__((unused)) UAVObjEvent *objEv)
|
static void settingsUpdatedCb(__attribute__((unused)) UAVObjEvent *objEv)
|
||||||
{
|
{
|
||||||
RevoCalibrationGet(&cal);
|
RevoCalibrationGet(&cal);
|
||||||
|
AccelGyroSettingsGet(&agcal);
|
||||||
mag_bias[0] = cal.mag_bias.X;
|
mag_bias[0] = cal.mag_bias.X;
|
||||||
mag_bias[1] = cal.mag_bias.Y;
|
mag_bias[1] = cal.mag_bias.Y;
|
||||||
mag_bias[2] = cal.mag_bias.Z;
|
mag_bias[2] = cal.mag_bias.Z;
|
||||||
mag_scale[0] = cal.mag_scale.X;
|
mag_scale[0] = cal.mag_scale.X;
|
||||||
mag_scale[1] = cal.mag_scale.Y;
|
mag_scale[1] = cal.mag_scale.Y;
|
||||||
mag_scale[2] = cal.mag_scale.Z;
|
mag_scale[2] = cal.mag_scale.Z;
|
||||||
accel_bias[0] = cal.accel_bias.X;
|
accel_bias[0] = agcal.accel_bias.X;
|
||||||
accel_bias[1] = cal.accel_bias.Y;
|
accel_bias[1] = agcal.accel_bias.Y;
|
||||||
accel_bias[2] = cal.accel_bias.Z;
|
accel_bias[2] = agcal.accel_bias.Z;
|
||||||
accel_scale[0] = cal.accel_scale.X;
|
accel_scale[0] = agcal.accel_scale.X;
|
||||||
accel_scale[1] = cal.accel_scale.Y;
|
accel_scale[1] = agcal.accel_scale.Y;
|
||||||
accel_scale[2] = cal.accel_scale.Z;
|
accel_scale[2] = agcal.accel_scale.Z;
|
||||||
gyro_staticbias[0] = cal.gyro_bias.X;
|
gyro_staticbias[0] = agcal.gyro_bias.X;
|
||||||
gyro_staticbias[1] = cal.gyro_bias.Y;
|
gyro_staticbias[1] = agcal.gyro_bias.Y;
|
||||||
gyro_staticbias[2] = cal.gyro_bias.Z;
|
gyro_staticbias[2] = agcal.gyro_bias.Z;
|
||||||
gyro_scale[0] = cal.gyro_scale.X;
|
gyro_scale[0] = agcal.gyro_scale.X;
|
||||||
gyro_scale[1] = cal.gyro_scale.Y;
|
gyro_scale[1] = agcal.gyro_scale.Y;
|
||||||
gyro_scale[2] = cal.gyro_scale.Z;
|
gyro_scale[2] = agcal.gyro_scale.Z;
|
||||||
gyro_temp_coeff[0] = cal.gyro_temp_coeff.X;
|
gyro_temp_coeff[0] = agcal.gyro_temp_coeff.X;
|
||||||
gyro_temp_coeff[1] = cal.gyro_temp_coeff.Y;
|
gyro_temp_coeff[1] = agcal.gyro_temp_coeff.Y;
|
||||||
gyro_temp_coeff[2] = cal.gyro_temp_coeff.Z;
|
gyro_temp_coeff[2] = agcal.gyro_temp_coeff.Z;
|
||||||
gyro_temp_coeff[3] = cal.gyro_temp_coeff.Z2;
|
gyro_temp_coeff[3] = agcal.gyro_temp_coeff.Z2;
|
||||||
accel_temp_coeff[0] = cal.accel_temp_coeff.X;
|
accel_temp_coeff[0] = agcal.accel_temp_coeff.X;
|
||||||
accel_temp_coeff[1] = cal.accel_temp_coeff.Y;
|
accel_temp_coeff[1] = agcal.accel_temp_coeff.Y;
|
||||||
accel_temp_coeff[2] = cal.accel_temp_coeff.Z;
|
accel_temp_coeff[2] = agcal.accel_temp_coeff.Z;
|
||||||
|
|
||||||
AttitudeSettingsData attitudeSettings;
|
AttitudeSettingsData attitudeSettings;
|
||||||
AttitudeSettingsGet(&attitudeSettings);
|
AttitudeSettingsGet(&attitudeSettings);
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
# These are the UAVObjects supposed to be build as part of the OpenPilot target
|
# These are the UAVObjects supposed to be build as part of the OpenPilot target
|
||||||
# (all architectures)
|
# (all architectures)
|
||||||
UAVOBJSRCFILENAMES =
|
UAVOBJSRCFILENAMES =
|
||||||
|
UAVOBJSRCFILENAMES += accelgyrosettings
|
||||||
UAVOBJSRCFILENAMES += accessorydesired
|
UAVOBJSRCFILENAMES += accessorydesired
|
||||||
UAVOBJSRCFILENAMES += actuatorcommand
|
UAVOBJSRCFILENAMES += actuatorcommand
|
||||||
UAVOBJSRCFILENAMES += actuatordesired
|
UAVOBJSRCFILENAMES += actuatordesired
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
# (all architectures)
|
# (all architectures)
|
||||||
|
|
||||||
UAVOBJSRCFILENAMES =
|
UAVOBJSRCFILENAMES =
|
||||||
|
UAVOBJSRCFILENAMES += accelgyrosettings
|
||||||
UAVOBJSRCFILENAMES += accessorydesired
|
UAVOBJSRCFILENAMES += accessorydesired
|
||||||
UAVOBJSRCFILENAMES += actuatorcommand
|
UAVOBJSRCFILENAMES += actuatorcommand
|
||||||
UAVOBJSRCFILENAMES += actuatordesired
|
UAVOBJSRCFILENAMES += actuatordesired
|
||||||
|
16
shared/uavobjectdefinition/accelgyrosettings.xml
Normal file
16
shared/uavobjectdefinition/accelgyrosettings.xml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<xml>
|
||||||
|
<object name="AccelGyroSettings" singleinstance="true" settings="true" category="Sensors">
|
||||||
|
<description>Settings for Accelerometer and Gyroscope calibration </description>
|
||||||
|
<!-- Sensor calibration -->
|
||||||
|
<field name="accel_bias" units="m/s" type="float" elementnames="X,Y,Z" defaultvalue="0,0,0"/>
|
||||||
|
<field name="accel_scale" units="gain" type="float" elementnames="X,Y,Z" defaultvalue="1,1,1"/>
|
||||||
|
<field name="accel_temp_coeff" units="" type="float" elementnames="X,Y,Z" defaultvalue="0"/>
|
||||||
|
<field name="gyro_bias" units="deg/s" type="float" elementnames="X,Y,Z" defaultvalue="0,0,0"/>
|
||||||
|
<field name="gyro_scale" units="gain" type="float" elementnames="X,Y,Z" defaultvalue="1,1,1"/>
|
||||||
|
<field name="gyro_temp_coeff" units="" type="float" elementnames="X,Y,Z,Z2" defaultvalue="0"/>
|
||||||
|
<access gcs="readwrite" flight="readwrite"/>
|
||||||
|
<telemetrygcs acked="true" updatemode="onchange" period="0"/>
|
||||||
|
<telemetryflight acked="true" updatemode="onchange" period="0"/>
|
||||||
|
<logging updatemode="manual" period="0"/>
|
||||||
|
</object>
|
||||||
|
</xml>
|
@ -1,23 +1,12 @@
|
|||||||
<xml>
|
<xml>
|
||||||
<object name="RevoCalibration" singleinstance="true" settings="true" category="Sensors">
|
<object name="RevoCalibration" singleinstance="true" settings="true" category="Sensors">
|
||||||
<description>Settings for the INS to control the algorithm and what is updated</description>
|
<description>Settings for the INS to control the algorithm and what is updated</description>
|
||||||
|
|
||||||
|
|
||||||
<!-- Sensor calibration -->
|
|
||||||
<field name="accel_bias" units="m/s" type="float" elementnames="X,Y,Z" defaultvalue="0,0,0"/>
|
|
||||||
<field name="accel_scale" units="gain" type="float" elementnames="X,Y,Z" defaultvalue="1,1,1"/>
|
|
||||||
<field name="accel_temp_coeff" units="" type="float" elementnames="X,Y,Z" defaultvalue="0"/>
|
|
||||||
<field name="gyro_bias" units="deg/s" type="float" elementnames="X,Y,Z" defaultvalue="0,0,0"/>
|
|
||||||
<field name="gyro_scale" units="gain" type="float" elementnames="X,Y,Z" defaultvalue="1,1,1"/>
|
|
||||||
<field name="gyro_temp_coeff" units="" type="float" elementnames="X,Y,Z,Z2" defaultvalue="0"/>
|
|
||||||
<field name="mag_bias" units="mGau" type="float" elementnames="X,Y,Z" defaultvalue="0,0,0"/>
|
<field name="mag_bias" units="mGau" type="float" elementnames="X,Y,Z" defaultvalue="0,0,0"/>
|
||||||
<field name="mag_scale" units="gain" type="float" elementnames="X,Y,Z" defaultvalue="1"/>
|
<field name="mag_scale" units="gain" type="float" elementnames="X,Y,Z" defaultvalue="1"/>
|
||||||
|
<!-- These settings are related to how the sensors are post processed -->
|
||||||
<!-- These settings are related to how the sensors are post processed -->
|
<!-- TODO: reimplement, put elsewhere (later) -->
|
||||||
<!-- TODO: reimplement, put elsewhere (later) -->
|
<field name="BiasCorrectedRaw" units="" type="enum" elements="1" options="FALSE,TRUE" defaultvalue="TRUE"/>
|
||||||
<field name="BiasCorrectedRaw" units="" type="enum" elements="1" options="FALSE,TRUE" defaultvalue="TRUE"/>
|
<field name="MagBiasNullingRate" units="" type="float" elements="1" defaultvalue="0"/>
|
||||||
<field name="MagBiasNullingRate" units="" type="float" elements="1" defaultvalue="0"/>
|
|
||||||
|
|
||||||
<access gcs="readwrite" flight="readwrite"/>
|
<access gcs="readwrite" flight="readwrite"/>
|
||||||
<telemetrygcs acked="true" updatemode="onchange" period="0"/>
|
<telemetrygcs acked="true" updatemode="onchange" period="0"/>
|
||||||
<telemetryflight acked="true" updatemode="onchange" period="0"/>
|
<telemetryflight acked="true" updatemode="onchange" period="0"/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user