Skip to content

Commit

Permalink
[rotorcraft] guidance_h: make some vars private
Browse files Browse the repository at this point in the history
  • Loading branch information
flixr authored and fvantienen committed Sep 13, 2015
1 parent c47ce10 commit eda23de
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion conf/settings/control/rotorcraft_guidance.xml
Expand Up @@ -21,7 +21,7 @@
<dl_setting var="gh_ref.zeta" min="0.7" step="0.05" max="1.0" module="guidance/guidance_h" shortname="zeta" handler="SetZeta" param="GUIDANCE_H_REF_ZETA"/>
<dl_setting var="guidance_h_pgain" min="0" step="1" max="400" module="guidance/guidance_h" shortname="kp" param="GUIDANCE_H_PGAIN"/>
<dl_setting var="guidance_h_dgain" min="0" step="1" max="400" module="guidance/guidance_h" shortname="kd" param="GUIDANCE_H_DGAIN"/>
<dl_setting var="guidance_h_igain" min="0" step="1" max="400" module="guidance/guidance_h" shortname="ki" handler="SetKi" param="GUIDANCE_H_IGAIN"/>
<dl_setting var="guidance_h_igain" min="0" step="1" max="400" module="guidance/guidance_h" shortname="ki" handler="set_igain" param="GUIDANCE_H_IGAIN"/>
<dl_setting var="guidance_h_vgain" min="0" step="1" max="400" module="guidance/guidance_h" shortname="kv" param="GUIDANCE_H_VGAIN"/>
<dl_setting var="guidance_h_again" min="0" step="1" max="400" module="guidance/guidance_h" shortname="ka" param="GUIDANCE_H_AGAIN"/>
<dl_setting var="guidance_h_pos_sp.x" MIN="-10" MAX="10" STEP="1" module="guidance/guidance_h" shortname="sp_x_ned" unit="1/2^8m" alt_unit="m" alt_unit_coef="0.00390625"/>
Expand Down
14 changes: 11 additions & 3 deletions sw/airborne/firmwares/rotorcraft/guidance/guidance_h.c
Expand Up @@ -82,9 +82,6 @@ struct Int32Vect2 guidance_h_accel_ref;
#if GUIDANCE_H_USE_SPEED_REF
struct Int32Vect2 guidance_h_speed_sp;
#endif
struct Int32Vect2 guidance_h_pos_err;
struct Int32Vect2 guidance_h_speed_err;
struct Int32Vect2 guidance_h_trim_att_integrator;

struct Int32Vect2 guidance_h_cmd_earth;
struct Int32Eulers guidance_h_rc_sp;
Expand All @@ -99,6 +96,11 @@ int32_t guidance_h_vgain;
int32_t transition_percentage;
int32_t transition_theta_offset;

/* internal variables */
struct Int32Vect2 guidance_h_pos_err;
struct Int32Vect2 guidance_h_speed_err;
struct Int32Vect2 guidance_h_trim_att_integrator;


static void guidance_h_update_reference(void);
static void guidance_h_traj_run(bool_t in_flight);
Expand Down Expand Up @@ -587,3 +589,9 @@ static void read_rc_setpoint_speed_i(struct Int32Vect2 *speed_sp, bool_t in_flig
speed_sp->y = 0;
}
}

void guidance_h_set_igain(uint32_t igain)
{
guidance_h_igain = igain;
INT_VECT2_ZERO(guidance_h_trim_att_integrator);
}
10 changes: 1 addition & 9 deletions sw/airborne/firmwares/rotorcraft/guidance/guidance_h.h
Expand Up @@ -74,11 +74,6 @@ extern struct Int32Vect2 guidance_h_pos_ref; ///< with #INT32_POS_FRAC
extern struct Int32Vect2 guidance_h_speed_ref; ///< with #INT32_SPEED_FRAC
extern struct Int32Vect2 guidance_h_accel_ref; ///< with #INT32_ACCEL_FRAC

extern struct Int32Vect2 guidance_h_pos_err;
extern struct Int32Vect2 guidance_h_speed_err;
extern struct Int32Vect2 guidance_h_trim_att_integrator;


/** horizontal guidance command.
* In north/east with #INT32_ANGLE_FRAC
* @todo convert to real force command
Expand All @@ -101,11 +96,8 @@ extern void guidance_h_mode_changed(uint8_t new_mode);
extern void guidance_h_read_rc(bool_t in_flight);
extern void guidance_h_run(bool_t in_flight);

extern void guidance_h_set_igain(uint32_t igain);

#define guidance_h_SetKi(_val) { \
guidance_h_igain = _val; \
INT_VECT2_ZERO(guidance_h_trim_att_integrator); \
}

/* Make sure that ref can only be temporarily disabled for testing,
* but not enabled if GUIDANCE_H_USE_REF was defined to FALSE.
Expand Down

0 comments on commit eda23de

Please sign in to comment.