Skip to content

Commit

Permalink
[nps] set gps week and tow
Browse files Browse the repository at this point in the history
currently still hardcoded to May 2014, needs to be implemented properly
  • Loading branch information
flixr committed May 30, 2014
1 parent 21e0a2b commit af4736a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
7 changes: 7 additions & 0 deletions sw/airborne/subsystems/gps/gps_sim_nps.c
Expand Up @@ -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"
Expand All @@ -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.;
Expand Down
2 changes: 1 addition & 1 deletion 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

Expand Down
4 changes: 3 additions & 1 deletion sw/simulator/nps/nps_fdm_jsbsim.c
Expand Up @@ -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 */
Expand All @@ -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

}
Expand Down

0 comments on commit af4736a

Please sign in to comment.