![]() |
Paparazzi UAS
v6.3_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
Horizontal guidance for rotorcrafts. More...
#include "generated/airframe.h"
#include "firmwares/rotorcraft/guidance/guidance_hybrid.h"
#include "firmwares/rotorcraft/guidance/guidance_h.h"
#include "firmwares/rotorcraft/guidance/guidance_flip.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 "modules/radio_control/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"
#include "modules/datalink/telemetry.h"
Go to the source code of this file.
Functions | |
static void | guidance_h_update_reference (void) |
static void | transition_run (bool to_forward) |
static void | read_rc_setpoint_speed_i (struct Int32Vect2 *speed_sp, bool in_flight) |
read speed setpoint from RC More... | |
static void | send_gh (struct transport_tx *trans, struct link_device *dev) |
static void | send_href (struct transport_tx *trans, struct link_device *dev) |
static void | send_tune_hover (struct transport_tx *trans, struct link_device *dev) |
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 in_flight) |
void | guidance_h_run (bool in_flight) |
void | guidance_h_hover_enter (void) |
void | guidance_h_nav_enter (void) |
void | guidance_h_from_nav (bool in_flight) |
Set horizontal guidance from NAV and run control loop. More... | |
void | guidance_h_guided_run (bool in_flight) |
Run GUIDED mode control. More... | |
void | guidance_h_set_pos (float x, float y) |
Set horizontal position setpoint. More... | |
void | guidance_h_set_heading (float heading) |
Set heading setpoint. More... | |
void | guidance_h_set_body_vel (float vx, float vy) |
Set body relative horizontal velocity setpoint. More... | |
void | guidance_h_set_vel (float vx, float vy) |
Set horizontal velocity setpoint. More... | |
void | guidance_h_set_heading_rate (float rate) |
Set heading rate setpoint. More... | |
Variables | |
struct HorizontalGuidance | guidance_h |
int32_t | transition_percentage |
struct StabilizationSetpoint | guidance_h_cmd |
horizontal guidance command. More... | |
Horizontal guidance for rotorcrafts.
Definition in file guidance_h.c.
void guidance_h_from_nav | ( | bool | in_flight | ) |
Set horizontal guidance from NAV and run control loop.
Definition at line 422 of file guidance_h.c.
References ANGLE_BFP_OF_REAL, RotorcraftNavigation::carrot, RotorcraftNavigation::cmd_pitch, RotorcraftNavigation::cmd_roll, RotorcraftNavigation::cmd_yaw, guidance_h, guidance_h_cmd, guidance_h_guided_run(), guidance_h_nav_enter(), guidance_h_run_accel(), guidance_h_run_pos(), guidance_h_run_speed(), guidance_h_set_heading(), guidance_h_set_pos(), guidance_h_set_vel(), guidance_h_update_reference(), RotorcraftNavigation::heading, RotorcraftNavigation::horizontal_mode, nav, NAV_HORIZONTAL_MODE_ATTITUDE, NAV_HORIZONTAL_MODE_GUIDED, NAV_HORIZONTAL_MODE_MANUAL, NAV_SETPOINT_MODE_ACCEL, NAV_SETPOINT_MODE_POS, NAV_SETPOINT_MODE_QUAT, NAV_SETPOINT_MODE_SPEED, Int32Eulers::phi, RotorcraftNavigation::pitch, Int32Eulers::psi, RotorcraftNavigation::quat, QUAT_BFP_OF_REAL, RotorcraftNavigation::roll, RotorcraftNavigation::setpoint_mode, RotorcraftNavigation::speed, stabilization_attitude_run(), stabilization_attitude_set_quat_setpoint_i(), stabilization_attitude_set_rpy_setpoint_i(), stabilization_attitude_set_stab_sp(), stabilization_cmd, Int32Eulers::theta, EnuCoor_f::x, and EnuCoor_f::y.
Referenced by guidance_h_run().
void guidance_h_guided_run | ( | bool | in_flight | ) |
Run GUIDED mode control.
Definition at line 535 of file guidance_h.c.
References guidance_h, guidance_h_cmd, guidance_h_hover_enter(), guidance_h_run_pos(), guidance_h_update_reference(), stabilization_attitude_run(), and stabilization_attitude_set_stab_sp().
Referenced by guidance_h_from_nav(), and guidance_h_run().
void guidance_h_hover_enter | ( | void | ) |
Definition at line 390 of file guidance_h.c.
References guidance_h, guidance_h_run_enter(), guidance_h_set_heading(), guidance_h_set_pos(), FloatEulers::psi, HorizontalGuidance::rc_sp, reset_guidance_reference_from_current_position(), HorizontalGuidance::sp, HorizontalGuidanceSetpoint::speed, stateGetNedToBodyEulers_f(), stateGetPositionNed_f(), FloatVect2::x, Int32Vect2::x, FloatVect2::y, and Int32Vect2::y.
Referenced by guidance_h_guided_run(), and guidance_h_mode_changed().
void guidance_h_init | ( | void | ) |
Definition at line 103 of file guidance_h.c.
References DefaultPeriodic, FLOAT_EULERS_ZERO, gh_ref_init(), guidance_h, GUIDANCE_H_MODE_KILL, guidance_h_module_init(), GUIDANCE_H_USE_REF, HorizontalGuidanceSetpoint::heading, HorizontalGuidanceSetpoint::heading_rate, INT_VECT2_ZERO, HorizontalGuidance::mode, HorizontalGuidanceSetpoint::pos, HorizontalGuidance::rc_sp, register_periodic_telemetry(), send_gh(), send_href(), send_tune_hover(), HorizontalGuidance::sp, transition_percentage, transition_theta_offset, and HorizontalGuidance::use_ref.
void guidance_h_mode_changed | ( | uint8_t | new_mode | ) |
Definition at line 145 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_GUIDED, 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(), HorizontalGuidance::mode, stabilization_attitude_enter(), stabilization_attitude_reset_care_free_heading(), stabilization_none_enter(), and stabilization_rate_enter().
Referenced by autopilot_static_set_mode().
void guidance_h_nav_enter | ( | void | ) |
Definition at line 411 of file guidance_h.c.
References RotorcraftNavigation::carrot, guidance_h_run_enter(), guidance_h_set_heading(), guidance_h_set_pos(), RotorcraftNavigation::heading, nav, reset_guidance_reference_from_current_position(), EnuCoor_f::x, and EnuCoor_f::y.
Referenced by guidance_h_from_nav(), and guidance_h_mode_changed().
void guidance_h_read_rc | ( | bool | in_flight | ) |
Definition at line 218 of file guidance_h.c.
References FALSE, FLOAT_EULERS_ZERO, 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(), HorizontalGuidanceSetpoint::mask, 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_f(), stabilization_none_read_rc(), stabilization_rate_read_rc(), stabilization_rate_read_rc_switched_sticks(), RadioControl::status, and TRUE.
Referenced by autopilot_static_on_rc_frame(), and ins_ekf2_publish_attitude().
void guidance_h_run | ( | bool | in_flight | ) |
Definition at line 277 of file guidance_h.c.
References guidance_flip_run(), guidance_h, guidance_h_from_nav(), guidance_h_guided_run(), 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(), HorizontalGuidanceSetpoint::heading, INT32_PERCENTAGE_FRAC, HorizontalGuidance::mode, FloatEulers::psi, HorizontalGuidance::rc_sp, HorizontalGuidance::sp, stabilization_attitude_run(), stabilization_filter_commands(), stabilization_none_run(), stabilization_rate_run(), transition_percentage, and transition_run().
Referenced by autopilot_static_periodic().
void guidance_h_set_body_vel | ( | float | vx, |
float | vy | ||
) |
Set body relative horizontal velocity setpoint.
vx | forward velocity (body frame) in meters/sec. |
vy | right velocity (body frame) in meters/sec. |
Definition at line 564 of file guidance_h.c.
References guidance_h_set_vel(), FloatEulers::psi, Int32Eulers::psi, and stateGetNedToBodyEulers_f().
Referenced by autopilot_guided_update(), and orange_avoider_guided_periodic().
void guidance_h_set_heading | ( | float | heading | ) |
Set heading setpoint.
heading | Setpoint in radians. |
Definition at line 557 of file guidance_h.c.
References FLOAT_ANGLE_NORMALIZE, guidance_h, HorizontalGuidanceSetpoint::heading, heading, HorizontalGuidanceSetpoint::mask, and HorizontalGuidance::sp.
Referenced by autopilot_guided_goto_ned(), autopilot_guided_move_ned(), autopilot_guided_update(), guidance_h_from_nav(), guidance_h_hover_enter(), guidance_h_nav_enter(), and orange_avoider_guided_periodic().
void guidance_h_set_heading_rate | ( | float | rate | ) |
Set heading rate setpoint.
rate | Heading rate in radians. |
Definition at line 579 of file guidance_h.c.
References guidance_h, HorizontalGuidanceSetpoint::heading_rate, HorizontalGuidanceSetpoint::mask, and HorizontalGuidance::sp.
Referenced by autopilot_guided_update(), and orange_avoider_guided_periodic().
void guidance_h_set_pos | ( | float | x, |
float | y | ||
) |
Set horizontal position setpoint.
x | North position (local NED frame) in meters. |
y | East position (local NED frame) in meters. |
Definition at line 550 of file guidance_h.c.
References guidance_h, HorizontalGuidanceSetpoint::mask, HorizontalGuidanceSetpoint::pos, POS_BFP_OF_REAL, HorizontalGuidance::sp, Int32Vect2::x, and Int32Vect2::y.
Referenced by autopilot_guided_goto_ned(), autopilot_guided_update(), guidance_h_from_nav(), guidance_h_hover_enter(), and guidance_h_nav_enter().
void guidance_h_set_vel | ( | float | vx, |
float | vy | ||
) |
Set horizontal velocity setpoint.
vx | North velocity (local NED frame) in meters/sec. |
vy | East velocity (local NED frame) in meters/sec. |
Definition at line 572 of file guidance_h.c.
References guidance_h, HorizontalGuidanceSetpoint::mask, HorizontalGuidance::sp, HorizontalGuidanceSetpoint::speed, SPEED_BFP_OF_REAL, Int32Vect2::x, and Int32Vect2::y.
Referenced by autopilot_guided_move_ned(), autopilot_guided_update(), guidance_h_from_nav(), and guidance_h_set_body_vel().
|
static |
Definition at line 340 of file guidance_h.c.
References HorizontalGuidanceReference::accel, GuidanceHRef::accel, ACCEL_BFP_OF_REAL, FLOAT_ANGLE_NORMALIZE, GH_POS_REF_FRAC, gh_ref, gh_update_ref_from_pos_sp(), gh_update_ref_from_speed_sp(), guidance_h, GUIDANCE_H_MODE_HOVER, HorizontalGuidanceSetpoint::heading, HorizontalGuidanceSetpoint::heading_rate, INT32_POS_FRAC, INT32_VECT2_RSHIFT, INT_VECT2_ZERO, HorizontalGuidanceSetpoint::mask, HorizontalGuidance::mode, nav, NAV_SETPOINT_MODE_POS, HorizontalGuidanceReference::pos, HorizontalGuidanceSetpoint::pos, GuidanceHRef::pos, HorizontalGuidance::ref, RotorcraftNavigation::setpoint_mode, HorizontalGuidance::sp, HorizontalGuidanceReference::speed, HorizontalGuidanceSetpoint::speed, GuidanceHRef::speed, SPEED_BFP_OF_REAL, SPEED_FLOAT_OF_BFP, stateGetPositionNed_i(), HorizontalGuidance::use_ref, VECT2_COPY, FloatVect2::x, Int32Vect2::x, NedCoor_i::x, FloatVect2::y, Int32Vect2::y, and NedCoor_i::y.
Referenced by guidance_h_from_nav(), and guidance_h_guided_run().
|
static |
read speed setpoint from RC
Definition at line 505 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, speed_sp, stateGetNedToBodyEulers_i(), RadioControl::values, FloatVect3::x, and FloatVect3::y.
Referenced by guidance_h_read_rc().
|
inlinestatic |
Definition at line 131 of file guidance_h.c.
References HorizontalGuidanceReference::accel, FLOAT_VECT2_ZERO, gh_set_ref(), guidance_h, INT_VECT2_ZERO, HorizontalGuidanceReference::pos, HorizontalGuidance::ref, HorizontalGuidanceReference::speed, SPEED_FLOAT_OF_BFP, stateGetPositionNed_i(), stateGetSpeedNed_i(), VECT2_COPY, FloatVect2::x, Int32Vect2::x, FloatVect2::y, and Int32Vect2::y.
Referenced by guidance_h_hover_enter(), and guidance_h_nav_enter().
|
static |
Definition at line 66 of file guidance_h.c.
References dev, guidance_h, HorizontalGuidanceReference::pos, HorizontalGuidanceSetpoint::pos, HorizontalGuidance::ref, HorizontalGuidance::sp, stateGetPositionNed_i(), Int32Vect2::x, NedCoor_i::x, Int32Vect2::y, and NedCoor_i::y.
Referenced by guidance_h_init().
|
static |
Definition at line 75 of file guidance_h.c.
References HorizontalGuidanceReference::accel, dev, guidance_h, HorizontalGuidanceReference::pos, HorizontalGuidanceSetpoint::pos, HorizontalGuidance::ref, HorizontalGuidance::sp, HorizontalGuidanceReference::speed, HorizontalGuidanceSetpoint::speed, Int32Vect2::x, and Int32Vect2::y.
Referenced by guidance_h_init().
|
static |
Definition at line 86 of file guidance_h.c.
References dev, radio_control, RADIO_PITCH, RADIO_ROLL, RADIO_YAW, stabilization_cmd, stateGetNedToBodyEulers_i(), and RadioControl::values.
Referenced by guidance_h_init().
|
inlinestatic |
Definition at line 487 of file guidance_h.c.
References ANGLE_BFP_OF_REAL, INT32_ANGLE_FRAC, INT32_PERCENTAGE_FRAC, INT_MULT_RSHIFT, transition_percentage, and transition_theta_offset.
Referenced by guidance_h_run().
struct HorizontalGuidance guidance_h |
Definition at line 1 of file guidance_h.c.
Referenced by guidance_h_from_nav(), guidance_h_guided_run(), guidance_h_hover_enter(), guidance_h_init(), guidance_h_mode_changed(), guidance_h_read_rc(), guidance_h_run(), guidance_h_set_heading(), guidance_h_set_heading_rate(), guidance_h_set_pos(), guidance_h_set_vel(), guidance_h_update_reference(), ins_ekf2_publish_attitude(), orange_avoider_guided_periodic(), periodic_rotwing_state(), reset_guidance_reference_from_current_position(), send_fp(), send_gh(), send_hover_loop(), send_href(), send_status(), and stabilization_indi_set_wls_settings().
struct StabilizationSetpoint guidance_h_cmd |
horizontal guidance command.
In north/east with INT32_ANGLE_FRAC
Definition at line 52 of file guidance_h.c.
Referenced by guidance_h_from_nav(), and guidance_h_guided_run().
int32_t transition_percentage |
Definition at line 52 of file guidance_h.c.
Referenced by eff_scheduling_generic_periodic(), eff_scheduling_periodic_a(), guidance_h_init(), guidance_h_run(), and transition_run().