31#include "generated/flight_plan.h"
37#ifndef POLYSURVEY_DEFAULT_SIZE
38#define POLYSURVEY_DEFAULT_SIZE 10
41#ifndef POLYSURVEY_DEFAULT_DISTANCE
42#define POLYSURVEY_DEFAULT_DISTANCE 25
46#ifndef POLYSURVEY_ENTRY_DISTANCE
47#define POLYSURVEY_ENTRY_DISTANCE 0
51#ifndef POLYSURVEY_MAX_POLYGONSIZE
52#define POLYSURVEY_MAX_POLYGONSIZE 20
56#ifndef POLY_OSAM_HALF_SWEEP_ENABLED
57#define POLY_OSAM_HALF_SWEEP_ENABLED TRUE
67 if (dx == 0.0f) { dx = 0.000000001; }
78struct Line {
float m;
float b;
float x;};
85#define MaxPolygonSize POLYSURVEY_MAX_POLYGONSIZE
86#define MaxFloat 1000000000
87#define MinFloat -1000000000
89#ifndef LINE_START_FUNCTION
90#define LINE_START_FUNCTION {}
92#ifndef LINE_STOP_FUNCTION
93#define LINE_STOP_FUNCTION {}
164 for (i = 0; i <
Size; i++) {
170 for (i = 0; i <
Size; i++) {
177 for (i = 1; i <
Size; i++) {
188 for (i = 0; i <
Size; i++) {
198 for (i = 1; i <
Size; i++) {
205 for (i = 0; i <
Size; i++) {
234 for (i = 1; i <
Size - 1; i++) {
314 #ifdef NAV_SURVEY_POLY_DYNAMIC
523 *
y =
L1.m * (*x) +
L1.b;
529 return ((
y - L.
b) / L.
m);
void dc_send_command(uint8_t cmd)
Send Command To Camera.
Core autopilot interface common to all firmwares.
struct point waypoints[NB_WAYPOINT]
size == nb_waypoint, waypoint 0 is a dummy waypoint
float dc_distance_interval
AutoShoot photos on distance to last shot in meters.
Standard Digital Camera Control Interface.
#define VECT3_COPY(_a, _b)
static struct EnuCoor_f * stateGetPositionEnu_f(void)
Get position in local 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 POLYSURVEY_DEFAULT_SIZE
static void RotateAndTranslateToWorld(struct EnuCoor_f *p, float Zrot, float transX, float transY)
Rotates point round z by -Zrot then translates so (0,0) becomes (transX,transY)
#define LINE_STOP_FUNCTION
static float EvaluateLineForX(float y, struct Line L)
static uint8_t SurveySize
bool nav_survey_poly_run(void)
Run polygon survey.
uint16_t PolySurveySweepNum
static struct Point2D SmallestCorner
#define POLYSURVEY_ENTRY_DISTANCE
if 0 default to half sweep
static struct EnuCoor_f SurveyToWP
void nav_survey_poly_setup_towards(uint8_t FirstWP, uint8_t Size, float Sweep, int SecondWP)
Setup "dynamic" polygon survey with sweep orientation towards a waypoint.
static struct EnuCoor_f survey_from survey_to
static float EdgeMaxY[MaxPolygonSize]
static void FindInterceptOfTwoLines(float *x, float *y, struct Line L1, struct Line L2)
#define LINE_START_FUNCTION
static struct Line Edges[MaxPolygonSize]
static void TranslateAndRotateFromWorld(struct EnuCoor_f *p, float Zrot, float transX, float transY)
#define POLYSURVEY_DEFAULT_DISTANCE
static struct EnuCoor_f SurveyFromWP
void nav_survey_poly_setup(uint8_t EntryWP, uint8_t Size, float sw, float Orientation)
Setup polygon survey.
static uint8_t SurveyEntryWP
uint16_t PolySurveySweepBackNum
static struct EnuCoor_f SurveyEntry
#define POLY_OSAM_HALF_SWEEP_ENABLED
static float EdgeMinY[MaxPolygonSize]
static enum SurveyStatus CSurveyStatus
static struct point survey_from
vector in East North Up coordinates Units: meters
struct RotorcraftNavigation nav
void nav_set_heading_deg(float deg)
Set nav_heading in degrees.
Rotorcraft navigation functions.
navigation_approaching nav_approaching
navigation_route nav_route
API to get/set the generic vehicle states.
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.