diff --git a/conf/autopilot/booz2_simulator.makefile b/conf/autopilot/booz2_simulator.makefile index b0ffe1cc84..e924f31421 100644 --- a/conf/autopilot/booz2_simulator.makefile +++ b/conf/autopilot/booz2_simulator.makefile @@ -17,6 +17,8 @@ sim.CFLAGS += -DSITL sim.CFLAGS += `pkg-config glib-2.0 --cflags` -I /usr/include/meschach sim.LDFLAGS += `pkg-config glib-2.0 --libs` -lm -lmeschach -lpcre -lglibivy +sim.CFLAGS += -DBYPASS_AHRS + sim.CFLAGS += -I$(SRC_BOOZ) -I$(SRC_BOOZ_SIM) -I../simulator -DFLOAT_T=float sim.srcs = $(SIMDIR)/booz2_sim_main.c \ diff --git a/sw/simulator/booz2_sim_main.c b/sw/simulator/booz2_sim_main.c index 23a065dc55..d48683f81d 100644 --- a/sw/simulator/booz2_sim_main.c +++ b/sw/simulator/booz2_sim_main.c @@ -50,6 +50,7 @@ double disp_time; double booz_sim_actuators_values[] = {0., 0., 0., 0.}; +static void sim_bypass_ahrs(void); static void sim_gps_feed_data(void); static void sim_mag_feed_data(void); @@ -118,6 +119,9 @@ static gboolean booz2_sim_periodic(gpointer data __attribute__ ((unused))) { if (booz_sensors_model_gyro_available()) { booz2_imu_feed_data(); booz2_main_event(); +#ifdef BYPASS_AHRS + sim_bypass_ahrs(); +#endif /* BYPASS_AHRS */ } if (booz_sensors_model_gps_available()) { @@ -137,6 +141,19 @@ static gboolean booz2_sim_periodic(gpointer data __attribute__ ((unused))) { return TRUE; } +#include "booz_geometry_mixed.h" +#include "booz2_filter_attitude.h" +static void sim_bypass_ahrs(void) { + booz2_filter_attitude_euler_aligned.phi = BOOZ_ANGLE_I_OF_F(bfm.state->ve[BFMS_PHI]); + booz2_filter_attitude_euler_aligned.theta = BOOZ_ANGLE_I_OF_F(bfm.state->ve[BFMS_THETA]); + booz2_filter_attitude_euler_aligned.psi = BOOZ_ANGLE_I_OF_F(bfm.state->ve[BFMS_PSI]); + + booz2_filter_attitude_rate.x = BOOZ_RATE_I_OF_F(bfm.state->ve[BFMS_P]); + booz2_filter_attitude_rate.y = BOOZ_RATE_I_OF_F(bfm.state->ve[BFMS_Q]); + booz2_filter_attitude_rate.z = BOOZ_RATE_I_OF_F(bfm.state->ve[BFMS_R]); + +} + #include "booz2_gps.h" static void sim_gps_feed_data(void) { booz2_gps_lat = bsm.gps_pos_lla.lat; diff --git a/sw/simulator/booz_rc_sim.h b/sw/simulator/booz_rc_sim.h index c74bf84cb0..fb9d39083b 100644 --- a/sw/simulator/booz_rc_sim.h +++ b/sw/simulator/booz_rc_sim.h @@ -22,7 +22,7 @@ else { \ ppm_pulses[RADIO_YAW] = 1500 + 0. * (2050-950); \ ppm_pulses[RADIO_THROTTLE] = 1223 + 0.99 * (2050-1223); \ - ppm_pulses[RADIO_MODE] = MODE_SWITCH_AUTO2; \ + ppm_pulses[RADIO_MODE] = MODE_SWITCH_AUTO1; \ } \ ppm_pulses[RADIO_PITCH] = 1500 + 0. * (2050-950); \ ppm_pulses[RADIO_ROLL] = 1500 + 0. * (2050-950); \