Paparazzi UAS  v5.14.0_stable-0-g3f680d1
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
orange_avoider.c File Reference
#include "modules/orange_avoider/orange_avoider.h"
#include "modules/computer_vision/colorfilter.h"
#include "firmwares/rotorcraft/navigation.h"
#include "generated/flight_plan.h"
#include "generated/airframe.h"
#include "state.h"
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
+ Include dependency graph for orange_avoider.c:

Go to the source code of this file.

Macros

#define ORANGE_AVOIDER_VERBOSE   TRUE
 
#define PRINT(string,...)   fprintf(stderr, "[orange_avoider->%s()] " string,__FUNCTION__ , ##__VA_ARGS__)
 
#define VERBOSE_PRINT(...)
 
#define ORANGE_AVOIDER_LUM_MIN   41
 
#define ORANGE_AVOIDER_LUM_MAX   183
 
#define ORANGE_AVOIDER_CB_MIN   53
 
#define ORANGE_AVOIDER_CB_MAX   121
 
#define ORANGE_AVOIDER_CR_MIN   134
 
#define ORANGE_AVOIDER_CR_MAX   249
 

Functions

void orange_avoider_init ()
 
void orange_avoider_periodic ()
 
uint8_t increase_nav_heading (int32_t *heading, float incrementDegrees)
 
static uint8_t calculateForwards (struct EnuCoor_i *new_coor, float distanceMeters)
 
uint8_t moveWaypoint (uint8_t waypoint, struct EnuCoor_i *new_coor)
 
uint8_t moveWaypointForward (uint8_t waypoint, float distanceMeters)
 
uint8_t chooseRandomIncrementAvoidance ()
 

Variables

uint8_t safeToGoForwards = false
 
int tresholdColorCount = 0.05 * 124800
 
float incrementForAvoidance
 
uint16_t trajectoryConfidence = 1
 
float maxDistance = 2.25
 

Detailed Description

Author
Roland Meertens Example on how to use the colours detected to avoid orange pole in the cyberzoo

Definition in file orange_avoider.c.

Macro Definition Documentation

#define ORANGE_AVOIDER_CB_MAX   121

Definition at line 47 of file orange_avoider.c.

Referenced by orange_avoider_init().

#define ORANGE_AVOIDER_CB_MIN   53

Definition at line 43 of file orange_avoider.c.

Referenced by orange_avoider_init().

#define ORANGE_AVOIDER_CR_MAX   249

Definition at line 55 of file orange_avoider.c.

Referenced by orange_avoider_init().

#define ORANGE_AVOIDER_CR_MIN   134

Definition at line 51 of file orange_avoider.c.

Referenced by orange_avoider_init().

#define ORANGE_AVOIDER_LUM_MAX   183

Definition at line 39 of file orange_avoider.c.

Referenced by orange_avoider_init().

#define ORANGE_AVOIDER_LUM_MIN   41

Definition at line 35 of file orange_avoider.c.

Referenced by orange_avoider_init().

#define ORANGE_AVOIDER_VERBOSE   TRUE

Definition at line 25 of file orange_avoider.c.

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

Definition at line 27 of file orange_avoider.c.

#define VERBOSE_PRINT (   ...)

Function Documentation

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

Definition at line 128 of file orange_avoider.c.

References ANGLE_FLOAT_OF_BFP, POS_BFP_OF_REAL, POS_FLOAT_OF_BFP, Int32Eulers::psi, stateGetNedToBodyEulers_i(), stateGetPositionEnu_i(), VERBOSE_PRINT, 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:

uint8_t chooseRandomIncrementAvoidance ( void  )

Definition at line 169 of file orange_avoider.c.

References incrementForAvoidance, and VERBOSE_PRINT.

Referenced by orange_avoider_init(), and orange_avoider_periodic().

+ Here is the caller graph for this function:

uint8_t increase_nav_heading ( int32_t heading,
float  incrementDegrees 
)

Definition at line 114 of file orange_avoider.c.

References ANGLE_BFP_OF_REAL, ANGLE_FLOAT_OF_BFP, INT32_ANGLE_NORMALIZE, Int32Eulers::psi, stateGetNedToBodyEulers_i(), and VERBOSE_PRINT.

Referenced by orange_avoider_periodic().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint8_t moveWaypoint ( uint8_t  waypoint,
struct EnuCoor_i new_coor 
)

Definition at line 147 of file orange_avoider.c.

References POS_FLOAT_OF_BFP, VERBOSE_PRINT, waypoint_set_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:

uint8_t moveWaypointForward ( uint8_t  waypoint,
float  distanceMeters 
)

Definition at line 158 of file orange_avoider.c.

References calculateForwards(), and moveWaypoint().

Referenced by orange_avoider_periodic().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

float incrementForAvoidance

Definition at line 61 of file orange_avoider.c.

Referenced by chooseRandomIncrementAvoidance(), and orange_avoider_periodic().

float maxDistance = 2.25

Definition at line 63 of file orange_avoider.c.

Referenced by orange_avoider_periodic().

uint8_t safeToGoForwards = false

Definition at line 59 of file orange_avoider.c.

Referenced by orange_avoider_periodic().

uint16_t trajectoryConfidence = 1

Definition at line 62 of file orange_avoider.c.

Referenced by orange_avoider_periodic().

int tresholdColorCount = 0.05 * 124800

Definition at line 60 of file orange_avoider.c.

Referenced by orange_avoider_periodic().