diff --git a/sw/airborne/subsystems/gps/gps_sim_nps.c b/sw/airborne/subsystems/gps/gps_sim_nps.c index 546d32d549..865ff0efa2 100644 --- a/sw/airborne/subsystems/gps/gps_sim_nps.c +++ b/sw/airborne/subsystems/gps/gps_sim_nps.c @@ -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.; diff --git a/sw/airborne/subsystems/gps/gps_sim_nps.h b/sw/airborne/subsystems/gps/gps_sim_nps.h index 3bf1216932..3e5c3c2ca7 100644 --- a/sw/airborne/subsystems/gps/gps_sim_nps.h +++ b/sw/airborne/subsystems/gps/gps_sim_nps.h @@ -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 diff --git a/sw/simulator/nps/nps_fdm_jsbsim.c b/sw/simulator/nps/nps_fdm_jsbsim.c index 15000ad837..7f80b04a0e 100644 --- a/sw/simulator/nps/nps_fdm_jsbsim.c +++ b/sw/simulator/nps/nps_fdm_jsbsim.c @@ -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 }