Permalink
Browse files

Run XSens as subsystem=ins_xsens with simulation capability

  • Loading branch information...
1 parent f4d6a1f commit 46a42d7557fbfdce88e184ba9d0816e4a167c77b @dewagter dewagter committed Mar 5, 2012
@@ -0,0 +1,79 @@
+# Hey Emacs, this is a -*- makefile -*-
+
+# XSens Mti-G
+
+# <load name="ins_xsens_MTiG_fixedwing.xml">
+# <configure name="XSENS_UART_NR" value="0"/>
+# </load>
+
+
+
+#########################################
+## ATTITUDE
+
+ifeq ($(TARGET), ap)
+
+# <init fun="ins_init()"/>
+# <periodic fun="ins_periodic_task()" freq="60"/>
+# <event fun="InsEventCheckAndHandle(handle_ins_msg())"/>
+# <makefile target="ap">
+# <define name="AHRS_TYPE_H" value="\\\"modules/ins/ins_xsens.h\\\"" />
+# <define name="INS_MODULE_H" value="\\\"modules/ins/ins_xsens.h\\\"" />
+# <define name="USE_UART$(XSENS_UART_NR)"/>
+# <define name="INS_LINK" value="Uart$(XSENS_UART_NR)"/>
+# <define name="UART$(XSENS_UART_NR)_BAUD" value="B230400"/>
+# <define name="USE_GPS_XSENS"/>
+# <define name="USE_GPS_XSENS_RAW_DATA" />
+# <define name="GPS_NB_CHANNELS" value="16" />
+# <define name="XSENS_OUTPUT_MODE" value="0x1836" />
+# <file name="ins_xsens.c"/>
+# <define name="AHRS_TRIGGERED_ATTITUDE_LOOP" />
+# </makefile>
+
+# ImuEvent -> XSensEvent
+ap.CFLAGS += -DUSE_AHRS
+ap.CFLAGS += -DIMU_TYPE_H=\"modules/ins/ins_xsens.h\"
+
+# AHRS Results
+ap.CFLAGS += -DAHRS_TYPE_H=\"modules/ins/ins_xsens.h\"
+ap.CFLAGS += -DINS_MODULE_H=\"modules/ins/ins_xsens.h\"
+
+ap.CFLAGS += -DUSE_UART$(XSENS_UART_NR)
+ap.CFLAGS += -DINS_LINK=Uart$(XSENS_UART_NR)
+ap.CFLAGS += -DUART$(XSENS_UART_NR)_BAUD=B230400
+ap.CFLAGS += -DUSE_GPS_XSENS
+ap.CFLAGS += -DUSE_GPS_XSENS_RAW_DATA
+ap.CFLAGS += -DGPS_NB_CHANNELS=16
+ap.CFLAGS += -DXSENS_OUTPUT_MODE=0x1836
+ap.srcs += $(SRC_MODULES)/ins/ins_xsens.c
+ap.CFLAGS += -DAHRS_TRIGGERED_ATTITUDE_LOOP
+
+
+endif
+
+
+ifeq ($(TARGET), sim)
+
+sim.CFLAGS += -DAHRS_TYPE_H=\"subsystems/ahrs/ahrs_sim.h\"
+sim.CFLAGS += -DUSE_AHRS -DAHRS_UPDATE_FW_ESTIMATOR
+
+sim.srcs += $(SRC_SUBSYSTEMS)/ahrs.c
+sim.srcs += $(SRC_SUBSYSTEMS)/ahrs/ahrs_sim.c
+
+endif
+
+#########################################
+## GPS
+
+# ap.CFLAGS += -DGPS
+
+$(TARGET).srcs += $(SRC_SUBSYSTEMS)/gps.c
+
+sim.CFLAGS += -DUSE_GPS -DGPS_USE_LATLONG
+sim.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_sim.h\"
+sim.srcs += $(SRC_SUBSYSTEMS)/gps/gps_sim.c
+
+
+
+
+
@@ -148,18 +148,6 @@
#define PERIODIC_SEND_SEGMENT(_chan) if (nav_in_segment) { DOWNLINK_SEND_SEGMENT(_chan, &nav_segment_x_1, &nav_segment_y_1, &nav_segment_x_2, &nav_segment_y_2); }
#ifdef IMU_TYPE_H
-# include "subsystems/imu.h"
-# define PERIODIC_SEND_IMU_ACCEL_RAW(_chan) { DOWNLINK_SEND_IMU_ACCEL_RAW(_chan, &imu.accel_unscaled.x, &imu.accel_unscaled.y, &imu.accel_unscaled.z)}
-# define PERIODIC_SEND_IMU_GYRO_RAW(_chan) { DOWNLINK_SEND_IMU_GYRO_RAW(_chan, &imu.gyro_unscaled.p, &imu.gyro_unscaled.q, &imu.gyro_unscaled.r)}
-# define PERIODIC_SEND_IMU_MAG_RAW(_chan) { DOWNLINK_SEND_IMU_MAG_RAW(_chan, &imu.mag_unscaled.x, &imu.mag_unscaled.y, &imu.mag_unscaled.z)}
-# define PERIODIC_SEND_IMU_ACCEL(_chan) { struct FloatVect3 accel_float; ACCELS_FLOAT_OF_BFP(accel_float, imu.accel); DOWNLINK_SEND_IMU_ACCEL(_chan, &accel_float.x, &accel_float.y, &accel_float.z)}
-# define PERIODIC_SEND_IMU_GYRO(_chan) { struct FloatRates gyro_float; RATES_FLOAT_OF_BFP(gyro_float, imu.gyro); DOWNLINK_SEND_IMU_GYRO(_chan, &gyro_float.p, &gyro_float.q, &gyro_float.r)}
-# ifdef USE_MAGNETOMETER
-# define PERIODIC_SEND_IMU_MAG(_chan) { struct FloatVect3 mag_float; MAGS_FLOAT_OF_BFP(mag_float, imu.mag); DOWNLINK_SEND_IMU_MAG(_chan, &mag_float.x, &mag_float.y, &mag_float.z)}
-# else
-# define PERIODIC_SEND_IMU_MAG(_chan) {}
-# endif
-#else
# ifdef INS_MODULE_H
# include "modules/ins/ins_module.h"
# define PERIODIC_SEND_IMU_ACCEL_RAW(_chan) {}
@@ -169,13 +157,25 @@
# define PERIODIC_SEND_IMU_ACCEL(_chan) { DOWNLINK_SEND_IMU_ACCEL(_chan, &ins_ax, &ins_ay, &ins_az)}
# define PERIODIC_SEND_IMU_MAG(_chan) { DOWNLINK_SEND_IMU_MAG(_chan, &ins_mx, &ins_my, &ins_mz)}
# else
+# include "subsystems/imu.h"
+# define PERIODIC_SEND_IMU_ACCEL_RAW(_chan) { DOWNLINK_SEND_IMU_ACCEL_RAW(_chan, &imu.accel_unscaled.x, &imu.accel_unscaled.y, &imu.accel_unscaled.z)}
+# define PERIODIC_SEND_IMU_GYRO_RAW(_chan) { DOWNLINK_SEND_IMU_GYRO_RAW(_chan, &imu.gyro_unscaled.p, &imu.gyro_unscaled.q, &imu.gyro_unscaled.r)}
+# define PERIODIC_SEND_IMU_MAG_RAW(_chan) { DOWNLINK_SEND_IMU_MAG_RAW(_chan, &imu.mag_unscaled.x, &imu.mag_unscaled.y, &imu.mag_unscaled.z)}
+# define PERIODIC_SEND_IMU_ACCEL(_chan) { struct FloatVect3 accel_float; ACCELS_FLOAT_OF_BFP(accel_float, imu.accel); DOWNLINK_SEND_IMU_ACCEL(_chan, &accel_float.x, &accel_float.y, &accel_float.z)}
+# define PERIODIC_SEND_IMU_GYRO(_chan) { struct FloatRates gyro_float; RATES_FLOAT_OF_BFP(gyro_float, imu.gyro); DOWNLINK_SEND_IMU_GYRO(_chan, &gyro_float.p, &gyro_float.q, &gyro_float.r)}
+# ifdef USE_MAGNETOMETER
+# define PERIODIC_SEND_IMU_MAG(_chan) { struct FloatVect3 mag_float; MAGS_FLOAT_OF_BFP(mag_float, imu.mag); DOWNLINK_SEND_IMU_MAG(_chan, &mag_float.x, &mag_float.y, &mag_float.z)}
+# else
+# define PERIODIC_SEND_IMU_MAG(_chan) {}
+# endif
+# endif
+#else
# define PERIODIC_SEND_IMU_ACCEL_RAW(_chan) {}
# define PERIODIC_SEND_IMU_GYRO_RAW(_chan) {}
# define PERIODIC_SEND_IMU_MAG_RAW(_chan) {}
# define PERIODIC_SEND_IMU_ACCEL(_chan) {}
# define PERIODIC_SEND_IMU_GYRO(_chan) {}
# define PERIODIC_SEND_IMU_MAG(_chan) {}
-# endif
#endif
#ifdef IMU_ANALOG
@@ -27,6 +27,7 @@ int32_t stabilization_cmd[COMMANDS_NB];
void stabilization_init(void) {
#ifndef STABILIZATION_SKIP_RATE
+ stabilization_none_init();
stabilization_rate_init();
#endif
stabilization_attitude_init();

0 comments on commit 46a42d7

Please sign in to comment.