Paparazzi UAS
v5.8.2_stable-0-g6260b7c
Paparazzi is a free software Unmanned Aircraft System.
|
Horizontal guidance for rotorcrafts. More...
#include "generated/airframe.h"
#include "firmwares/rotorcraft/guidance/guidance_h.h"
#include "firmwares/rotorcraft/guidance/guidance_flip.h"
#include "firmwares/rotorcraft/guidance/guidance_indi.h"
#include "firmwares/rotorcraft/guidance/guidance_module.h"
#include "firmwares/rotorcraft/stabilization.h"
#include "firmwares/rotorcraft/stabilization/stabilization_attitude_rc_setpoint.h"
#include "firmwares/rotorcraft/navigation.h"
#include "subsystems/radio_control.h"
#include "firmwares/rotorcraft/stabilization/stabilization_none.h"
#include "firmwares/rotorcraft/stabilization/stabilization_rate.h"
#include "firmwares/rotorcraft/stabilization/stabilization_attitude.h"
#include "firmwares/rotorcraft/guidance/guidance_v.h"
#include "state.h"
Go to the source code of this file.
Macros | |
#define | GUIDANCE_H_AGAIN 0 |
#define | GUIDANCE_H_VGAIN 0 |
#define | GUIDANCE_H_MAX_BANK RadOfDeg(20) |
#define | GUIDANCE_H_APPROX_FORCE_BY_THRUST FALSE |
#define | GUIDANCE_INDI FALSE |
#define | MAX_POS_ERR POS_BFP_OF_REAL(16.) |
#define | MAX_SPEED_ERR SPEED_BFP_OF_REAL(16.) |
#define | GUIDANCE_H_THRUST_CMD_FILTER 10 |
#define | GH_GAIN_SCALE 2 |
Functions | |
static void | guidance_h_update_reference (void) |
static void | guidance_h_traj_run (bool_t in_flight) |
static void | guidance_h_hover_enter (void) |
static void | guidance_h_nav_enter (void) |
static void | transition_run (void) |
static void | read_rc_setpoint_speed_i (struct Int32Vect2 *speed_sp, bool_t in_flight) |
read speed setpoint from RC More... | |
void | guidance_h_init (void) |
static void | reset_guidance_reference_from_current_position (void) |
void | guidance_h_mode_changed (uint8_t new_mode) |
void | guidance_h_read_rc (bool_t in_flight) |
void | guidance_h_run (bool_t in_flight) |
void | guidance_h_set_igain (uint32_t igain) |
bool_t | guidance_h_set_guided_pos (float x, float y) |
Set horizontal position setpoint in GUIDED mode. More... | |
bool_t | guidance_h_set_guided_heading (float heading) |
Set heading setpoint in GUIDED mode. More... | |
Variables | |
struct HorizontalGuidance | guidance_h |
int32_t | transition_percentage |
int32_t | transition_theta_offset |
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 |
horizontal guidance command. More... | |
Horizontal guidance for rotorcrafts.
Definition in file guidance_h.c.
#define GH_GAIN_SCALE 2 |
Definition at line 481 of file guidance_h.c.
Referenced by guidance_h_traj_run().
#define GUIDANCE_H_AGAIN 0 |
Definition at line 48 of file guidance_h.c.
Referenced by guidance_h_init().
#define GUIDANCE_H_APPROX_FORCE_BY_THRUST FALSE |
Definition at line 72 of file guidance_h.c.
Referenced by guidance_h_init().
#define GUIDANCE_H_MAX_BANK RadOfDeg(20) |
Definition at line 65 of file guidance_h.c.
Referenced by guidance_h_traj_run(), and guidance_indi_run().
#define GUIDANCE_H_THRUST_CMD_FILTER 10 |
Definition at line 476 of file guidance_h.c.
Referenced by guidance_h_traj_run().
#define GUIDANCE_H_VGAIN 0 |
Definition at line 52 of file guidance_h.c.
Referenced by guidance_h_init().
#define GUIDANCE_INDI FALSE |
Definition at line 76 of file guidance_h.c.
#define MAX_POS_ERR POS_BFP_OF_REAL(16.) |
Definition at line 472 of file guidance_h.c.
Referenced by guidance_h_traj_run().
#define MAX_SPEED_ERR SPEED_BFP_OF_REAL(16.) |
Definition at line 473 of file guidance_h.c.
Referenced by guidance_h_traj_run().
|
static |
Definition at line 551 of file guidance_h.c.
References guidance_h, HorizontalGuidanceSetpoint::heading, HorizontalGuidanceSetpoint::pos, Int32Eulers::psi, HorizontalGuidance::rc_sp, reset_guidance_reference_from_current_position(), HorizontalGuidance::sp, stateGetNedToBodyEulers_i(), stateGetPositionNed_i(), and VECT2_COPY.
Referenced by guidance_h_mode_changed(), and guidance_h_run().
void guidance_h_init | ( | void | ) |
Definition at line 168 of file guidance_h.c.
References HorizontalGuidanceGains::a, HorizontalGuidance::approx_force_by_thrust, HorizontalGuidanceGains::d, DefaultPeriodic, HorizontalGuidance::gains, gh_ref_init(), guidance_h, GUIDANCE_H_AGAIN, GUIDANCE_H_APPROX_FORCE_BY_THRUST, GUIDANCE_H_MODE_KILL, guidance_h_module_init(), guidance_h_trim_att_integrator, GUIDANCE_H_USE_REF, GUIDANCE_H_VGAIN, guidance_indi_enter(), HorizontalGuidanceSetpoint::heading, HorizontalGuidanceGains::i, INT_EULERS_ZERO, INT_VECT2_ZERO, HorizontalGuidance::mode, HorizontalGuidanceGains::p, HorizontalGuidanceSetpoint::pos, HorizontalGuidance::rc_sp, register_periodic_telemetry(), HorizontalGuidance::sp, HorizontalGuidance::use_ref, and HorizontalGuidanceGains::v.
Referenced by autopilot_init().
void guidance_h_mode_changed | ( | uint8_t | new_mode | ) |
Definition at line 216 of file guidance_h.c.
References guidance_flip_enter(), guidance_h, guidance_h_hover_enter(), GUIDANCE_H_MODE_ATTITUDE, GUIDANCE_H_MODE_CARE_FREE, GUIDANCE_H_MODE_FLIP, GUIDANCE_H_MODE_FORWARD, GUIDANCE_H_MODE_HOVER, GUIDANCE_H_MODE_KILL, GUIDANCE_H_MODE_MODULE, GUIDANCE_H_MODE_NAV, GUIDANCE_H_MODE_RATE, GUIDANCE_H_MODE_RC_DIRECT, guidance_h_module_enter(), guidance_h_nav_enter(), guidance_indi_enter(), HorizontalGuidance::mode, stabilization_attitude_enter(), stabilization_attitude_reset_care_free_heading(), stabilization_none_enter(), and stabilization_rate_enter().
Referenced by autopilot_set_mode().
|
static |
Definition at line 562 of file guidance_h.c.
References guidance_h, INT32_VECT2_NED_OF_ENU, nav_heading, navigation_carrot, HorizontalGuidanceSetpoint::pos, Int32Eulers::psi, reset_guidance_reference_from_current_position(), HorizontalGuidance::sp, and stateGetNedToBodyEulers_i().
Referenced by guidance_h_mode_changed(), and guidance_h_run().
void guidance_h_read_rc | ( | bool_t | in_flight | ) |
Definition at line 293 of file guidance_h.c.
References FALSE, guidance_h, GUIDANCE_H_MODE_ATTITUDE, GUIDANCE_H_MODE_CARE_FREE, GUIDANCE_H_MODE_FLIP, GUIDANCE_H_MODE_FORWARD, GUIDANCE_H_MODE_HOVER, GUIDANCE_H_MODE_MODULE, GUIDANCE_H_MODE_NAV, GUIDANCE_H_MODE_RATE, GUIDANCE_H_MODE_RC_DIRECT, guidance_h_module_read_rc(), INT_EULERS_ZERO, HorizontalGuidance::mode, radio_control, RC_OK, HorizontalGuidance::rc_sp, read_rc_setpoint_speed_i(), HorizontalGuidance::sp, HorizontalGuidanceSetpoint::speed, stabilization_attitude_read_rc(), stabilization_attitude_read_rc_setpoint_eulers(), stabilization_none_read_rc(), stabilization_rate_read_rc(), stabilization_rate_read_rc_switched_sticks(), RadioControl::status, and TRUE.
Referenced by autopilot_on_rc_frame().
void guidance_h_run | ( | bool_t | in_flight | ) |
Definition at line 347 of file guidance_h.c.
References guidance_flip_run(), guidance_h, guidance_h_cmd_earth, guidance_h_hover_enter(), GUIDANCE_H_MODE_ATTITUDE, GUIDANCE_H_MODE_CARE_FREE, GUIDANCE_H_MODE_FLIP, GUIDANCE_H_MODE_FORWARD, GUIDANCE_H_MODE_GUIDED, GUIDANCE_H_MODE_HOVER, GUIDANCE_H_MODE_MODULE, GUIDANCE_H_MODE_NAV, GUIDANCE_H_MODE_RATE, GUIDANCE_H_MODE_RC_DIRECT, guidance_h_module_run(), guidance_h_nav_enter(), guidance_h_traj_run(), guidance_h_update_reference(), guidance_indi_run(), HorizontalGuidanceSetpoint::heading, horizontal_mode, HORIZONTAL_MODE_ATTITUDE, INT32_ANGLE_NORMALIZE, INT32_PERCENTAGE_FRAC, INT32_VECT2_NED_OF_ENU, HorizontalGuidance::mode, nav_heading, nav_pitch, nav_roll, navigation_carrot, Int32Eulers::phi, HorizontalGuidanceSetpoint::pos, Int32Eulers::psi, HorizontalGuidance::rc_sp, HorizontalGuidance::sp, stabilization_attitude_run(), stabilization_attitude_set_earth_cmd_i(), stabilization_attitude_set_rpy_setpoint_i(), stabilization_none_run(), stabilization_rate_run(), Int32Eulers::theta, and transition_run().
Referenced by autopilot_periodic().
bool_t guidance_h_set_guided_heading | ( | float | heading | ) |
Set heading setpoint in GUIDED mode.
heading | Setpoint in radians. |
Definition at line 631 of file guidance_h.c.
References ANGLE_BFP_OF_REAL, FALSE, guidance_h, GUIDANCE_H_MODE_GUIDED, HorizontalGuidanceSetpoint::heading, INT32_ANGLE_NORMALIZE, HorizontalGuidance::mode, HorizontalGuidance::sp, and TRUE.
Referenced by autopilot_guided_goto_ned().
bool_t guidance_h_set_guided_pos | ( | float | x, |
float | y | ||
) |
Set horizontal position setpoint in GUIDED mode.
x | North position (local NED frame) in meters. |
y | East position (local NED frame) in meters. |
Definition at line 621 of file guidance_h.c.
References FALSE, guidance_h, GUIDANCE_H_MODE_GUIDED, HorizontalGuidance::mode, HorizontalGuidanceSetpoint::pos, POS_BFP_OF_REAL, HorizontalGuidance::sp, TRUE, Int32Vect2::x, and Int32Vect2::y.
Referenced by autopilot_guided_goto_ned().
void guidance_h_set_igain | ( | uint32_t | igain | ) |
Definition at line 615 of file guidance_h.c.
References HorizontalGuidance::gains, guidance_h, guidance_h_trim_att_integrator, HorizontalGuidanceGains::i, and INT_VECT2_ZERO.
|
static |
Definition at line 484 of file guidance_h.c.
References HorizontalGuidanceGains::a, HorizontalGuidanceReference::accel, ANGLE_BFP_OF_REAL, HorizontalGuidance::approx_force_by_thrust, BFP_OF_REAL, HorizontalGuidanceGains::d, HorizontalGuidance::gains, GH_GAIN_SCALE, guidance_h, guidance_h_cmd_earth, GUIDANCE_H_MAX_BANK, guidance_h_pos_err, guidance_h_speed_err, GUIDANCE_H_THRUST_CMD_FILTER, guidance_h_trim_att_integrator, guidance_v_thrust_coeff, HorizontalGuidanceGains::i, INT32_ANGLE_FRAC, INT32_ANGLE_PI_2, INT32_POS_FRAC, INT32_SPEED_FRAC, INT32_TRIG_FRAC, INT_VECT2_ZERO, MAX_POS_ERR, MAX_PPRZ, MAX_SPEED_ERR, Min, HorizontalGuidanceGains::p, HorizontalGuidanceReference::pos, HorizontalGuidance::ref, HorizontalGuidanceReference::speed, stabilization_cmd, stateGetPositionNed_i(), stateGetSpeedNed_i(), HorizontalGuidanceGains::v, VECT2_DIFF, VECT2_STRIM, Int32Vect2::x, and Int32Vect2::y.
Referenced by guidance_h_run().
|
static |
Definition at line 440 of file guidance_h.c.
References HorizontalGuidanceReference::accel, GuidanceHRef::accel, GH_ACCEL_REF_FRAC, GH_POS_REF_FRAC, gh_ref, GH_SPEED_REF_FRAC, gh_update_ref_from_pos_sp(), gh_update_ref_from_speed_sp(), guidance_h, GUIDANCE_H_MODE_HOVER, INT32_ACCEL_FRAC, INT32_POS_FRAC, INT32_SPEED_FRAC, INT32_VECT2_LSHIFT, INT32_VECT2_RSHIFT, INT_VECT2_ZERO, HorizontalGuidance::mode, HorizontalGuidanceReference::pos, GuidanceHRef::pos, HorizontalGuidanceSetpoint::pos, HorizontalGuidance::ref, HorizontalGuidance::sp, HorizontalGuidanceReference::speed, GuidanceHRef::speed, HorizontalGuidanceSetpoint::speed, HorizontalGuidance::use_ref, and VECT2_COPY.
Referenced by guidance_h_run().
|
static |
read speed setpoint from RC
Definition at line 585 of file guidance_h.c.
References GUIDANCE_H_REF_MAX_SPEED, INT32_TRIG_FRAC, MAX_PPRZ, PPRZ_ITRIG_COS, PPRZ_ITRIG_SIN, Int32Eulers::psi, radio_control, RADIO_PITCH, RADIO_ROLL, SPEED_BFP_OF_REAL, stateGetNedToBodyEulers_i(), RadioControl::values, Int32Vect2::x, and Int32Vect2::y.
Referenced by guidance_h_read_rc().
|
inlinestatic |
Definition at line 206 of file guidance_h.c.
References HorizontalGuidanceReference::accel, gh_set_ref(), guidance_h, guidance_h_trim_att_integrator, INT_VECT2_ZERO, HorizontalGuidanceReference::pos, HorizontalGuidance::ref, HorizontalGuidanceReference::speed, stateGetPositionNed_i(), stateGetSpeedNed_i(), and VECT2_COPY.
Referenced by guidance_h_hover_enter(), and guidance_h_nav_enter().
|
inlinestatic |
Definition at line 572 of file guidance_h.c.
References ANGLE_BFP_OF_REAL, INT32_ANGLE_FRAC, INT32_PERCENTAGE_FRAC, and INT_MULT_RSHIFT.
Referenced by guidance_h_run().
struct HorizontalGuidance guidance_h |
Definition at line 79 of file guidance_h.c.
Referenced by guidance_h_hover_enter(), guidance_h_init(), guidance_h_mode_changed(), guidance_h_nav_enter(), guidance_h_read_rc(), guidance_h_run(), guidance_h_set_guided_heading(), guidance_h_set_guided_pos(), guidance_h_set_igain(), guidance_h_traj_run(), guidance_h_update_reference(), guidance_indi_run(), reset_guidance_reference_from_current_position(), send_fp(), and send_status().
struct Int32Vect2 guidance_h_cmd_earth |
horizontal guidance command.
In north/east with INT32_ANGLE_FRAC
Definition at line 95 of file guidance_h.c.
Referenced by guidance_h_run(), and guidance_h_traj_run().
struct Int32Vect2 guidance_h_pos_err |
Definition at line 87 of file guidance_h.c.
Referenced by guidance_h_traj_run().
struct Int32Vect2 guidance_h_speed_err |
Definition at line 88 of file guidance_h.c.
Referenced by guidance_h_traj_run().
struct Int32Vect2 guidance_h_trim_att_integrator |
Definition at line 89 of file guidance_h.c.
Referenced by guidance_h_init(), guidance_h_set_igain(), guidance_h_traj_run(), and reset_guidance_reference_from_current_position().
int32_t transition_percentage |
Definition at line 81 of file guidance_h.c.
int32_t transition_theta_offset |
Definition at line 82 of file guidance_h.c.
Referenced by stabilization_attitude_read_rc_roll_pitch_earth_quat_f().