Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
mav_exercise.c File Reference
#include "mav_exercise.h"
#include "modules/core/abi.h"
#include "firmwares/rotorcraft/navigation.h"
#include "state.h"
#include "autopilot_static.h"
#include <stdio.h>
#include "generated/flight_plan.h"
+ Include dependency graph for mav_exercise.c:

Go to the source code of this file.

Macros

#define NAV_C
 
#define PRINT(string, ...)   fprintf(stderr, "[mav_exercise->%s()] " string,__FUNCTION__ , ##__VA_ARGS__)
 
#define ORANGE_AVOIDER_VISUAL_DETECTION_ID   ABI_BROADCAST
 

Enumerations

enum  navigation_state_t {
  SAFE , OBSTACLE_FOUND , OUT_OF_BOUNDS , HOLD ,
  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 increase_nav_heading (float incrementDegrees)
 
uint8_t moveWaypointForward (uint8_t waypoint, float distanceMeters)
 
uint8_t moveWaypoint (uint8_t waypoint, struct EnuCoor_i *new_coor)
 
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 mav_exercise_init (void)
 
void mav_exercise_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 = SAFE
 
int32_t color_count = 0
 
int16_t obstacle_free_confidence = 0
 
float moveDistance = 2
 
float oob_haeding_increment = 5.f
 
const int16_t max_trajectory_confidence = 5
 
static abi_event color_detection_ev
 

Macro Definition Documentation

◆ NAV_C

#define NAV_C

Definition at line 28 of file mav_exercise.c.

◆ ORANGE_AVOIDER_VISUAL_DETECTION_ID

#define ORANGE_AVOIDER_VISUAL_DETECTION_ID   ABI_BROADCAST

Definition at line 56 of file mav_exercise.c.

◆ PRINT

#define PRINT (   string,
  ... 
)    fprintf(stderr, "[mav_exercise->%s()] " string,__FUNCTION__ , ##__VA_ARGS__)

Definition at line 31 of file mav_exercise.c.

Enumeration Type Documentation

◆ navigation_state_t

Enumerator
SAFE 
OBSTACLE_FOUND 
OUT_OF_BOUNDS 
HOLD 
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 37 of file mav_exercise.c.

Function Documentation

◆ calculateForwards()

static uint8_t calculateForwards ( struct EnuCoor_i new_coor,
float  distanceMeters 
)
static

Definition at line 151 of file mav_exercise.c.

References heading, POS_BFP_OF_REAL, FloatEulers::psi, stateGetNedToBodyEulers_f(), stateGetPositionEnu_i(), EnuCoor_i::x, and EnuCoor_i::y.

Referenced by moveWaypointForward().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ color_detection_cb()

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

Definition at line 59 of file mav_exercise.c.

References color_count.

Referenced by mav_exercise_init().

+ Here is the caller graph for this function:

◆ increase_nav_heading()

uint8_t increase_nav_heading ( float  incrementDegrees)

Definition at line 136 of file mav_exercise.c.

References FLOAT_ANGLE_NORMALIZE, RotorcraftNavigation::heading, nav, new_heading, FloatEulers::psi, and stateGetNedToBodyEulers_f().

Referenced by mav_exercise_periodic().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mav_exercise_init()

void mav_exercise_init ( void  )

Definition at line 67 of file mav_exercise.c.

References color_detection_cb(), color_detection_ev, and ORANGE_AVOIDER_VISUAL_DETECTION_ID.

+ Here is the call graph for this function:

◆ mav_exercise_periodic()

◆ moveWaypoint()

uint8_t moveWaypoint ( uint8_t  waypoint,
struct EnuCoor_i new_coor 
)

Definition at line 163 of file mav_exercise.c.

References waypoint_move_xy_i(), EnuCoor_i::x, and EnuCoor_i::y.

Referenced by moveWaypointForward().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ moveWaypointForward()

uint8_t moveWaypointForward ( uint8_t  waypoint,
float  distanceMeters 
)

Definition at line 171 of file mav_exercise.c.

References calculateForwards(), and moveWaypoint().

Referenced by mav_exercise_periodic().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ color_count

int32_t color_count = 0

Definition at line 47 of file mav_exercise.c.

Referenced by color_detection_cb(), and mav_exercise_periodic().

◆ color_detection_ev

abi_event color_detection_ev
static

Definition at line 58 of file mav_exercise.c.

Referenced by mav_exercise_init().

◆ max_trajectory_confidence

const int16_t max_trajectory_confidence = 5

Definition at line 51 of file mav_exercise.c.

Referenced by mav_exercise_periodic().

◆ moveDistance

float moveDistance = 2

Definition at line 49 of file mav_exercise.c.

Referenced by mav_exercise_periodic(), and orange_avoider_periodic().

◆ navigation_state

Definition at line 45 of file mav_exercise.c.

◆ oa_color_count_frac

float oa_color_count_frac = 0.18f

Definition at line 45 of file mav_exercise.c.

Referenced by mav_exercise_periodic().

◆ obstacle_free_confidence

int16_t obstacle_free_confidence = 0

Definition at line 48 of file mav_exercise.c.

Referenced by mav_exercise_periodic().

◆ oob_haeding_increment

float oob_haeding_increment = 5.f

Definition at line 50 of file mav_exercise.c.

Referenced by mav_exercise_periodic().