33 #include "generated/flight_plan.h"
35 #ifndef NAV_SPIRAL_3D_DIST_DIFF
36 #define NAV_SPIRAL_3D_DIST_DIFF 10.f
39 #ifndef NAV_SPIRAL_3D_ALT_DIFF
40 #define NAV_SPIRAL_3D_ALT_DIFF 10.f
43 #ifndef NAV_SPIRAL_3D_MIN_CIRCLE_RADIUS
44 #define NAV_SPIRAL_3D_MIN_CIRCLE_RADIUS 50.f
76 float r_start = params[4];
77 float r_stop = params[5];
106 float vz = params[0];
130 float vx,
float vy,
float vz)
137 if (deltaZ * vz < 0.f &&
138 fabsf(deltaZ) > 1.f &&
160 if (fabsf(deltaR) < 1.f) {
163 }
else if (fabsf(deltaZ) < 1.f && fabsf(vz) > 0.1f) {
168 float sign = deltaR < 0.f ? -1.f : 1.0;
171 }
else if (fabsf(vz) < 0.1f) {
192 float dist_diff, alt_diff;
193 float pre_climb = 0.f;
Core autopilot interface common to all firmwares.
#define FLOAT_VECT3_ZERO(_v)
static float float_vect2_norm(struct FloatVect2 *v)
#define VECT2_DIFF(_c, _a, _b)
#define VECT3_ASSIGN(_a, _x, _y, _z)
#define VECT3_ADD(_a, _b)
static struct EnuCoor_f * stateGetPositionEnu_f(void)
Get position in local ENU coordinates (float).
static struct UtmCoor_f * stateGetPositionUtm_f(void)
Get position in UTM coordinates (float).
bool mission_register(mission_custom_cb cb, char *type)
Register a new navigation or action callback function.
@ MissionUpdate
param update
void nav_circle_XY(float x, float y, float radius)
Navigates around (x, y).
Fixedwing Navigation library.
#define NAVIGATION_FREQUENCY
Default fixedwing navigation frequency.
#define NavVerticalAltitudeMode(_alt, _pre_climb)
Set the vertical mode to altitude control with the specified altitude setpoint and climb pre-command.
#define NavVerticalAutoThrottleMode(_pitch)
Set the climb control to auto-throttle with the specified pitch pre-command.
static float sign(float x)
sign function
void nav_spiral_3D_init(void)
#define NAV_SPIRAL_3D_MIN_CIRCLE_RADIUS
#define NAV_SPIRAL_3D_ALT_DIFF
void nav_spiral_3D_setup(float center_x, float center_y, float alt_start, float alt_stop, float radius_start, float radius_stop, float vx, float vy, float vz)
Initialize spiral 3D based on:
#define NAV_SPIRAL_3D_DIST_DIFF
bool nav_spiral_3D_run(void)
Run spiral 3D navigation.
struct NavSpiral3D nav_spiral_3D
struct FloatVect3 pos_incr
static const float nav_dt
enum Spiral3DStatus status
Fixedwing navigation in a 3D spiral.
struct FloatVect2 pos_diff
vector in East North Up coordinates Units: meters
API to get/set the generic vehicle states.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.