Paparazzi UAS  v5.0.5_stable-7-g4b8bbb7
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
poly_survey_adv.c File Reference

Advanced polygon survey for fixedwings from Uni Stuttgart. More...

#include "poly_survey_adv.h"
#include "subsystems/nav.h"
#include "state.h"
#include "autopilot.h"
#include "generated/flight_plan.h"
+ Include dependency graph for poly_survey_adv.c:

Go to the source code of this file.

Macros

#define VEC_CALC(A, B, C, OP)   A.x = B.x OP C.x; A.y = B.y OP C.y;
 

Functions

static point2d vec_add (point2d a, point2d b)
 
static void nav_points (point2d start, point2d end)
 
static bool_t intercept_two_lines (point2d *p, point2d x, point2d y, float a1, float a2, float b1, float b2)
 intercept two lines and give back the point of intersection More...
 
static bool_t get_two_intersects (point2d *x, point2d *y, point2d a, point2d b)
 intersects a line with the polygon and gives back the two intersection points More...
 
bool_t init_poly_survey_adv (uint8_t first_wp, uint8_t size, float angle, float sweep_width, float shot_dist, float min_rad, float altitude)
 initializes the variables needed for the survey to start More...
 
bool_t poly_survey_adv (void)
 main navigation routine. More...
 

Variables

point2d dir_vec
 
point2d sweep_vec
 
point2d rad_vec
 
uint8_t poly_first
 
uint8_t poly_count
 
float psa_min_rad
 
float psa_sweep_width
 
float psa_shot_dist
 
float psa_altitude
 
int segment_angle
 
int return_angle
 
survey_stage psa_stage
 
point2d seg_start
 
point2d seg_end
 
point2d seg_center1
 
point2d seg_center2
 
point2d entry_center
 
point2d ret_start
 
point2d ret_end
 

Detailed Description

Advanced polygon survey for fixedwings from Uni Stuttgart.

Definition in file poly_survey_adv.c.

Macro Definition Documentation

#define VEC_CALC (   A,
  B,
  C,
  OP 
)    A.x = B.x OP C.x; A.y = B.y OP C.y;

Definition at line 91 of file poly_survey_adv.c.

Referenced by init_poly_survey_adv(), poly_survey_adv(), and vec_add().

Function Documentation

static bool_t get_two_intersects ( point2d x,
point2d y,
point2d  a,
point2d  b 
)
static

intersects a line with the polygon and gives back the two intersection points

Returns
TRUE if two intersection can be found, else FALSE
Parameters
x,yintersection points
a,bdefine the line to intersection

Definition at line 136 of file poly_survey_adv.c.

References FALSE, intercept_two_lines(), poly_count, poly_first, TRUE, waypoints, point2d::x, and point2d::y.

Referenced by init_poly_survey_adv(), and poly_survey_adv().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool_t init_poly_survey_adv ( uint8_t  first_wp,
uint8_t  size,
float  angle,
float  sweep_width,
float  shot_dist,
float  min_rad,
float  altitude 
)

initializes the variables needed for the survey to start

Parameters
first_wpthe first Waypoint of the polygon
sizethe number of points that make up the polygon
angleangle in which to do the flyovers
sweep_widthdistance between the sweeps
shot_distdistance between the shots
min_radminimal radius when navigating
altitudethe altitude that must be reached before the flyover starts

Definition at line 191 of file poly_survey_adv.c.

References ENTRY, ERR, FALSE, get_two_intersects(), NavVerticalAltitudeMode, NavVerticalAutoThrottleMode, poly_count, poly_first, psa_altitude, psa_min_rad, psa_shot_dist, psa_stage, psa_sweep_width, return_angle, segment_angle, VEC_CALC, waypoints, point2d::x, EnuCoor_i::x, point2d::y, and EnuCoor_i::y.

+ Here is the call graph for this function:

static bool_t intercept_two_lines ( point2d p,
point2d  x,
point2d  y,
float  a1,
float  a2,
float  b1,
float  b2 
)
static

intercept two lines and give back the point of intersection

Returns
FALSE if no intersection can be found or intersection does not lie between points a and b else TRUE
Parameters
preturns intersection
x,yfirst line is defined by point x and y (goes through this points)
a1,a2,b1,b2second line by coordinates a1/a2, b1/b2

Definition at line 114 of file poly_survey_adv.c.

References FALSE, TRUE, point2d::x, and point2d::y.

Referenced by get_two_intersects().

+ Here is the caller graph for this function:

static void nav_points ( point2d  start,
point2d  end 
)
static

Definition at line 101 of file poly_survey_adv.c.

References nav_route_xy(), point2d::x, and point2d::y.

Referenced by poly_survey_adv().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool_t poly_survey_adv ( void  )

main navigation routine.

This is called periodically evaluates the current Position and stage and navigates accordingly. Returns True until the survey is finished

Definition at line 300 of file poly_survey_adv.c.

References dc_stop(), dc_survey(), ENTRY, FALSE, get_two_intersects(), last_x, last_y, nav_approaching_xy(), nav_circle_XY(), nav_init_stage(), nav_points(), NavCourseCloseTo, NavVerticalAltitudeMode, NavVerticalAutoThrottleMode, psa_altitude, psa_min_rad, psa_shot_dist, psa_stage, psa_sweep_width, RET, return_angle, SEG, segment_angle, stateGetPositionUtm_f(), TRUE, TURN1, TURN2, vec_add(), VEC_CALC, point2d::x, and point2d::y.

+ Here is the call graph for this function:

static point2d vec_add ( point2d  a,
point2d  b 
)
static

Definition at line 93 of file poly_survey_adv.c.

References VEC_CALC.

Referenced by poly_survey_adv().

+ Here is the caller graph for this function:

Variable Documentation

point2d dir_vec

Definition at line 46 of file poly_survey_adv.c.

point2d entry_center

Definition at line 85 of file poly_survey_adv.c.

uint8_t poly_count

Definition at line 52 of file poly_survey_adv.c.

Referenced by get_two_intersects(), and init_poly_survey_adv().

uint8_t poly_first

Definition at line 51 of file poly_survey_adv.c.

Referenced by get_two_intersects(), and init_poly_survey_adv().

float psa_altitude

Definition at line 58 of file poly_survey_adv.c.

Referenced by init_poly_survey_adv(), and poly_survey_adv().

float psa_min_rad

Definition at line 55 of file poly_survey_adv.c.

Referenced by init_poly_survey_adv(), and poly_survey_adv().

float psa_shot_dist

Definition at line 57 of file poly_survey_adv.c.

Referenced by init_poly_survey_adv(), and poly_survey_adv().

survey_stage psa_stage

Definition at line 78 of file poly_survey_adv.c.

Referenced by init_poly_survey_adv(), and poly_survey_adv().

float psa_sweep_width

Definition at line 56 of file poly_survey_adv.c.

Referenced by init_poly_survey_adv(), and poly_survey_adv().

point2d rad_vec

Definition at line 48 of file poly_survey_adv.c.

point2d ret_end

Definition at line 87 of file poly_survey_adv.c.

point2d ret_start

Definition at line 86 of file poly_survey_adv.c.

int return_angle

Definition at line 62 of file poly_survey_adv.c.

Referenced by init_poly_survey_adv(), and poly_survey_adv().

point2d seg_center1

Definition at line 83 of file poly_survey_adv.c.

point2d seg_center2

Definition at line 84 of file poly_survey_adv.c.

point2d seg_end

Definition at line 82 of file poly_survey_adv.c.

point2d seg_start

Definition at line 81 of file poly_survey_adv.c.

int segment_angle

Definition at line 61 of file poly_survey_adv.c.

Referenced by init_poly_survey_adv(), and poly_survey_adv().

point2d sweep_vec

Definition at line 47 of file poly_survey_adv.c.