Skip to content

Commit

Permalink
[ahrs] separate ABI IDs for binding mag message
Browse files Browse the repository at this point in the history
This makes it easy to use a different mag than the one on the IMU, or to disable the mag callback alltogether.
However the mag still has to have the same alignment as the IMU (still same BODY_TO_IMU used).

Towards solving paparazzi#197
  • Loading branch information
flixr committed Jul 25, 2015
1 parent 574589b commit 205c43f
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 11 deletions.
12 changes: 10 additions & 2 deletions sw/airborne/subsystems/ahrs/ahrs_float_cmpl_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,19 @@ static void send_filter_status(struct transport_tx *trans, struct link_device *d


/** ABI binding for IMU data.
* Used for gyro, accel and mag ABI messages.
* Used for gyro and accel ABI messages.
*/
#ifndef AHRS_FC_IMU_ID
#define AHRS_FC_IMU_ID ABI_BROADCAST
#endif
PRINT_CONFIG_VAR(AHRS_FC_IMU_ID)
/** ABI binding for magnetometer data.
* Used for IMU_MAG_INT32 ABI messages.
*/
#ifndef AHRS_FC_MAG_ID
#define AHRS_FC_MAG_ID AHRS_FC_IMU_ID
#endif
PRINT_CONFIG_VAR(AHRS_FC_MAG_ID)
static abi_event gyro_ev;
static abi_event accel_ev;
static abi_event mag_ev;
Expand Down Expand Up @@ -239,7 +247,7 @@ void ahrs_fc_register(void)
*/
AbiBindMsgIMU_GYRO_INT32(AHRS_FC_IMU_ID, &gyro_ev, gyro_cb);
AbiBindMsgIMU_ACCEL_INT32(AHRS_FC_IMU_ID, &accel_ev, accel_cb);
AbiBindMsgIMU_MAG_INT32(AHRS_FC_IMU_ID, &mag_ev, mag_cb);
AbiBindMsgIMU_MAG_INT32(AHRS_FC_MAG_ID, &mag_ev, mag_cb);
AbiBindMsgIMU_LOWPASSED(ABI_BROADCAST, &aligner_ev, aligner_cb);
AbiBindMsgBODY_TO_IMU_QUAT(ABI_BROADCAST, &body_to_imu_ev, body_to_imu_cb);
AbiBindMsgGEO_MAG(ABI_BROADCAST, &geo_mag_ev, geo_mag_cb);
Expand Down
12 changes: 10 additions & 2 deletions sw/airborne/subsystems/ahrs/ahrs_float_dcm_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,19 @@ static void send_filter_status(struct transport_tx *trans, struct link_device *d
#endif

/** ABI binding for IMU data.
* Used for gyro, accel and mag ABI messages.
* Used for gyro and accel ABI messages.
*/
#ifndef AHRS_DCM_IMU_ID
#define AHRS_DCM_IMU_ID ABI_BROADCAST
#endif
PRINT_CONFIG_VAR(AHRS_DCM_IMU_ID)
/** ABI binding for magnetometer data.
* Used for IMU_MAG_INT32 ABI messages.
*/
#ifndef AHRS_DCM_MAG_ID
#define AHRS_DCM_MAG_ID AHRS_DCM_IMU_ID
#endif
PRINT_CONFIG_VAR(AHRS_DCM_MAG_ID)
static abi_event gyro_ev;
static abi_event accel_ev;
static abi_event mag_ev;
Expand Down Expand Up @@ -180,7 +188,7 @@ void ahrs_dcm_register(void)
*/
AbiBindMsgIMU_GYRO_INT32(AHRS_DCM_IMU_ID, &gyro_ev, gyro_cb);
AbiBindMsgIMU_ACCEL_INT32(AHRS_DCM_IMU_ID, &accel_ev, accel_cb);
AbiBindMsgIMU_MAG_INT32(AHRS_DCM_IMU_ID, &mag_ev, mag_cb);
AbiBindMsgIMU_MAG_INT32(AHRS_DCM_MAG_ID, &mag_ev, mag_cb);
AbiBindMsgIMU_LOWPASSED(ABI_BROADCAST, &aligner_ev, aligner_cb);
AbiBindMsgBODY_TO_IMU_QUAT(ABI_BROADCAST, &body_to_imu_ev, body_to_imu_cb);
AbiBindMsgGPS(ABI_BROADCAST, &gps_ev, gps_cb);
Expand Down
2 changes: 1 addition & 1 deletion sw/airborne/subsystems/ahrs/ahrs_float_invariant_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ PRINT_CONFIG_VAR(AHRS_FINV_IMU_ID)

/** magnetometer */
#ifndef AHRS_FINV_MAG_ID
#define AHRS_FINV_MAG_ID ABI_BROADCAST
#define AHRS_FINV_MAG_ID AHRS_FINV_IMU_ID
#endif
PRINT_CONFIG_VAR(AHRS_FINV_MAG_ID)

Expand Down
12 changes: 10 additions & 2 deletions sw/airborne/subsystems/ahrs/ahrs_float_mlkf_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,19 @@ static void send_filter_status(struct transport_tx *trans, struct link_device *d


/** ABI binding for IMU data.
* Used for gyro, accel and mag ABI messages.
* Used for gyro, accel ABI messages.
*/
#ifndef AHRS_MLKF_IMU_ID
#define AHRS_MLKF_IMU_ID ABI_BROADCAST
#endif
PRINT_CONFIG_VAR(AHRS_MLKF_IMU_ID)
/** ABI binding for magnetometer data.
* Used for IMU_MAG_INT32 ABI messages.
*/
#ifndef AHRS_MLKF_MAG_ID
#define AHRS_MLKF_MAG_ID AHRS_MLKF_IMU_ID
#endif
PRINT_CONFIG_VAR(AHRS_MLKF_MAG_ID)
static abi_event gyro_ev;
static abi_event accel_ev;
static abi_event mag_ev;
Expand Down Expand Up @@ -193,7 +201,7 @@ void ahrs_mlkf_register(void)
*/
AbiBindMsgIMU_GYRO_INT32(AHRS_MLKF_IMU_ID, &gyro_ev, gyro_cb);
AbiBindMsgIMU_ACCEL_INT32(AHRS_MLKF_IMU_ID, &accel_ev, accel_cb);
AbiBindMsgIMU_MAG_INT32(AHRS_MLKF_IMU_ID, &mag_ev, mag_cb);
AbiBindMsgIMU_MAG_INT32(AHRS_MLKF_MAG_ID, &mag_ev, mag_cb);
AbiBindMsgIMU_LOWPASSED(ABI_BROADCAST, &aligner_ev, aligner_cb);
AbiBindMsgBODY_TO_IMU_QUAT(ABI_BROADCAST, &body_to_imu_ev, body_to_imu_cb);
AbiBindMsgGEO_MAG(ABI_BROADCAST, &geo_mag_ev, geo_mag_cb);
Expand Down
12 changes: 10 additions & 2 deletions sw/airborne/subsystems/ahrs/ahrs_int_cmpl_euler_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,19 @@ static void send_filter_status(struct transport_tx *trans, struct link_device *d
#endif

/** ABI binding for IMU data.
* Used for gyro, accel and mag ABI messages.
* Used for gyro, accel ABI messages.
*/
#ifndef AHRS_ICE_IMU_ID
#define AHRS_ICE_IMU_ID ABI_BROADCAST
#endif
PRINT_CONFIG_VAR(AHRS_ICE_IMU_ID)
/** ABI binding for magnetometer data.
* Used for IMU_MAG_INT32 ABI messages.
*/
#ifndef AHRS_ICE_MAG_ID
#define AHRS_ICE_MAG_ID AHRS_ICE_IMU_ID
#endif
PRINT_CONFIG_VAR(AHRS_ICE_MAG_ID)
static abi_event gyro_ev;
static abi_event accel_ev;
static abi_event mag_ev;
Expand Down Expand Up @@ -197,7 +205,7 @@ void ahrs_ice_register(void)
*/
AbiBindMsgIMU_GYRO_INT32(AHRS_ICE_IMU_ID, &gyro_ev, gyro_cb);
AbiBindMsgIMU_ACCEL_INT32(AHRS_ICE_IMU_ID, &accel_ev, accel_cb);
AbiBindMsgIMU_MAG_INT32(AHRS_ICE_IMU_ID, &mag_ev, mag_cb);
AbiBindMsgIMU_MAG_INT32(AHRS_ICE_MAG_ID, &mag_ev, mag_cb);
AbiBindMsgIMU_LOWPASSED(ABI_BROADCAST, &aligner_ev, aligner_cb);
AbiBindMsgBODY_TO_IMU_QUAT(ABI_BROADCAST, &body_to_imu_ev, body_to_imu_cb);

Expand Down
12 changes: 10 additions & 2 deletions sw/airborne/subsystems/ahrs/ahrs_int_cmpl_quat_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,19 @@ static void send_filter_status(struct transport_tx *trans, struct link_device *d


/** ABI binding for IMU data.
* Used for gyro, accel and mag ABI messages.
* Used for gyro, accel ABI messages.
*/
#ifndef AHRS_ICQ_IMU_ID
#define AHRS_ICQ_IMU_ID ABI_BROADCAST
#endif
PRINT_CONFIG_VAR(AHRS_ICQ_IMU_ID)
/** ABI binding for magnetometer data.
* Used for IMU_MAG_INT32 ABI messages.
*/
#ifndef AHRS_ICQ_MAG_ID
#define AHRS_ICQ_MAG_ID AHRS_ICQ_IMU_ID
#endif
PRINT_CONFIG_VAR(AHRS_ICQ_MAG_ID)
static abi_event gyro_ev;
static abi_event accel_ev;
static abi_event mag_ev;
Expand Down Expand Up @@ -265,7 +273,7 @@ void ahrs_icq_register(void)
*/
AbiBindMsgIMU_GYRO_INT32(AHRS_ICQ_IMU_ID, &gyro_ev, gyro_cb);
AbiBindMsgIMU_ACCEL_INT32(AHRS_ICQ_IMU_ID, &accel_ev, accel_cb);
AbiBindMsgIMU_MAG_INT32(AHRS_ICQ_IMU_ID, &mag_ev, mag_cb);
AbiBindMsgIMU_MAG_INT32(AHRS_ICQ_MAG_ID, &mag_ev, mag_cb);
AbiBindMsgIMU_LOWPASSED(ABI_BROADCAST, &aligner_ev, aligner_cb);
AbiBindMsgBODY_TO_IMU_QUAT(ABI_BROADCAST, &body_to_imu_ev, body_to_imu_cb);
AbiBindMsgGEO_MAG(ABI_BROADCAST, &geo_mag_ev, geo_mag_cb);
Expand Down

0 comments on commit 205c43f

Please sign in to comment.