Skip to content

Commit

Permalink
[rotorcraft guidance] minor cleanup when using guidance_h ref
Browse files Browse the repository at this point in the history
  • Loading branch information
flixr committed May 22, 2012
1 parent 831372a commit 9782d0a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 10 deletions.
1 change: 0 additions & 1 deletion conf/airframes/examples/quadrotor_lisa_m_2_pwm.xml
Expand Up @@ -178,7 +178,6 @@
</section>

<section name="GUIDANCE_H" prefix="GUIDANCE_H_">
<define name="USE_REF" value="1"/>
<define name="MAX_BANK" value="20" unit="deg"/>
<define name="PGAIN" value="100"/>
<define name="DGAIN" value="100"/>
Expand Down
1 change: 0 additions & 1 deletion conf/airframes/examples/quadrotor_lisa_m_mkk.xml
Expand Up @@ -161,7 +161,6 @@
</section>

<section name="GUIDANCE_H" prefix="GUIDANCE_H_">
<define name="USE_REF" value="1"/>
<define name="MAX_BANK" value="20" unit="deg"/>
<define name="PGAIN" value="100"/>
<define name="DGAIN" value="100"/>
Expand Down
2 changes: 1 addition & 1 deletion conf/airframes/fraser_lisa_m_rotorcraft.xml
Expand Up @@ -196,7 +196,7 @@
</section>

<section name="GUIDANCE_H" prefix="GUIDANCE_H_">
<define name="USE_REF" value="1"/>
<!--define name="USE_REF" value="1"/-->
<define name="MAX_BANK" value="20" unit="deg"/>
<define name="PGAIN" value="100"/>
<define name="DGAIN" value="100"/>
Expand Down
11 changes: 4 additions & 7 deletions sw/airborne/firmwares/rotorcraft/guidance/guidance_h.c
Expand Up @@ -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);
Expand All @@ -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));
Expand All @@ -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
}


Expand Down

0 comments on commit 9782d0a

Please sign in to comment.