36#include "generated/flight_plan.h"
43#ifndef SURVEY_HYBRID_APPROACHING_TIME
44#define SURVEY_HYBRID_APPROACHING_TIME 3.f
48#ifndef SURVEY_HYBRID_MAX_POLYGON_SIZE
49#define SURVEY_HYBRID_MAX_POLYGON_SIZE 20
53#ifndef SURVEY_HYBRID_HALF_SWEEP_ENABLED
54#define SURVEY_HYBRID_HALF_SWEEP_ENABLED true
58#ifndef SURVEY_HYBRID_MAX_SWEEP
59#define SURVEY_HYBRID_MAX_SWEEP 0
63#ifndef SURVEY_HYBRID_MAX_SWEEP_BACK
64#define SURVEY_HYBRID_MAX_SWEEP_BACK 0
68#ifndef SURVEY_HYBRID_ENTRY_DISTANCE
69#define SURVEY_HYBRID_ENTRY_DISTANCE (survey_private.sweep_distance / 2.f)
73#ifndef SURVEY_HYBRID_ENTRY_CIRCLE
74#define SURVEY_HYBRID_ENTRY_CIRCLE TRUE
114#define MaxFloat 1000000000
115#define MinFloat -1000000000
117#ifndef LINE_START_FUNCTION
118#define LINE_START_FUNCTION {}
120#ifndef LINE_STOP_FUNCTION
121#define LINE_STOP_FUNCTION {}
130 if (nb == 10 || nb == 12) {
132 float sweep = params[1];
134 float height = params[3];
155 if (nb == 10 || nb == 12) {
157 float sweep = params[1];
159 float height = params[3];
219 if (radius < -0.1f) {
222 }
else if (radius > 0.1f) {
371 for (
int i = 0; i < size; i++) {
388 if (start ==
NULL || second ==
NULL) {
392 float dx = second->
x - start->
x;
393 float dy = second->
y - start->
y;
619 p->x =
p->x - trans->
x;
620 p->y =
p->y - trans->
y;
635 p->x =
p->x + trans->
x;
636 p->y =
p->y + trans->
y;
642 *
y =
L1.m * (*x) +
L1.b;
648 return ((
y - L.
b) / L.
m);
void dc_send_command(uint8_t cmd)
Send Command To Camera.
Core autopilot interface common to all firmwares.
float dc_distance_interval
AutoShoot photos on distance to last shot in meters.
Standard Digital Camera Control Interface.
#define FLOAT_VECT2_ZERO(_v)
#define VECT2_COPY(_a, _b)
#define VECT3_COPY(_a, _b)
static struct LtpDef_f * stateGetNedOrigin_f(void)
Get the coordinate NED frame origin (float)
struct LlaCoor_f stateGetLlaOrigin_f(void)
Get the LLA position of the frame origin (float)
static struct EnuCoor_f * stateGetPositionEnu_f(void)
Get position in local ENU coordinates (float).
bool mission_register(mission_custom_cb cb, char *type)
Register a new navigation or action callback function.
struct EnuCoor_f * waypoint_get_enu_f(uint8_t wp_id)
Get ENU coordinates (float)
void nav_init_stage(void)
needs to be implemented by fixedwing and rotorcraft seperately
#define NavVerticalAltitudeMode(_alt, _pre_climb)
Set the vertical mode to altitude control with the specified altitude setpoint and climb pre-command.
#define CloseRadAngles(_c1, _c2)
#define SURVEY_HYBRID_MAX_SWEEP_BACK
uint8_t size
size of the polygon
#define SURVEY_HYBRID_APPROACHING_TIME
struct EnuCoor_f to_wp
tmp point in rotated frame
struct EnuCoor_f from_wp
tmp point in rotated frame
float orientation
requested orientation in radians
#define LINE_STOP_FUNCTION
static float CrossProductZ(struct EnuCoor_f *p1_start, struct EnuCoor_f *p1_end, struct EnuCoor_f *p2_start, struct EnuCoor_f *p2_end)
#define SURVEY_HYBRID_ENTRY_DISTANCE
#define SURVEY_HYBRID_MAX_SWEEP
float sweep
oriented sweep distance
static void nav_survey_hybrid_setup(float orientation, float sweep, float radius, float height)
finish preparation of survey based on private structure
static float EvaluateLineForX(float y, struct Line L)
static void RotateAndTranslateToWorld(struct EnuCoor_f *p, float Zrot, struct EnuCoor_f *trans)
Rotates point round z by -Zrot then translates so (0,0) becomes (transX,transY)
struct EnuCoor_f entry
entry point
struct Line edges[SURVEY_HYBRID_MAX_POLYGON_SIZE]
polygon edges
void nav_survey_hybrid_init(void)
Init function.
static void TranslateAndRotateFromWorld(struct EnuCoor_f *p, float Zrot, struct EnuCoor_f *trans)
static struct SurveyHybridPrivate survey_private
struct EnuCoor_f circle
circle center
#define SURVEY_HYBRID_ENTRY_CIRCLE
static void FindInterceptOfTwoLines(float *x, float *y, struct Line L1, struct Line L2)
#define SURVEY_HYBRID_MAX_POLYGON_SIZE
#define LINE_START_FUNCTION
bool circle_turns
turns with circles (or lines between points otherwise)
float edge_min_y[SURVEY_HYBRID_MAX_POLYGON_SIZE]
tmp point in rotated frame
bool nav_survey_hybrid_run(void)
Run polygon hybrid survey.
void nav_survey_hybrid_setup_orientation(uint8_t start_wp, float orientation, uint8_t size, float sweep, float radius, float height)
Setup polygon survey.
float sweep_distance
requested sweep distance
#define SURVEY_HYBRID_HALF_SWEEP_ENABLED
struct EnuCoor_f segment_to
end of current segment
void nav_survey_hybrid_setup_towards(uint8_t start_wp, uint8_t second_wp, uint8_t size, float sweep, float radius, float height)
Setup "dynamic" polygon survey with sweep orientation towards a waypoint.
float edge_max_y[SURVEY_HYBRID_MAX_POLYGON_SIZE]
tmp point in rotated frame
enum SurveyStatus status
current state
struct EnuCoor_f corners[SURVEY_HYBRID_MAX_POLYGON_SIZE]
corners location
struct SurveyHybrid survey_hybrid
struct EnuCoor_f segment_from
start of current segment
struct EnuCoor_f smallest_corner
tmp point in rotated frame
uint16_t sweep_back_nb_max
Paparazzi floating point algebra.
void enu_of_lla_point_f(struct EnuCoor_f *enu, struct LtpDef_f *def, struct LlaCoor_f *lla)
float alt
in meters (normally above WGS84 reference ellipsoid)
vector in East North Up coordinates Units: meters
vector in Latitude, Longitude and Altitude
struct RotorcraftNavigation nav
Rotorcraft navigation functions.
navigation_approaching nav_approaching
navigation_circle nav_circle
navigation_route nav_route
API to get/set the generic vehicle states.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.