Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
guidance_OA.c File Reference

Guidance for the obstacle avoidance methods. More...

Include dependency graph for guidance_OA.c:

Go to the source code of this file.

Macros

#define CMD_OF_SAT   1500
#define VISION_PHI_PGAIN   400
#define VISION_PHI_IGAIN   20
#define VISION_THETA_PGAIN   400
#define VISION_THETA_IGAIN   20
#define VISION_DESIRED_VX   0
#define VISION_DESIRED_VY   0

Functions

void guidance_module_enter (void)
 Horizontal guidance mode enter resets the errors and starts the controller.
void guidance_module_run (bool in_flight)
 Main guidance loop.
void OA_update ()
 Update the controls based on a vision result.

Variables

struct opticflow_stab_t opticflow_stab
int8_t filter_flag = 0
int8_t repulsionforce_filter_flag = 0
oa_method OA_method_flag
int8_t opti_speed_flag = 1
float vref_max = 100
float ref_pitch = 0.0
float ref_roll = 0.0
float r_dot_new = 0.0
float desired_vx = 0.0
float desired_vy = 0.0
float speed_pot = 0.0
float yaw_diff = 0.0
float alpha_fil = 1.0
float heading_target = 0
float new_heading = 0
float v_desired = 0.0
int32_t yaw_rate = 0
float yaw_rate_write = 0
float yaw_ref_write = 0
int32_t keep_yaw_rate = 0
int32_t keep_turning = 0
float err_vx = 0
float err_vy = 0
float Total_Kan_x = 0
float Total_Kan_y = 0
struct NedCoor_f opti_speed_read
struct FloatVect3 Total_force = {0, 0, 0}

Detailed Description

Guidance for the obstacle avoidance methods.

Definition in file guidance_OA.c.

Macro Definition Documentation

◆ CMD_OF_SAT

#define CMD_OF_SAT   1500

Definition at line 41 of file guidance_OA.c.

◆ VISION_DESIRED_VX

#define VISION_DESIRED_VX   0

Definition at line 65 of file guidance_OA.c.

◆ VISION_DESIRED_VY

#define VISION_DESIRED_VY   0

Definition at line 70 of file guidance_OA.c.

◆ VISION_PHI_IGAIN

#define VISION_PHI_IGAIN   20

Definition at line 50 of file guidance_OA.c.

◆ VISION_PHI_PGAIN

#define VISION_PHI_PGAIN   400

Definition at line 45 of file guidance_OA.c.

◆ VISION_THETA_IGAIN

#define VISION_THETA_IGAIN   20

Definition at line 60 of file guidance_OA.c.

◆ VISION_THETA_PGAIN

#define VISION_THETA_PGAIN   400

Definition at line 55 of file guidance_OA.c.

Function Documentation

◆ guidance_module_enter()

void guidance_module_enter ( void )

Horizontal guidance mode enter resets the errors and starts the controller.

Entering the module (user switched to module).

Definition at line 142 of file guidance_OA.c.

References guidance_v_mode_changed(), GUIDANCE_V_MODE_HOVER, new_heading, opticflow_stab, Int32Eulers::psi, and stateGetNedToBodyEulers_i().

Here is the call graph for this function:

◆ guidance_module_run()

void guidance_module_run ( bool in_flight)

Main guidance loop.

Parameters
[in]in_flightWhether we are in flight or not

Definition at line 164 of file guidance_OA.c.

References guidance_v_run(), OA_update(), opticflow_stab, StabilizationSetpoint::sp, ThrustSetpoint::sp, stab_sp_from_eulers_i(), stabilization, and stabilization_attitude_run().

Here is the call graph for this function:

◆ OA_update()

void OA_update ( void )

Update the controls based on a vision result.

Parameters
[in]*resultThe opticflow calculation result used for control

Definition at line 177 of file guidance_OA.c.

References alpha_fil, ANGLE_BFP_OF_REAL, CMD_OF_SAT, err_vx, err_vy, INT32_ANGLE_NORMALIZE, LOGICBASED, new_heading, NO_OBSTACLE_AVOIDANCE, OA_method_flag, opti_speed_flag, opti_speed_read, opticflow_stab, PINGPONG, POT_HEADING, FloatEulers::psi, Int32Eulers::psi, r_dot_new, ref_pitch, ref_roll, SAFETYZONE, speed_pot, stateGetNedToBodyEulers_f(), stateGetNedToBodyEulers_i(), stateGetSpeedNed_f(), Total_Kan_x, Total_Kan_y, vref_max, FloatVect2::x, NedCoor_f::x, FloatVect2::y, NedCoor_f::y, and yaw_rate.

Referenced by guidance_module_run().

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

Variable Documentation

◆ alpha_fil

float alpha_fil = 1.0

Definition at line 112 of file guidance_OA.c.

Referenced by CN_potential_velocity(), and OA_update().

◆ desired_vx

float desired_vx = 0.0

Definition at line 108 of file guidance_OA.c.

◆ desired_vy

float desired_vy = 0.0

Definition at line 109 of file guidance_OA.c.

◆ err_vx

float err_vx = 0

Definition at line 123 of file guidance_OA.c.

Referenced by OA_update(), and stabilization_opticflow_vel_cb().

◆ err_vy

float err_vy = 0

Definition at line 124 of file guidance_OA.c.

Referenced by OA_update(), and stabilization_opticflow_vel_cb().

◆ filter_flag

int8_t filter_flag = 0

Definition at line 93 of file guidance_OA.c.

◆ heading_target

float heading_target = 0

Definition at line 113 of file guidance_OA.c.

◆ keep_turning

int32_t keep_turning = 0

Definition at line 121 of file guidance_OA.c.

◆ keep_yaw_rate

int32_t keep_yaw_rate = 0

Definition at line 120 of file guidance_OA.c.

◆ new_heading

◆ OA_method_flag

oa_method OA_method_flag
Initial value:
=
@ PINGPONG
Definition guidance_OA.h:52

Definition at line 96 of file guidance_OA.c.

Referenced by CN_calculate_target(), OA_update(), and serial_update().

◆ opti_speed_flag

int8_t opti_speed_flag = 1

Definition at line 98 of file guidance_OA.c.

Referenced by OA_update().

◆ opti_speed_read

struct NedCoor_f opti_speed_read

Definition at line 129 of file guidance_OA.c.

Referenced by OA_update().

◆ opticflow_stab

struct opticflow_stab_t opticflow_stab
Initial value:
= {
.phi_pgain = VISION_PHI_PGAIN,
.phi_igain = VISION_PHI_IGAIN,
.theta_pgain = VISION_THETA_PGAIN,
.theta_igain = VISION_THETA_IGAIN,
.desired_vx = VISION_DESIRED_VX,
.desired_vy = VISION_DESIRED_VY
}
#define VISION_THETA_PGAIN
#define VISION_DESIRED_VY
#define VISION_DESIRED_VX
#define VISION_PHI_PGAIN
#define VISION_PHI_IGAIN
#define VISION_THETA_IGAIN

Definition at line 83 of file guidance_OA.c.

◆ r_dot_new

float r_dot_new = 0.0

Definition at line 107 of file guidance_OA.c.

Referenced by CN_potential_heading(), CN_potential_velocity(), and OA_update().

◆ ref_pitch

◆ ref_roll

float ref_roll = 0.0

◆ repulsionforce_filter_flag

int8_t repulsionforce_filter_flag = 0

Definition at line 94 of file guidance_OA.c.

Referenced by CN_vector_escape_velocity(), and CN_vector_velocity().

◆ speed_pot

float speed_pot = 0.0

◆ Total_force

struct FloatVect3 Total_force = {0, 0, 0}

Definition at line 130 of file guidance_OA.c.

◆ Total_Kan_x

float Total_Kan_x = 0

Definition at line 126 of file guidance_OA.c.

Referenced by OA_update().

◆ Total_Kan_y

float Total_Kan_y = 0

Definition at line 127 of file guidance_OA.c.

Referenced by OA_update().

◆ v_desired

float v_desired = 0.0

Definition at line 115 of file guidance_OA.c.

◆ vref_max

float vref_max = 100

◆ yaw_diff

float yaw_diff = 0.0

Definition at line 111 of file guidance_OA.c.

◆ yaw_rate

int32_t yaw_rate = 0

Definition at line 117 of file guidance_OA.c.

Referenced by OA_update().

◆ yaw_rate_write

float yaw_rate_write = 0

Definition at line 118 of file guidance_OA.c.

◆ yaw_ref_write

float yaw_ref_write = 0

Definition at line 119 of file guidance_OA.c.