Paparazzi UAS
v5.15_devel-230-gc96ce27
Paparazzi is a free software Unmanned Aircraft System.
|
#include "modules/orange_avoider/orange_avoider.h"
#include "firmwares/rotorcraft/navigation.h"
#include "generated/airframe.h"
#include "state.h"
#include "subsystems/abi.h"
#include <time.h>
#include <stdio.h>
#include "generated/flight_plan.h"
Go to the source code of this file.
Macros | |
#define | NAV_C |
#define | ORANGE_AVOIDER_VERBOSE TRUE |
#define | PRINT(string,...) fprintf(stderr, "[orange_avoider->%s()] " string,__FUNCTION__ , ##__VA_ARGS__) |
#define | VERBOSE_PRINT(...) |
#define | ORANGE_AVOIDER_VISUAL_DETECTION_ID ABI_BROADCAST |
Enumerations | |
enum | navigation_state_t { SAFE, OBSTACLE_FOUND, SEARCH_FOR_SAFE_HEADING, OUT_OF_BOUNDS, SAFE, OBSTACLE_FOUND, SEARCH_FOR_SAFE_HEADING, OUT_OF_BOUNDS, REENTER_ARENA } |
Functions | |
uint8_t | moveWaypointForward (uint8_t waypoint, float distanceMeters) |
uint8_t | moveWaypoint (uint8_t waypoint, struct EnuCoor_i *new_coor) |
uint8_t | increase_nav_heading (float incrementDegrees) |
uint8_t | chooseRandomIncrementAvoidance (void) |
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) |
void | orange_avoider_init (void) |
void | orange_avoider_periodic (void) |
static uint8_t | calculateForwards (struct EnuCoor_i *new_coor, float distanceMeters) |
Variables | |
float | oa_color_count_frac = 0.18f |
enum navigation_state_t | navigation_state = SEARCH_FOR_SAFE_HEADING |
int32_t | color_count = 0 |
int16_t | obstacle_free_confidence = 0 |
float | heading_increment = 5.f |
float | maxDistance = 2.25 |
const int16_t | max_trajectory_confidence = 5 |
static abi_event | color_detection_ev |
The color filter settings are set using the cv_detect_color_object. This module can run multiple filters simultaneously so you have to define which filter to use with the ORANGE_AVOIDER_VISUAL_DETECTION_ID setting.
Definition in file orange_avoider.c.
#define NAV_C |
Definition at line 28 of file orange_avoider.c.
#define ORANGE_AVOIDER_VERBOSE TRUE |
Definition at line 31 of file orange_avoider.c.
#define ORANGE_AVOIDER_VISUAL_DETECTION_ID ABI_BROADCAST |
Definition at line 65 of file orange_avoider.c.
Referenced by orange_avoider_guided_init(), and orange_avoider_init().
#define PRINT | ( | string, | |
... | |||
) | fprintf(stderr, "[orange_avoider->%s()] " string,__FUNCTION__ , ##__VA_ARGS__) |
Definition at line 33 of file orange_avoider.c.
#define VERBOSE_PRINT | ( | ... | ) |
Definition at line 37 of file orange_avoider.c.
Referenced by calculateForwards(), chooseRandomIncrementAvoidance(), increase_nav_heading(), moveWaypoint(), and orange_avoider_periodic().
enum navigation_state_t |
Enumerator | |
---|---|
SAFE | |
OBSTACLE_FOUND | |
SEARCH_FOR_SAFE_HEADING | |
OUT_OF_BOUNDS | |
SAFE | |
OBSTACLE_FOUND | |
SEARCH_FOR_SAFE_HEADING | |
OUT_OF_BOUNDS | |
REENTER_ARENA |
Definition at line 45 of file orange_avoider.c.
Definition at line 189 of file orange_avoider.c.
References heading, POS_BFP_OF_REAL, POS_FLOAT_OF_BFP, FloatEulers::psi, stateGetNedToBodyEulers_f(), stateGetPositionEnu_f(), stateGetPositionEnu_i(), VERBOSE_PRINT, EnuCoor_i::x, and EnuCoor_i::y.
Referenced by moveWaypointForward().
uint8_t chooseRandomIncrementAvoidance | ( | void | ) |
Definition at line 227 of file orange_avoider.c.
References heading_increment, and VERBOSE_PRINT.
Referenced by orange_avoider_init(), and orange_avoider_periodic().
|
static |
Definition at line 68 of file orange_avoider.c.
References color_count.
Referenced by orange_avoider_init().
uint8_t increase_nav_heading | ( | float | incrementDegrees | ) |
Definition at line 172 of file orange_avoider.c.
References ANGLE_BFP_OF_REAL, FLOAT_ANGLE_NORMALIZE, nav_heading, new_heading, FloatEulers::psi, stateGetNedToBodyEulers_f(), and VERBOSE_PRINT.
Referenced by orange_avoider_periodic().
Definition at line 205 of file orange_avoider.c.
References POS_FLOAT_OF_BFP, VERBOSE_PRINT, waypoint_move_xy_i(), EnuCoor_i::x, and EnuCoor_i::y.
Referenced by moveWaypointForward().
Definition at line 216 of file orange_avoider.c.
References calculateForwards(), and moveWaypoint().
Referenced by orange_avoider_periodic().
void orange_avoider_init | ( | void | ) |
Definition at line 79 of file orange_avoider.c.
References chooseRandomIncrementAvoidance(), color_detection_cb(), and ORANGE_AVOIDER_VISUAL_DETECTION_ID.
void orange_avoider_periodic | ( | void | ) |
Definition at line 92 of file orange_avoider.c.
References autopilot_in_flight(), chooseRandomIncrementAvoidance(), color_count, front_camera, heading_increment, increase_nav_heading(), max_trajectory_confidence, maxDistance, moveWaypointForward(), navigation_state, oa_color_count_frac, OBSTACLE_FOUND, obstacle_free_confidence, OUT_OF_BOUNDS, SAFE, SEARCH_FOR_SAFE_HEADING, VERBOSE_PRINT, waypoint_move_here_2d(), WaypointX, and WaypointY.
int32_t color_count = 0 |
Definition at line 57 of file orange_avoider.c.
Referenced by color_detection_cb(), and orange_avoider_periodic().
|
static |
Definition at line 67 of file orange_avoider.c.
float heading_increment = 5.f |
Definition at line 59 of file orange_avoider.c.
Referenced by chooseRandomIncrementAvoidance(), and orange_avoider_periodic().
const int16_t max_trajectory_confidence = 5 |
Definition at line 62 of file orange_avoider.c.
Referenced by orange_avoider_periodic().
float maxDistance = 2.25 |
Definition at line 60 of file orange_avoider.c.
Referenced by orange_avoider_periodic().
enum navigation_state_t navigation_state = SEARCH_FOR_SAFE_HEADING |
Definition at line 56 of file orange_avoider.c.
Referenced by orange_avoider_periodic().
float oa_color_count_frac = 0.18f |
Definition at line 53 of file orange_avoider.c.
Referenced by orange_avoider_periodic().
int16_t obstacle_free_confidence = 0 |
Definition at line 58 of file orange_avoider.c.
Referenced by orange_avoider_periodic().