22 #include "generated/airframe.h"
28 #define NAV_C // needed to get the nav funcitons like Inside...
29 #include "generated/flight_plan.h"
31 #define ORANGE_AVOIDER_VERBOSE TRUE
33 #define PRINT(string,...) fprintf(stderr, "[orange_avoider->%s()] " string,__FUNCTION__ , ##__VA_ARGS__)
34 #if ORANGE_AVOIDER_VERBOSE
35 #define VERBOSE_PRINT PRINT
37 #define VERBOSE_PRINT(...)
64 #ifndef ORANGE_AVOIDER_VISUAL_DETECTION_ID
65 #define ORANGE_AVOIDER_VISUAL_DETECTION_ID ABI_BROADCAST
69 int16_t __attribute__((unused)) pixel_x,
int16_t __attribute__((unused)) pixel_y,
70 int16_t __attribute__((unused)) pixel_width,
int16_t __attribute__((unused)) pixel_height,
122 }
else if (obstacle_free_confidence == 0){
144 if (obstacle_free_confidence >= 2){
157 obstacle_free_confidence = 0;
182 VERBOSE_PRINT(
"Increasing heading to %f\n", DegOfRad(new_heading));
196 VERBOSE_PRINT(
"Calculated %f m forward position. x: %f y: %f based on pos(%f, %f) and heading(%f)\n", distanceMeters,
230 if (rand() % 2 == 0) {
#define FLOAT_ANGLE_NORMALIZE(_a)
Event structure to store callbacks in a linked list.
void orange_avoider_init(void)
#define ORANGE_AVOIDER_VISUAL_DETECTION_ID
static struct FloatEulers * stateGetNedToBodyEulers_f(void)
Get vehicle body attitude euler angles (float).
int16_t obstacle_free_confidence
#define POS_BFP_OF_REAL(_af)
uint8_t moveWaypointForward(uint8_t waypoint, float distanceMeters)
Main include for ABI (AirBorneInterface).
void waypoint_move_here_2d(uint8_t wp_id)
static struct EnuCoor_f * stateGetPositionEnu_f(void)
Get position in local ENU coordinates (float).
static uint8_t calculateForwards(struct EnuCoor_i *new_coor, float distanceMeters)
const int16_t max_trajectory_confidence
static void color_detection_cb(uint8_t sender_id, int16_t pixel_x, int16_t pixel_y, int16_t pixel_width, int16_t pixel_height, int32_t quality, int16_t extra)
static abi_event color_detection_ev
bool autopilot_in_flight(void)
get in_flight flag
int32_t nav_heading
with INT32_ANGLE_FRAC
#define VERBOSE_PRINT(...)
uint8_t chooseRandomIncrementAvoidance(void)
#define ANGLE_BFP_OF_REAL(_af)
Rotorcraft navigation functions.
vector in East North Up coordinates
API to get/set the generic vehicle states.
uint8_t moveWaypoint(uint8_t waypoint, struct EnuCoor_i *new_coor)
uint8_t increase_nav_heading(float incrementDegrees)
#define POS_FLOAT_OF_BFP(_ai)
void waypoint_move_xy_i(uint8_t wp_id, int32_t x, int32_t y)
static struct EnuCoor_i * stateGetPositionEnu_i(void)
Get position in local ENU coordinates (int).
void orange_avoider_periodic(void)
float oa_color_count_frac
enum navigation_state_t navigation_state