30 #include "generated/airframe.h"
36 #define ORANGE_AVOIDER_VERBOSE TRUE
38 #define PRINT(string,...) fprintf(stderr, "[orange_avoider_guided->%s()] " string,__FUNCTION__ , ##__VA_ARGS__)
39 #if ORANGE_AVOIDER_VERBOSE
40 #define VERBOSE_PRINT PRINT
42 #define VERBOSE_PRINT(...)
72 #ifndef ORANGE_AVOIDER_VISUAL_DETECTION_ID
73 #error This module requires two color filters, as such you have to define ORANGE_AVOIDER_VISUAL_DETECTION_ID to the orange filter
74 #error Please define ORANGE_AVOIDER_VISUAL_DETECTION_ID to be COLOR_OBJECT_DETECTION1_ID or COLOR_OBJECT_DETECTION2_ID in your airframe
78 int16_t __attribute__((unused)) pixel_x,
int16_t __attribute__((unused)) pixel_y,
79 int16_t __attribute__((unused)) pixel_width,
int16_t __attribute__((unused)) pixel_height,
85 #ifndef FLOOR_VISUAL_DETECTION_ID
86 #error This module requires two color filters, as such you have to define FLOOR_VISUAL_DETECTION_ID to the orange filter
87 #error Please define FLOOR_VISUAL_DETECTION_ID to be COLOR_OBJECT_DETECTION1_ID or COLOR_OBJECT_DETECTION2_ID in your airframe
92 int16_t __attribute__((unused)) pixel_width,
int16_t __attribute__((unused)) pixel_height,
110 AbiBindMsgVISUAL_DETECTION(FLOOR_VISUAL_DETECTION_ID, &floor_detection_ev,
floor_detection_cb);
148 if (
floor_count < floor_count_threshold || fabsf(floor_centroid_frac) > 0.12){
150 }
else if (obstacle_free_confidence == 0){
171 if (obstacle_free_confidence >= 2){
193 obstacle_free_confidence = 0;
211 if (rand() % 2 == 0) {
Event structure to store callbacks in a linked list.
uint8_t chooseRandomIncrementAvoidance(void)
#define GUIDANCE_H_MODE_GUIDED
#define VERBOSE_PRINT(...)
#define ORANGE_AVOIDER_VISUAL_DETECTION_ID
bool guidance_h_set_guided_heading_rate(float rate)
Set heading rate setpoint in GUIDED mode.
static struct FloatEulers * stateGetNedToBodyEulers_f(void)
Get vehicle body attitude euler angles (float).
Main include for ABI (AirBorneInterface).
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)
bool guidance_h_set_guided_body_vel(float vx, float vy)
Set body relative horizontal velocity setpoint in GUIDED mode.
float oag_color_count_frac
enum navigation_state_t navigation_state
static abi_event color_detection_ev
float oag_floor_count_frac
int16_t obstacle_free_confidence
float avoidance_heading_direction
struct HorizontalGuidance guidance_h
static abi_event floor_detection_ev
API to get/set the generic vehicle states.
const int16_t max_trajectory_confidence
void orange_avoider_guided_init(void)
bool guidance_h_set_guided_heading(float heading)
Set heading setpoint in GUIDED mode.
void orange_avoider_guided_periodic(void)
Horizontal guidance for rotorcrafts.
static void floor_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)