|
Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
Go to the documentation of this file.
44 #define MAX_AIRSPEED 15
46 #define INT32_ANGLE_HIGH_RES_FRAC 18
75 #if PERIODIC_TELEMETRY
82 pprz_msg_send_HYBRID_GUIDANCE(trans,
dev, AC_ID,
84 &(speed->
x), &(speed->
y),
118 #if PERIODIC_TELEMETRY
124 #define INT32_ANGLE_HIGH_RES_NORMALIZE(_a) { \
125 while ((_a) > (INT32_ANGLE_PI << (INT32_ANGLE_HIGH_RES_FRAC - INT32_ANGLE_FRAC))) (_a) -= (INT32_ANGLE_2_PI << (INT32_ANGLE_HIGH_RES_FRAC - INT32_ANGLE_FRAC)); \
126 while ((_a) < -(INT32_ANGLE_PI << (INT32_ANGLE_HIGH_RES_FRAC - INT32_ANGLE_FRAC))) (_a) += (INT32_ANGLE_2_PI << (INT32_ANGLE_HIGH_RES_FRAC - INT32_ANGLE_FRAC)); \
194 if (heading_diff > 0.0) {
196 }
else if (heading_diff < 0.0) {
206 if (norm_sp_airspeed > (4 << 8)) {
234 if (norm_sp_airspeed < (4 << 8)) {
270 struct Int32Vect2 guidance_hybrid_groundspeed_sp;
279 if (norm_groundspeed_sp > 1 << 8) {
280 guidance_hybrid_groundspeed_sp.
x = guidance_hybrid_groundspeed_sp.
x * (
max_airspeed << 8) / norm_groundspeed_sp;
281 guidance_hybrid_groundspeed_sp.
y = guidance_hybrid_groundspeed_sp.
y * (
max_airspeed << 8) / norm_groundspeed_sp;
294 VECT2_ADD(airspeed_sp, guidance_hybrid_groundspeed_sp);
301 if (norm_airspeed_sp > (
max_airspeed << 8) && norm_groundspeed_sp > 0) {
303 8) +
INT_MULT_RSHIFT(guidance_hybrid_groundspeed_sp.
y, guidance_hybrid_groundspeed_sp.
y, 8);
310 float d_sqrt_f = sqrtf(dv);
313 int32_t result = ((-bv + d_sqrt) << 8) / (2 * av);
326 if ((norm_airspeed_sp > (
max_airspeed << 8)) && (norm_airspeed_sp != 0)) {
int32_t theta
in rad with INT32_ANGLE_FRAC
int32_t guidance_hybrid_norm_ref_airspeed
static int32_t v_control_pitch
int32_t horizontal_speed_gain
#define ANGLE_FLOAT_OF_BFP(_ai)
#define FLOAT_ANGLE_NORMALIZE(_a)
void guidance_hybrid_reset_heading(struct Int32Eulers *sp_cmd)
Description.
static int32_t high_res_psi
void int32_quat_comp(struct Int32Quat *a2c, struct Int32Quat *a2b, struct Int32Quat *b2c)
Composition (multiplication) of two quaternions.
#define INT32_ANGLE_HIGH_RES_FRAC
static int32_t omega_disp
struct Int32Vect2 pos
horizontal position setpoint in NED.
#define PPRZ_ITRIG_COS(_c, _a)
static bool guidance_hovering
#define INT_EULERS_ZERO(_e)
static void send_hybrid_guidance(struct transport_tx *trans, struct link_device *dev)
#define POS_FLOAT_OF_BFP(_ai)
#define VECT2_ADD(_a, _b)
static struct NedCoor_i * stateGetPositionNed_i(void)
Get position in local NED coordinates (int).
void int32_eulers_of_quat(struct Int32Eulers *e, struct Int32Quat *q)
void guidance_hybrid_init(void)
Hybrid Guidance Initialization function.
#define INT_VECT2_ZERO(_v)
static struct Int32Vect2 guidance_hybrid_ref_airspeed
#define VECT2_DIFF(_c, _a, _b)
#define VECT2_SDIV(_vo, _vi, _s)
static struct Int32Vect2 guidance_hybrid_airspeed_sp
int32_t psi
in rad with INT32_ANGLE_FRAC
void guidance_hybrid_determine_wind_estimate(void)
Description.
#define INT32_ANGLE_HIGH_RES_NORMALIZE(_a)
void guidance_hybrid_position_to_airspeed(void)
Description.
int32_t phi
in rad with INT32_ANGLE_FRAC
static struct NedCoor_i * stateGetSpeedNed_i(void)
Get ground speed in local NED coordinates (int).
void guidance_hybrid_set_cmd_i(struct Int32Eulers *sp_cmd)
Creates the attitude set-points from an orientation vector.
void int32_quat_of_axis_angle(struct Int32Quat *q, struct Int32Vect3 *uv, int32_t angle)
Quaternion from unit vector and angle.
#define ANGLE_BFP_OF_REAL(_af)
vector in North East Down coordinates
static const struct usb_device_descriptor dev
static struct Int32Vect2 wind_estimate_high_res
#define INT_MULT_RSHIFT(_a, _b, _r)
static uint32_t int32_vect2_norm(struct Int32Vect2 *v)
return norm of 2D vector
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
#define QUAT_BFP_OF_REAL(_qi, _qf)
void guidance_hybrid_vertical(void)
Description.
static int32_t norm_sp_airspeed_disp
void guidance_hybrid_run(void)
Runs the Hybrid Guidance main functions.
static struct Int32Vect2 guidance_h_pos_err
struct HorizontalGuidanceSetpoint sp
setpoints
static struct Int32Vect2 guidance_hybrid_airspeed_ref
float guidance_v_nominal_throttle
nominal throttle for hover.
void guidance_hybrid_airspeed_to_attitude(struct Int32Eulers *ypr_sp)
Convert a required airspeed to a certain attitude for the Quadshot.
static struct Int32Vect2 wind_estimate
#define INT32_VECT2_RSHIFT(_o, _i, _r)
bool force_forward_flight
int32_t guidance_v_delta_t
thrust command.
int32_t guidance_v_ki
vertical control I-gain
static int32_t airspeed_sp_heading_disp
void float_quat_of_orientation_vect(struct FloatQuat *q, const struct FloatVect3 *ov)
Quaternion from orientation vector.
static struct Int32Eulers guidance_hybrid_ypr_sp
int32_t stabilization_cmd[COMMANDS_NB]
Stabilization commands.
struct HorizontalGuidance guidance_h
int32_t guidance_v_kd
vertical control D-gain
struct FloatEulers stab_att_sp_euler
with INT32_ANGLE_FRAC
#define POS_BFP_OF_REAL(_af)
void stabilization_attitude_set_rpy_setpoint_i(struct Int32Eulers *rpy)
int32_t guidance_v_kp
vertical control P-gain
struct Int32Quat stab_att_sp_quat
with INT32_QUAT_FRAC
#define DefaultPeriodic
Set default periodic telemetry.
static int32_t heading_diff_disp
#define PPRZ_ITRIG_SIN(_s, _a)