33 #include "autopilot.h"
41 #define CMD_OF_SAT 1500 // 1500 = 40 deg = 2859.1851
44 #ifndef VISION_PHI_PGAIN
45 #define VISION_PHI_PGAIN 400
49 #ifndef VISION_PHI_IGAIN
50 #define VISION_PHI_IGAIN 20
54 #ifndef VISION_THETA_PGAIN
55 #define VISION_THETA_PGAIN 400
59 #ifndef VISION_THETA_IGAIN
60 #define VISION_THETA_IGAIN 20
64 #ifndef VISION_DESIRED_VX
65 #define VISION_DESIRED_VX 0
69 #ifndef VISION_DESIRED_VY
70 #define VISION_DESIRED_VY 0
75 #if (VISION_PHI_PGAIN < 0) || \
76 (VISION_PHI_IGAIN < 0) || \
77 (VISION_THETA_PGAIN < 0) || \
78 (VISION_THETA_IGAIN < 0)
79 #error "ALL control gains have to be positive!!!"
154 opticflow_stab.
cmd.
phi = 0;
194 if (opti_speed_flag == 1) {
205 float s_psi = sin(psi);
206 float c_psi = cos(psi);
214 v_x = speed_cur.
y * 100;
215 v_y = speed_cur.
x * 100;
247 if (OA_method_flag == 2) {
285 opticflow_stab.
desired_vx = sin(new_heading) * speed_pot * 100;
286 opticflow_stab.
desired_vy = cos(new_heading) * speed_pot * 100;
311 float v_desired_total;
324 if (v_desired_total >= vref_max) {
int32_t psi
in rad with INT32_ANGLE_FRAC
static struct FloatEulers * stateGetNedToBodyEulers_f(void)
Get vehicle body attitude euler angles (float).
Periodic telemetry system header (includes downlink utility and generated code).
General attitude stabilization interface for rotorcrafts.
int32_t theta
in rad with INT32_ANGLE_FRAC
struct NedCoor_f opti_speed_read
void guidance_h_module_read_rc(void)
Read the RC commands.
Vertical guidance for rotorcrafts.
float err_vx_int
The integrated velocity error in x direction (m/s)
float desired_vx
The desired velocity in the x direction (cm/s)
int32_t phi_pgain
The roll P gain on the err_vx.
int32_t theta_pgain
The pitch P gain on the err_vy.
void guidance_h_module_init(void)
Initialization of horizontal guidance module.
int32_t theta_igain
The pitch I gain on the err_vy_int.
Guidance for the obstacle avoidance methods.
void guidance_h_module_enter(void)
Horizontal guidance mode enter resets the errors and starts the controller.
vector in North East Down coordinates Units: meters
static struct NedCoor_f * stateGetSpeedNed_f(void)
Get ground speed in local NED coordinates (float).
Interface for electrical status: supply voltage, current, battery status, etc.
void stabilization_attitude_run(bool_t in_flight)
void stabilization_attitude_set_rpy_setpoint_i(struct Int32Eulers *rpy)
int8_t repulsionforce_filter_flag
#define INT32_ANGLE_NORMALIZE(_a)
#define VISION_DESIRED_VX
struct opticflow_stab_t opticflow_stab
struct Int32Eulers cmd
The commands that are send to the hover loop.
void OA_update()
Update the controls based on a vision result.
int32_t phi_igain
The roll I gain on the err_vx_int.
#define ANGLE_BFP_OF_REAL(_af)
#define VISION_DESIRED_VY
int32_t phi
in rad with INT32_ANGLE_FRAC
float desired_vy
The desired velocity in the y direction (cm/s)
struct FloatVect3 Total_force
Common code for AP and FBW telemetry.
void guidance_h_module_run(bool_t in_flight)
Main guidance loop.
static struct Int32Eulers * stateGetNedToBodyEulers_i(void)
Get vehicle body attitude euler angles (int).
float err_vy_int
The integrated velocity error in y direction (m/s)
#define VISION_THETA_PGAIN
#define VISION_THETA_IGAIN