33 #include "generated/flight_plan.h"
38 static bool nav_flower_mission(
uint8_t nb,
float *params,
bool init)
93 Flowerradius = sqrtf(EdgeCurrentX * EdgeCurrentX + EdgeCurrentY * EdgeCurrentY);
97 DistanceFromCenter = sqrtf(TransCurrentX * TransCurrentX + TransCurrentY * TransCurrentY);
99 FlowerTheta = atan2f(TransCurrentY, TransCurrentX);
100 Fly2X = Flowerradius * cosf(FlowerTheta + 3.14) +
WaypointX(Center);
101 Fly2Y = Flowerradius * sinf(FlowerTheta + 3.14) +
WaypointY(Center);
105 if (DistanceFromCenter > Flowerradius) {
119 DistanceFromCenter = sqrtf(TransCurrentX * TransCurrentX + TransCurrentY * TransCurrentY);
121 bool InCircle =
true;
124 if (DistanceFromCenter > Flowerradius) {
131 switch (CFlowerStatus) {
136 FlowerTheta = atan2f(TransCurrentY, TransCurrentX);
137 Fly2X = Flowerradius * cosf(FlowerTheta + 3.14) +
WaypointX(Center);
138 Fly2Y = Flowerradius * sinf(FlowerTheta + 3.14) +
WaypointY(Center);
149 CircleX = Flowerradius * cosf(FlowerTheta + 3.14 - CircleTheta) +
WaypointX(Center);
150 CircleY = Flowerradius * sinf(FlowerTheta + 3.14 - CircleTheta) +
WaypointY(Center);
159 Flowerradius = sqrtf(EdgeCurrentX * EdgeCurrentX + EdgeCurrentY * EdgeCurrentY);
160 if (DistanceFromCenter > Flowerradius) {
165 FlowerTheta = atan2f(TransCurrentY, TransCurrentX);
166 Fly2X = Flowerradius * cosf(FlowerTheta + 3.14) +
WaypointX(Center);
167 Fly2Y = Flowerradius * sinf(FlowerTheta + 3.14) +
WaypointY(Center);
static float TransCurrentY
void nav_circle_XY(float x, float y, float radius)
Navigates around (x, y).
bool mission_register(mission_custom_cb cb, char *type)
Register a new navigation or action callback function.
static struct EnuCoor_f * stateGetPositionEnu_f(void)
Get position in local ENU coordinates (float).
void nav_flower_setup(uint8_t CenterWP, uint8_t EdgeWP)
static float DistanceFromCenter
static float EdgeCurrentY
bool nav_flower_run(void)
#define NavVerticalAltitudeMode(_alt, _pre_climb)
Set the vertical mode to altitude control with the specified altitude setpoint and climb pre-command...
static float TransCurrentX
FlowerStatus
Makes a flower pattern.
static float Flowerradius
#define NavVerticalAutoThrottleMode(_pitch)
Set the climb control to auto-throttle with the specified pitch pre-command.
void nav_init_stage(void)
needs to be implemented by fixedwing and rotorcraft seperately
void nav_route_xy(float last_wp_x, float last_wp_y, float wp_x, float wp_y)
Computes the carrot position along the desired segment.
Core autopilot interface common to all firmwares.
static enum FlowerStatus CFlowerStatus
API to get/set the generic vehicle states.
struct point waypoints[NB_WAYPOINT]
size == nb_waypoint, waypoint 0 is a dummy waypoint
Fixedwing Navigation library.
void nav_flower_init(void)
static float EdgeCurrentX