35 #include "generated/flight_plan.h"
64 divider = (((b2 - a2) * (y.
x - x.
x)) + ((x.
y - y.
y) * (b1 - a1)));
65 if (divider == 0) {
return false; }
66 fac = ((y.
x * (x.
y - a2)) + (x.
x * (a2 - y.
y)) + (a1 * (y.
y - x.
y))) / divider;
67 if (fac > 1.0) {
return false; }
68 if (fac < 0.0) {
return false; }
70 p->
x = a1 + fac * (b1 - a1);
71 p->
y = a2 + fac * (b2 - a2);
144 float divider, angle_rad = angle / 180.0 * M_PI;
146 if (angle < 0.0) { angle += 360.0; }
147 if (angle >= 360.0) { angle -= 360.0; }
162 if (angle <= 45.0 || angle >= 315.0) {
168 }
else if (angle <= 135.0) {
174 }
else if (angle <= 225.0) {
252 #ifdef NAV_SURVEY_POLY_GVF_DYNAMIC
struct FloatVect2 seg_center2
bool gvf_nav_survey_polygon_run(void)
enum gvf_SurveyStage stage
#define VECT2_SUM(_c, _a, _b)
#define FLOAT_VECT2_NORMALIZE(_v)
#define VECT2_COPY(_a, _b)
struct FloatVect2 ret_start
#define VECT2_DIFF(_c, _a, _b)
struct gvf_SurveyPolyAdv gvf_survey
bool gvf_ellipse_XY(float x, float y, float a, float b, float alpha)
static bool gvf_get_two_intersects(struct FloatVect2 *x, struct FloatVect2 *y, struct FloatVect2 a, struct FloatVect2 b)
intersects a line with the polygon and gives back the two intersection points
bool gvf_segment_XY1_XY2(float x1, float y1, float x2, float y2)
uint8_t dc_survey(float interval, float x, float y)
Sets the dc control in distance mode.
float gvf_nav_survey_sweep
#define NavCourseCloseTo(x)
static void gvf_nav_points(struct FloatVect2 start, struct FloatVect2 end)
Standard Digital Camera Control Interface.
#define NavVerticalAltitudeMode(_alt, _pre_climb)
Set the vertical mode to altitude control with the specified altitude setpoint and climb pre-command...
void gvf_nav_survey_polygon_setup(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
struct FloatVect2 sweep_vec
Guidance algorithm based on vector fields.
void gvf_set_direction(int8_t s)
#define NavVerticalAutoThrottleMode(_pitch)
Set the climb control to auto-throttle with the specified pitch pre-command.
#define VECT2_SMUL(_vo, _vi, _s)
struct FloatVect2 seg_center1
void nav_init_stage(void)
needs to be implemented by fixedwing and rotorcraft seperately
struct FloatVect2 rad_vec
Core autopilot interface common to all firmwares.
static struct UtmCoor_f * stateGetPositionUtm_f(void)
Get position in UTM coordinates (float).
API to get/set the generic vehicle states.
uint8_t dc_stop(void)
Stop dc control.
struct point waypoints[NB_WAYPOINT]
size == nb_waypoint, waypoint 0 is a dummy waypoint
static bool gvf_intercept_two_lines(struct FloatVect2 *p, struct FloatVect2 x, struct FloatVect2 y, float a1, float a2, float b1, float b2)
intercept two lines and give back the point of intersection
struct FloatVect2 dir_vec
bool nav_approaching_xy(float x, float y, float from_x, float from_y, float approaching_time)
Decide if the UAV is approaching the current waypoint.
void gvf_nav_direction_circle(float rad)
main navigation routine.
Fixedwing Navigation library.
struct FloatVect2 seg_end
struct FloatVect2 entry_center
struct FloatVect2 seg_start
#define CARROT
default approaching_time for a wp
struct FloatVect2 ret_end