Skip to content

Commit

Permalink
[NAV] Polygon Survey with orientation defined by a waypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
dewagter committed Oct 23, 2014
1 parent c49f516 commit a390d83
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions sw/airborne/modules/nav/nav_survey_poly_osam.c
Expand Up @@ -32,6 +32,16 @@
#include "generated/flight_plan.h"


bool_t nav_survey_poly_osam_setup_towards(uint8_t FirstWP, uint8_t Size, float Sweep, int SecondWP)
{
float dx = waypoints[SecondWP].x - waypoints[FirstWP].x;
float dy = waypoints[SecondWP].y - waypoints[FirstWP].y;
if (dx == 0.0f) dx = 0.000000001;
float ang = atan(dy/dx);
return nav_survey_poly_osam_setup_towards(FirstWP, Size, Sweep, DegOfRad(ang));
}


struct Point2D {float x; float y;};
struct Line {float m;float b;float x;};

Expand Down
2 changes: 2 additions & 0 deletions sw/airborne/modules/nav/nav_survey_poly_osam.h
Expand Up @@ -30,6 +30,8 @@
#include "std.h"

extern bool_t nav_survey_poly_osam_setup(uint8_t FirstWP, uint8_t Size, float Sweep, float Orientation);
/** start a polygonsurvey and compute the orientation angle from the line FirstWP-SecondWP */
extern bool_t nav_survey_poly_osam_setup_towards(uint8_t FirstWP, uint8_t Size, float Sweep, int SecondWP);
extern bool_t nav_survey_poly_osam_run(void);
extern uint16_t PolySurveySweepNum;
extern uint16_t PolySurveySweepBackNum;
Expand Down

0 comments on commit a390d83

Please sign in to comment.