From 9782d0a12b71ac838ee3ef3ce4a6c89e5a181258 Mon Sep 17 00:00:00 2001 From: Felix Ruess Date: Tue, 22 May 2012 17:52:24 +0200 Subject: [PATCH] [rotorcraft guidance] minor cleanup when using guidance_h ref --- conf/airframes/examples/quadrotor_lisa_m_2_pwm.xml | 1 - conf/airframes/examples/quadrotor_lisa_m_mkk.xml | 1 - conf/airframes/fraser_lisa_m_rotorcraft.xml | 2 +- .../firmwares/rotorcraft/guidance/guidance_h.c | 11 ++++------- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/conf/airframes/examples/quadrotor_lisa_m_2_pwm.xml b/conf/airframes/examples/quadrotor_lisa_m_2_pwm.xml index b25dff6d77e..b7213b1879f 100644 --- a/conf/airframes/examples/quadrotor_lisa_m_2_pwm.xml +++ b/conf/airframes/examples/quadrotor_lisa_m_2_pwm.xml @@ -178,7 +178,6 @@
- diff --git a/conf/airframes/examples/quadrotor_lisa_m_mkk.xml b/conf/airframes/examples/quadrotor_lisa_m_mkk.xml index 3f6a293d44d..109ec5cac72 100644 --- a/conf/airframes/examples/quadrotor_lisa_m_mkk.xml +++ b/conf/airframes/examples/quadrotor_lisa_m_mkk.xml @@ -161,7 +161,6 @@
- diff --git a/conf/airframes/fraser_lisa_m_rotorcraft.xml b/conf/airframes/fraser_lisa_m_rotorcraft.xml index c835bcde0af..21e1d688027 100644 --- a/conf/airframes/fraser_lisa_m_rotorcraft.xml +++ b/conf/airframes/fraser_lisa_m_rotorcraft.xml @@ -196,7 +196,7 @@
- + diff --git a/sw/airborne/firmwares/rotorcraft/guidance/guidance_h.c b/sw/airborne/firmwares/rotorcraft/guidance/guidance_h.c index 4ec8178dc49..695b16865f1 100644 --- a/sw/airborne/firmwares/rotorcraft/guidance/guidance_h.c +++ b/sw/airborne/firmwares/rotorcraft/guidance/guidance_h.c @@ -214,7 +214,11 @@ void guidance_h_run(bool_t in_flight) { else { INT32_VECT2_NED_OF_ENU(guidance_h_pos_sp, navigation_carrot); +#if GUIDANCE_H_USE_REF guidance_h_update_reference(TRUE); +#else + guidance_h_update_reference(FALSE); +#endif guidance_h_psi_sp = nav_heading; guidance_h_traj_run(in_flight); @@ -230,7 +234,6 @@ void guidance_h_run(bool_t in_flight) { static inline void guidance_h_update_reference(bool_t use_ref) { /* convert our reference to generic representation */ -#if GUIDANCE_H_USE_REF if (use_ref) { b2_gh_update_ref_from_pos_sp(guidance_h_pos_sp); INT32_VECT2_RSHIFT(guidance_h_pos_ref, b2_gh_pos_ref, (B2_GH_POS_REF_FRAC - INT32_POS_FRAC)); @@ -241,12 +244,6 @@ static inline void guidance_h_update_reference(bool_t use_ref) { INT_VECT2_ZERO(guidance_h_speed_ref); INT_VECT2_ZERO(guidance_h_accel_ref); } -#else - if (use_ref) {;} // we don't have a reference... just to avoid the unused arg warning in that case - VECT2_COPY(guidance_h_pos_ref, guidance_h_pos_sp); - INT_VECT2_ZERO(guidance_h_speed_ref); - INT_VECT2_ZERO(guidance_h_accel_ref); -#endif }