diff --git a/conf/firmwares/subsystems/rotorcraft/stabilization_passthrough.makefile b/conf/firmwares/subsystems/rotorcraft/stabilization_passthrough.makefile index 3926b05ab9..8eb38047ac 100644 --- a/conf/firmwares/subsystems/rotorcraft/stabilization_passthrough.makefile +++ b/conf/firmwares/subsystems/rotorcraft/stabilization_passthrough.makefile @@ -1,5 +1,5 @@ STAB_ATT_CFLAGS = -DSTABILIZATION_ATTITUDE_NO_REF -STAB_ATT_CFLAGS = -DSTABILIZATION_ATTITUDE_TYPE_INT +STAB_ATT_CFLAGS += -DSTABILIZATION_ATTITUDE_TYPE_INT STAB_ATT_CFLAGS += -DSTABILIZATION_ATTITUDE_TYPE_H=\"stabilization/stabilization_attitude_passthrough.h\" STAB_ATT_SRCS = $(SRC_FIRMWARE)/stabilization/stabilization_attitude_passthrough.c STAB_ATT_SRCS += $(SRC_FIRMWARE)/stabilization/stabilization_attitude_rc_setpoint.c diff --git a/sw/airborne/firmwares/rotorcraft/stabilization/stabilization_attitude_passthrough.c b/sw/airborne/firmwares/rotorcraft/stabilization/stabilization_attitude_passthrough.c index 9bda1b8820..69f7004aca 100644 --- a/sw/airborne/firmwares/rotorcraft/stabilization/stabilization_attitude_passthrough.c +++ b/sw/airborne/firmwares/rotorcraft/stabilization/stabilization_attitude_passthrough.c @@ -23,8 +23,8 @@ * @file stabilization_attitude_passthrough.c * @brief passthrough attitude stabilization * - * This is usefull for instance when having an AC that has needs no - * stabilization because it is allready been done by other stabilization + * This is useful for instance when having an AC that has needs no + * stabilization because it is already been done by other stabilization * software onboard or just does not need it at all. */ @@ -72,3 +72,13 @@ void stabilization_attitude_run(bool_t in_flight __attribute__ ((unused))) { BoundAbs(stabilization_cmd[COMMAND_YAW], MAX_PPRZ); } +void stabilization_attitude_set_failsafe_setpoint(void) { + stab_att_sp_euler.phi = 0; + stab_att_sp_euler.theta = 0; + stab_att_sp_euler.psi = stateGetNedToBodyEulers_i()->psi; +} + +void stabilization_attitude_set_from_eulers_i(struct Int32Eulers *sp_euler) { + memcpy(&stab_att_sp_euler, sp_euler, sizeof(struct Int32Eulers)); +} + diff --git a/sw/airborne/firmwares/rotorcraft/stabilization/stabilization_attitude_passthrough.h b/sw/airborne/firmwares/rotorcraft/stabilization/stabilization_attitude_passthrough.h index 72031365c0..4c0209674f 100644 --- a/sw/airborne/firmwares/rotorcraft/stabilization/stabilization_attitude_passthrough.h +++ b/sw/airborne/firmwares/rotorcraft/stabilization/stabilization_attitude_passthrough.h @@ -23,11 +23,6 @@ #define STABILIZATION_ATTITUDE_PASSTHROUGH_H #include "math/pprz_algebra_int.h" - -#include "generated/airframe.h" - - -extern struct Int32Eulers stab_att_sp_euler; ///< with #INT32_ANGLE_FRAC - +#include "firmwares/rotorcraft/stabilization/stabilization_attitude_common_int.h" #endif /* STABILIZATION_ATTITUDE_PASSTHROUGH_H */