1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

Remove the now unused ECEF and Rne fields from HomeLocation. Also reenable

calculation of the WMM and HomeLocation from the GPS code for revolution.
This commit is contained in:
James Cotton 2012-03-02 18:25:33 -06:00
parent 71d0180d45
commit 23625904c5
4 changed files with 4 additions and 21 deletions

View File

@ -529,15 +529,8 @@ static int32_t updateAttitudeINSGPS(bool first_run, bool outdoor_mode)
GPSPositionData gpsPosition;
GPSPositionGet(&gpsPosition);
// convert from cm back to meters
float LLA[3] = {(float) gpsPosition.Latitude / 1e7f,
(float) gpsPosition.Longitude / 1e7f,
(float) (gpsPosition.GeoidSeparation + gpsPosition.Altitude)};
// put in local NED frame
float ECEF[3] = {(float) (home.ECEF[0] / 100.0f),
(float) (home.ECEF[1] / 100.0f),
(float) (home.ECEF[2] / 100.0f)};
LLA2Base(LLA, ECEF, (float (*)[3]) home.RNE, NED);
// Transform the GPS position into NED coordinates
getNED(&gpsPosition, NED);
// Set initial attitude
rpy[0] = atan2f(accelsData.x, accelsData.z) * 180.0f / F_PI;

View File

@ -338,14 +338,6 @@ static void setHomeLocation(GPSPositionData * gpsData)
// Compute home ECEF coordinates and the rotation matrix into NED
double LLA[3] = { ((double)home.Latitude) / 10e6, ((double)home.Longitude) / 10e6, ((double)home.Altitude) };
double ECEF[3];
RneFromLLA(LLA, (float (*)[3])home.RNE);
LLA2ECEF(LLA, ECEF);
// TODO: Currently UAVTalk only supports float but these conversions use double
// need to find out if they require that precision and if so extend UAVTAlk
home.ECEF[0] = (int32_t) (ECEF[0] * 100);
home.ECEF[1] = (int32_t) (ECEF[1] * 100);
home.ECEF[2] = (int32_t) (ECEF[2] * 100);
// Compute magnetic flux direction at home location
if (WMM_GetMagVector(LLA[0], LLA[1], LLA[2], gps.Month, gps.Day, gps.Year, &home.Be[0]) >= 0)

View File

@ -95,7 +95,7 @@
#define PIOS_INCLUDE_INITCALL /* Include init call structures */
#define PIOS_TELEM_PRIORITY_QUEUE /* Enable a priority queue in telemetry */
#define PIOS_QUATERNION_STABILIZATION /* Stabilization options */
//#define PIOS_GPS_SETS_HOMELOCATION /* GPS options */
#define PIOS_GPS_SETS_HOMELOCATION /* GPS options */
/* Alarm Thresholds */
#define HEAP_LIMIT_WARNING 4000

View File

@ -5,10 +5,8 @@
<field name="Latitude" units="deg * 10e6" type="int32" elements="1" defaultvalue="0"/>
<field name="Longitude" units="deg * 10e6" type="int32" elements="1" defaultvalue="0"/>
<field name="Altitude" units="m over geoid" type="float" elements="1" defaultvalue="0"/>
<field name="ECEF" units="cm" type="int32" elements="3" defaultvalue="0,0,0"/>
<field name="RNE" units="" type="float" elements="9" defaultvalue="0,0,0,0,0,0,0,0,0"/>
<field name="Be" units="" type="float" elements="3" defaultvalue="0,0,0"/>
<field name="g_e" units="m/s^2" type="float" elements="1" defaultvalue="9.81"/>
<field name="g_e" units="m/s^2" type="float" elements="1" defaultvalue="9.81"/>
<access gcs="readwrite" flight="readwrite"/>
<telemetrygcs acked="true" updatemode="onchange" period="0"/>
<telemetryflight acked="true" updatemode="onchange" period="0"/>