31 #ifndef RECTANGLE_SURVEY_DEFAULT_SWEEP
32 #define RECTANGLE_SURVEY_DEFAULT_SWEEP 25
35 #ifdef RECTANGLE_SURVEY_USE_INTERLEAVE
36 #define USE_INTERLEAVE TRUE
38 #define USE_INTERLEAVE FALSE
42 #include "pprzlink/messages.h"
45 #if PERIODIC_TELEMETRY
54 #ifndef RECTANGLE_SURVEY_HEADING_NS
55 #define RECTANGLE_SURVEY_HEADING_NS 0.f
58 #ifndef RECTANGLE_SURVEY_HEADING_WE
59 #define RECTANGLE_SURVEY_HEADING_WE 90.f
78 #define SurveyGoingNorth() ((survey_orientation == NS) && (survey_to.y > survey_from.y))
79 #define SurveyGoingSouth() ((survey_orientation == NS) && (survey_to.y < survey_from.y))
80 #define SurveyGoingEast() ((survey_orientation == WE) && (survey_to.x > survey_from.x))
81 #define SurveyGoingWest() ((survey_orientation == WE) && (survey_to.x < survey_from.x))
83 #include "generated/flight_plan.h"
85 #ifndef LINE_START_FUNCTION
86 #define LINE_START_FUNCTION {}
88 #ifndef LINE_STOP_FUNCTION
89 #define LINE_STOP_FUNCTION {}
95 pprz_msg_send_SURVEY(trans, dev, AC_ID,
96 &nav_survey_east, &nav_survey_north, &nav_survey_west, &nav_survey_south);
102 #if PERIODIC_TELEMETRY
114 survey_orientation = so;
116 if (survey_orientation ==
NS) {
147 nav_survey_shift = grid;
158 if (survey_orientation ==
NS) {
167 #ifdef NAV_SURVEY_RECTANGLE_DYNAMIC
168 nav_survey_shift = (nav_survey_shift > 0 ?
sweep : -
sweep);
171 static bool is_last_half =
false;
172 static float survey_radius;
221 if (survey_orientation ==
NS) {
224 if ((x0 + nav_survey_shift < nav_survey_west)
225 || (x0 + nav_survey_shift > nav_survey_east)) {
226 if (((x0 + (nav_survey_shift / 2)) < nav_survey_west)
227 || ((x0 + (nav_survey_shift / 2)) > nav_survey_east)) {
233 survey_radius = nav_survey_shift /2.;
235 is_last_half =
false;
239 survey_radius = nav_survey_shift /2.;
246 survey_radius = nav_survey_shift / 2.;
253 x0 = x0 + survey_radius;
267 survey_radius = -survey_radius;
273 if (my_y0 + nav_survey_shift < nav_survey_south
274 || my_y0 + nav_survey_shift > nav_survey_north) {
275 if (((my_y0 + (nav_survey_shift / 2)) < nav_survey_south)
276 || ((my_y0 + (nav_survey_shift / 2)) > nav_survey_north)) {
282 survey_radius = nav_survey_shift /2.;
284 is_last_half =
false;
288 survey_radius = nav_survey_shift /2.;
295 survey_radius = nav_survey_shift / 2.;
302 my_y0 = my_y0 + survey_radius;
316 survey_radius = -survey_radius;
325 if (survey_orientation ==
NS) {
331 double fract = modf (temp , &inteiro);
340 if (survey_orientation ==
WE) {
356 if (survey_orientation ==
WE) {
369 if (survey_orientation ==
WE) {
struct EnuCoor_i navigation_target
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
uint16_t rectangle_survey_sweep_num
#define LINE_STOP_FUNCTION
Periodic telemetry system header (includes downlink utility and generated code).
vector in East North Up coordinates Units: meters
#define VECT3_COPY(_a, _b)
#define SurveyGoingWest()
static struct EnuCoor_f * stateGetPositionEnu_f(void)
Get position in local ENU coordinates (float).
bool nav_survey_rectangle_rotorcraft_run(uint8_t wp1, uint8_t wp2)
#define SurveyGoingNorth()
#define RECTANGLE_SURVEY_HEADING_NS
static bool nav_survey_rectangle_active
Automatic survey of a rectangle for rotorcraft.
void nav_survey_rectangle_rotorcraft_init(void)
#define NavVerticalAltitudeMode(_alt, _pre_climb)
Set the vertical mode to altitude control with the specified altitude setpoint and climb pre-command...
static survey_orientation_t survey_orientation
#define DefaultPeriodic
Set default periodic telemetry.
#define HORIZONTAL_MODE_ROUTE
#define LINE_START_FUNCTION
#define SurveyGoingSouth()
void nav_survey_rectangle_rotorcraft_setup(uint8_t wp1, uint8_t wp2, float grid, survey_orientation_t so)
#define RECTANGLE_SURVEY_DEFAULT_SWEEP
#define RECTANGLE_SURVEY_HEADING_WE
static const struct usb_device_descriptor dev
Rotorcraft navigation functions.
void dc_send_command(uint8_t cmd)
Send Command To Camera.
static struct EnuCoor_f survey_from survey_to
vector in East North Up coordinates
API to get/set the generic vehicle states.
struct point waypoints[NB_WAYPOINT]
size == nb_waypoint, waypoint 0 is a dummy waypoint
void nav_set_heading_deg(float deg)
Set nav_heading in degrees.
Common code for AP and FBW telemetry.
#define ENU_BFP_OF_REAL(_o, _i)
static struct point survey_from
static struct EnuCoor_i survey_from_i survey_to_i
void nav_route(struct EnuCoor_i *wp_start, struct EnuCoor_i *wp_end)
float dc_distance_interval
AutoShoot photos on distance to last shot in meters.
static void send_survey(struct transport_tx *trans, struct link_device *dev)
#define SurveyGoingEast()
bool nav_approaching_from(struct EnuCoor_i *wp, struct EnuCoor_i *from, int16_t approaching_time)
Proximity tests on approaching a wp.
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.