[nps] set gps week and tow

currently still hardcoded to May 2014, needs to be implemented properly
This commit is contained in:
Felix Ruess
2014-05-30 23:11:32 +02:00
parent 21e0a2bc6d
commit af4736ac2f
3 changed files with 11 additions and 2 deletions
+7
View File
@@ -22,6 +22,9 @@
#include "subsystems/gps/gps_sim_nps.h"
#include "subsystems/gps.h"
#include "nps_sensors.h"
#include "nps_fdm.h"
#if GPS_USE_LATLONG
/* currently needed to get nav_utm_zone0 */
#include "subsystems/navigation/common_nav.h"
@@ -32,6 +35,10 @@ bool_t gps_available;
bool_t gps_has_fix;
void gps_feed_value() {
// FIXME, set proper time instead of hardcoded to May 2014
gps.week = 1794;
gps.tow = fdm.time * 1000;
gps.ecef_pos.x = sensors.gps.ecef_pos.x * 100.;
gps.ecef_pos.y = sensors.gps.ecef_pos.y * 100.;
gps.ecef_pos.z = sensors.gps.ecef_pos.z * 100.;
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef GPS_SIM_NPS_H
#define GPS_SIM_NPS_H
#include "nps_sensors.h"
#include "std.h"
#define GPS_NB_CHANNELS 16
+3 -1
View File
@@ -490,7 +490,8 @@ static void init_ltp(void) {
double gha[MAXCOEFF];
/* Current date in decimal year, for example 2012.68 */
double sdate = 2012.68;
/** @FIXME properly get current time */
double sdate = 2014.5;
llh_from_jsbsim(&fdm.lla_pos, propagate);
/* LLA Position in decimal degrees and altitude in km */
@@ -505,6 +506,7 @@ static void init_ltp(void) {
&fdm.ltp_h.x, &fdm.ltp_h.y, &fdm.ltp_h.z,
IEXT, EXT_COEFF1, EXT_COEFF2, EXT_COEFF3);
FLOAT_VECT3_NORMALIZE(fdm.ltp_h);
printf("normalized magnetic field: %.4f %.4f %.4f\n", fdm.ltp_h.x, fdm.ltp_h.y, fdm.ltp_h.z);
#endif
}