22 #include "generated/airframe.h"
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(...)
72 #ifndef ORANGE_AVOIDER_VISUAL_DETECTION_ID
73 #define ORANGE_AVOIDER_VISUAL_DETECTION_ID ABI_BROADCAST
77 int16_t __attribute__((unused)) pixel_x,
int16_t __attribute__((unused)) pixel_y,
78 int16_t __attribute__((unused)) pixel_width,
int16_t __attribute__((unused)) pixel_height,
215 VERBOSE_PRINT(
"Calculated %f m forward position. x: %f y: %f based on pos(%f, %f) and heading(%f)\n", distanceMeters,
238 if (rand() % 2 == 0) {
Main include for ABI (AirBorneInterface).
Event structure to store callbacks in a linked list.
bool autopilot_in_flight(void)
get in_flight flag
#define FLOAT_ANGLE_NORMALIZE(_a)
#define POS_FLOAT_OF_BFP(_ai)
#define POS_BFP_OF_REAL(_af)
vector in East North Up coordinates
static struct FloatEulers * stateGetNedToBodyEulers_f(void)
Get vehicle body attitude euler angles (float).
static struct EnuCoor_f * stateGetPositionEnu_f(void)
Get position in local ENU coordinates (float).
static struct EnuCoor_i * stateGetPositionEnu_i(void)
Get position in local ENU coordinates (int).
void waypoint_move_xy_i(uint8_t wp_id, int32_t x, int32_t y)
void waypoint_move_here_2d(uint8_t wp_id)
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)
#define VERBOSE_PRINT(...)
static uint8_t chooseRandomIncrementAvoidance(void)
static uint8_t moveWaypointForward(uint8_t waypoint, float distanceMeters)
static abi_event color_detection_ev
static uint8_t moveWaypoint(uint8_t waypoint, struct EnuCoor_i *new_coor)
void orange_avoider_periodic(void)
static uint8_t calculateForwards(struct EnuCoor_i *new_coor, float distanceMeters)
int16_t obstacle_free_confidence
float oa_color_count_frac
const int16_t max_trajectory_confidence
static uint8_t increase_nav_heading(float incrementDegrees)
@ SEARCH_FOR_SAFE_HEADING
#define ORANGE_AVOIDER_VISUAL_DETECTION_ID
void orange_avoider_init(void)
struct RotorcraftNavigation nav
Rotorcraft navigation functions.
float heading
heading setpoint (in radians)
API to get/set the generic vehicle states.
int int32_t
Typedef defining 32 bit int type.
short int16_t
Typedef defining 16 bit short type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
navigation_state
Camera focal length, in pixels (i.e. distance between camera.