Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
guidance_h.c File Reference

Horizontal guidance for rotorcrafts. More...

+ Include dependency graph for guidance_h.c:

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 UNUSED, struct link_device *dev UNUSED)
 
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 acceleration setpoint. More...
 
void guidance_h_set_body_acc (float ax, float ay)
 Set body relative horizontal acceleration setpoint. More...
 
void guidance_h_set_acc (float ax, float ay)
 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...
 

Detailed Description

Horizontal guidance for rotorcrafts.

Definition in file guidance_h.c.

Function Documentation

◆ guidance_h_from_nav()

◆ guidance_h_guided_run()

void guidance_h_guided_run ( bool  in_flight)

Run GUIDED mode control.

Definition at line 563 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ guidance_h_hover_enter()

◆ guidance_h_init()

◆ guidance_h_mode_changed()

◆ guidance_h_nav_enter()

void guidance_h_nav_enter ( void  )

◆ guidance_h_read_rc()

◆ guidance_h_run()

◆ guidance_h_set_acc()

void guidance_h_set_acc ( float  ax,
float  ay 
)

Set horizontal velocity setpoint.

Parameters
vxNorth velocity (local NED frame) in meters/sec.
vyEast velocity (local NED frame) in meters/sec.

Definition at line 621 of file guidance_h.c.

References HorizontalGuidanceSetpoint::accel, ACCEL_BFP_OF_REAL, guidance_h, HorizontalGuidanceSetpoint::h_mask, reset_guidance_reference_from_current_position(), HorizontalGuidance::sp, Int32Vect2::x, and Int32Vect2::y.

Referenced by guidance_h_from_nav(), and guidance_h_set_body_acc().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ guidance_h_set_body_acc()

void guidance_h_set_body_acc ( float  ax,
float  ay 
)

Set body relative horizontal acceleration setpoint.

Parameters
vxforward acceleration (body frame) in meters/sec².
vyright acceleration (body frame) in meters/sec².

Definition at line 613 of file guidance_h.c.

References guidance_h_set_acc(), FloatEulers::psi, Int32Eulers::psi, and stateGetNedToBodyEulers_f().

+ Here is the call graph for this function:

◆ guidance_h_set_body_vel()

void guidance_h_set_body_vel ( float  vx,
float  vy 
)

Set body relative horizontal velocity setpoint.

Parameters
vxforward velocity (body frame) in meters/sec.
vyright velocity (body frame) in meters/sec.

Definition at line 595 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ guidance_h_set_heading()

void guidance_h_set_heading ( float  heading)

◆ guidance_h_set_heading_rate()

void guidance_h_set_heading_rate ( float  rate)

Set heading rate setpoint.

Parameters
rateHeading rate in radians.

Definition at line 631 of file guidance_h.c.

References guidance_h, HorizontalGuidanceSetpoint::heading_rate, HorizontalGuidance::sp, and HorizontalGuidanceSetpoint::yaw_mask.

Referenced by autopilot_guided_update(), and orange_avoider_guided_periodic().

+ Here is the caller graph for this function:

◆ guidance_h_set_pos()

void guidance_h_set_pos ( float  x,
float  y 
)

Set horizontal position setpoint.

Parameters
xNorth position (local NED frame) in meters.
yEast position (local NED frame) in meters.

Definition at line 578 of file guidance_h.c.

References guidance_h, HorizontalGuidanceSetpoint::h_mask, HorizontalGuidanceSetpoint::pos, POS_BFP_OF_REAL, reset_guidance_reference_from_current_position(), 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ guidance_h_set_vel()

void guidance_h_set_vel ( float  vx,
float  vy 
)

Set horizontal acceleration setpoint.

Parameters
vxNorth acceleration (local NED frame) in meters/sec².
vyEast acceleration (local NED frame) in meters/sec².

Definition at line 603 of file guidance_h.c.

References guidance_h, HorizontalGuidanceSetpoint::h_mask, reset_guidance_reference_from_current_position(), 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ guidance_h_update_reference()

◆ read_rc_setpoint_speed_i()

static void read_rc_setpoint_speed_i ( struct Int32Vect2 speed_sp,
bool  in_flight 
)
static

read speed setpoint from RC

Todo:
calc proper scale while making sure a division by zero can't occur

Definition at line 533 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reset_guidance_reference_from_current_position()

◆ send_gh()

static void send_gh ( struct transport_tx *  trans,
struct link_device *  dev 
)
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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ send_href()

static void send_href ( struct transport_tx *  trans,
struct link_device *  dev 
)
static

◆ send_tune_hover()

static void send_tune_hover ( struct transport_tx *trans  UNUSED,
struct link_device *dev  UNUSED 
)
static

Definition at line 102 of file guidance_h.c.

Referenced by guidance_h_init().

+ Here is the caller graph for this function:

◆ transition_run()

static void transition_run ( bool  to_forward)
inlinestatic

Definition at line 515 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().

+ Here is the caller graph for this function:

Variable Documentation

◆ guidance_h

◆ guidance_h_cmd

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().

◆ transition_percentage