27 #include "generated/airframe.h"
54 #ifndef GUIDANCE_H_RC_ID
55 #define GUIDANCE_H_RC_ID ABI_BROADCAST
61 #if PERIODIC_TELEMETRY
64 static void send_gh(
struct transport_tx *trans,
struct link_device *
dev)
67 pprz_msg_send_GUIDANCE_H_INT(trans,
dev, AC_ID,
70 &(pos->
x), &(pos->
y));
73 static void send_href(
struct transport_tx *trans,
struct link_device *
dev)
75 pprz_msg_send_GUIDANCE_H_REF_INT(trans,
dev, AC_ID,
106 #if PERIODIC_TELEMETRY
151 #ifndef GUIDANCE_H_SP_MAX_R
152 #ifdef STABILIZATION_ATTITUDE_SP_MAX_R
153 #define GUIDANCE_H_SP_MAX_R STABILIZATION_ATTITUDE_SP_MAX_R
155 #define GUIDANCE_H_SP_MAX_R 60.f
159 #ifndef GUIDANCE_H_DEADBAND_R
160 #define GUIDANCE_H_DEADBAND_R 200
163 #define YAW_DEADBAND_EXCEEDED(_rc) \
164 (rc->values[RADIO_YAW] > GUIDANCE_H_DEADBAND_R || \
165 rc->values[RADIO_YAW] < -GUIDANCE_H_DEADBAND_R)
178 rc_sp->
heading += heading_rate * dt;
226 #if GUIDANCE_H_USE_SPEED_REF
276 #if GUIDANCE_H_USE_REF
330 #if GUIDANCE_H_USE_SPEED_REF
475 float newvx = cosf(-psi) * vx + sinf(-psi) * vy;
476 float newvy = -sinf(-psi) * vx + cosf(-psi) * vy;
493 float newax = cosf(-psi) * ax + sinf(-psi) * ay;
494 float neway = -sinf(-psi) * ax + cosf(-psi) * ay;
Main include for ABI (AirBorneInterface).
Event structure to store callbacks in a linked list.
bool autopilot_in_flight(void)
get in_flight flag
#define FLOAT_ANGLE_NORMALIZE(_a)
#define FLOAT_VECT2_ZERO(_v)
#define VECT2_COPY(_a, _b)
int32_t psi
in rad with INT32_ANGLE_FRAC
#define ACCEL_BFP_OF_REAL(_af)
#define SPEED_FLOAT_OF_BFP(_ai)
#define INT_VECT2_ZERO(_v)
#define INT32_VECT2_RSHIFT(_o, _i, _r)
#define POS_BFP_OF_REAL(_af)
#define ACCEL_FLOAT_OF_BFP(_ai)
#define SPEED_BFP_OF_REAL(_af)
vector in North East Down coordinates
static struct Int32Eulers * stateGetNedToBodyEulers_i(void)
Get vehicle body attitude euler angles (int).
static struct FloatEulers * stateGetNedToBodyEulers_f(void)
Get vehicle body attitude euler angles (float).
static struct NedCoor_f * stateGetPositionNed_f(void)
Get position in local NED coordinates (float).
static struct NedCoor_i * stateGetPositionNed_i(void)
Get position in local NED coordinates (int).
static struct NedCoor_i * stateGetSpeedNed_i(void)
Get ground speed in local NED coordinates (int).
void gh_set_ref(struct Int32Vect2 pos, struct FloatVect2 speed, struct FloatVect2 accel)
void gh_update_ref_from_accel_sp(struct FloatVect2 accel_sp)
void gh_update_ref_from_pos_sp(struct Int32Vect2 pos_sp)
void gh_update_ref_from_speed_sp(struct FloatVect2 speed_sp)
struct GuidanceHRef gh_ref
#define GH_POS_REF_FRAC
fixedpoint representation: Q26.37 will give a range of 67e3 km and a resolution of 1....
struct FloatVect2 accel
Reference model acceleration.
#define GUIDANCE_H_REF_MAX_SPEED
Default speed saturation.
struct Int64Vect2 pos
Reference model position.
struct FloatVect2 speed
Reference model speed.
struct FloatVect3 speed_sp
Guidance in a module file.
PRINT_CONFIG_VAR(ONELOOP_ANDI_FILT_CUTOFF)
#define PPRZ_ITRIG_SIN(_s, _a)
#define PPRZ_ITRIG_COS(_c, _a)
struct RadioControl radio_control
Generic interface for radio control modules.
pprz_t values[RADIO_CONTROL_NB_CHANNEL]
#define RADIO_ROLL
Redefining RADIO_* Do not use with radio.h (ppm rc)
Some helper functions to check RC sticks.
#define THROTTLE_STICK_DOWN_FROM_RC(_rc)
struct StabilizationSetpoint guidance_h_guided_run(bool in_flight)
Run GUIDED mode control.
void guidance_h_set_acc(float ax, float ay)
Set horizontal velocity setpoint.
struct StabilizationSetpoint guidance_h_from_nav(bool in_flight)
Set horizontal guidance from NAV and run control loop.
struct StabilizationSetpoint guidance_h_cmd
horizontal guidance command.
void guidance_h_set_pos(float x, float y)
Set horizontal position setpoint.
void guidance_h_mode_changed(uint8_t new_mode)
static void send_href(struct transport_tx *trans, struct link_device *dev)
static void send_gh(struct transport_tx *trans, struct link_device *dev)
void guidance_h_hover_enter(void)
static void rc_cb(uint8_t sender_id UNUSED, struct RadioControl *rc)
void guidance_h_set_body_acc(float ax, float ay)
Set body relative horizontal acceleration setpoint.
void guidance_h_set_heading(float heading)
Set heading setpoint.
void guidance_h_init(void)
struct HorizontalGuidance guidance_h
static void read_rc_setpoint_speed_i(struct Int32Vect2 *speed_sp, bool in_flight, struct RadioControl *rc)
read speed setpoint from RC
static void read_rc_setpoint_heading(struct HorizontalGuidanceRCInput *rc_sp, bool in_flight, struct RadioControl *rc)
void guidance_h_nav_enter(void)
static void guidance_h_update_reference(void)
struct StabilizationSetpoint guidance_h_run(bool in_flight)
void guidance_h_set_vel(float vx, float vy)
Set horizontal acceleration setpoint.
void guidance_h_set_body_vel(float vx, float vy)
Set body relative horizontal velocity setpoint.
#define YAW_DEADBAND_EXCEEDED(_rc)
static void reset_guidance_reference_from_current_position(void)
#define GUIDANCE_H_SP_MAX_R
void guidance_h_set_heading_rate(float rate)
Set heading rate setpoint.
Horizontal guidance for rotorcrafts.
#define GUIDANCE_H_MODE_NAV
#define GUIDANCE_H_USE_REF
Use horizontal guidance reference trajectory.
struct Int32Vect2 accel
with INT32_ACCEL_FRAC
void guidance_h_run_enter(void)
#define GUIDANCE_H_MODE_HOVER
#define GUIDANCE_H_MODE_NONE
struct StabilizationSetpoint guidance_h_run_pos(bool in_flight, struct HorizontalGuidance *gh)
struct Int32Vect2 speed
with INT32_SPEED_FRAC
struct StabilizationSetpoint guidance_h_run_speed(bool in_flight, struct HorizontalGuidance *gh)
struct HorizontalGuidanceRCInput rc_sp
remote control setpoint
#define GUIDANCE_H_MODE_GUIDED
static void guidance_h_SetMaxSpeed(float speed)
struct Int32Vect2 pos
with INT32_POS_FRAC
struct HorizontalGuidanceReference ref
reference calculated from setpoints
#define GUIDANCE_H_USE_SPEED_REF
Use horizontal guidance speed reference.
struct StabilizationSetpoint guidance_h_run_accel(bool in_flight, struct HorizontalGuidance *gh)
struct HorizontalGuidanceSetpoint sp
setpoints
Vertical guidance for rotorcrafts.
struct RotorcraftNavigation nav
Rotorcraft navigation functions.
#define NAV_SETPOINT_MODE_QUAT
struct EnuCoor_f speed
speed setpoint (in m/s)
float fp_max_speed
maximum speed setpoint from flight plan (in m/s), negative value means unset or invalid,...
#define NAV_SETPOINT_MODE_SPEED
struct FloatQuat quat
quaternion setpoint
struct EnuCoor_f accel
accel setpoint (in m/s)
#define NAV_SETPOINT_MODE_ACCEL
#define NAV_HORIZONTAL_MODE_GUIDED
#define NAV_HORIZONTAL_MODE_ATTITUDE
float pitch
pitch angle (in radians)
#define NAV_HORIZONTAL_MODE_NONE
float heading
heading setpoint (in radians)
struct EnuCoor_f carrot
carrot position (also used for GCS display)
#define NAV_SETPOINT_MODE_POS
Nav setpoint modes these modes correspond to submodes defined by navigation routines to tell which se...
float roll
roll angle (in radians)
struct StabilizationSetpoint stab_sp_from_quat_f(struct FloatQuat *quat)
struct StabilizationSetpoint stab_sp_from_eulers_f(struct FloatEulers *eulers)
General stabilization interface for rotorcrafts.
#define STAB_SP_SET_EULERS_ZERO(_sp)
API to get/set the generic vehicle states.
static const struct usb_device_descriptor dev
enum HorizontalGuidanceSetpoint::@275 yaw_mask
struct Int32Vect2 pos
horizontal position setpoint in NED.
enum HorizontalGuidanceSetpoint::@274 h_mask
struct Int32Vect2 accel
For direct control of acceleration, if the guidance scheme is able to provide it.
struct Int32Vect2 speed
only used in HOVER mode if GUIDANCE_H_USE_SPEED_REF or in GUIDED mode
union StabilizationSetpoint::@278 sp
static float get_sys_time_float(void)
Get the time in seconds since startup.
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
Periodic telemetry system header (includes downlink utility and generated code).
#define DefaultPeriodic
Set default periodic telemetry.
int int32_t
Typedef defining 32 bit int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.