Go to the source code of this file.
Data Structures | |
struct | _ext_point |
struct | _point |
struct | _line |
struct | _poly |
struct | obstacle_avoidance |
Defines | |
#define | MAX_POLY 3 |
#define | MAX_PTS 10 |
#define | MAX_RAYS 100 |
#define | MAX_CHKPOINTS 5 |
#define | PLAYGROUND_X_MIN 0 |
#define | PLAYGROUND_X_MAX 300 |
#define | PLAYGROUND_Y_MIN 0 |
#define | PLAYGROUND_Y_MAX 210 |
Typedefs | |
typedef struct _ext_point | oa_ext_point_t |
typedef struct _point | oa_point_t |
typedef struct _line | oa_line_t |
typedef struct _poly | oa_poly_t |
Functions | |
void | oa_init (void) |
void | oa_start_end_points (int32_t st_x, int32_t st_y, int32_t en_x, int32_t en_y) |
oa_poly_t * | oa_new_poly (uint8_t size) |
void | oa_poly_set_point (oa_poly_t *pol, int32_t x, int32_t y, uint8_t i) |
int8_t | oa_process (void) |
oa_point_t * | oa_get_path (void) |
uint8_t | is_point_in_poly (oa_poly_t *pol, int16_t x, int16_t y) |
#define MAX_CHKPOINTS 5 |
#define MAX_POLY 3 |
#define MAX_PTS 10 |
#define MAX_RAYS 100 |
Definition at line 58 of file obstacle_avoidance.h.
#define PLAYGROUND_X_MAX 300 |
Definition at line 62 of file obstacle_avoidance.h.
#define PLAYGROUND_X_MIN 0 |
Definition at line 61 of file obstacle_avoidance.h.
#define PLAYGROUND_Y_MAX 210 |
Definition at line 65 of file obstacle_avoidance.h.
#define PLAYGROUND_Y_MIN 0 |
Definition at line 64 of file obstacle_avoidance.h.
typedef struct _ext_point oa_ext_point_t |
typedef struct _point oa_point_t |
uint8_t is_point_in_poly | ( | oa_poly_t * | pol, | |
int16_t | x, | |||
int16_t | y | |||
) |
return
Definition at line 361 of file obstacle_avoidance.c.
References _ext_point::x, and _ext_point::y.
oa_point_t* oa_get_path | ( | void | ) |
get the result after a call to oa_process()
Definition at line 112 of file obstacle_avoidance.c.
References obstacle_avoidance::res, and obstacle_avoidance::u.
void oa_init | ( | void | ) |
Init the oa structure
Init the oa structure. Note: In the algorithm, the first polygon is a dummy one, and is used to represent the START and END points (so it has 2 vertices)
Definition at line 42 of file obstacle_avoidance.c.
References _poly::l, oa_start_end_points(), obstacle_avoidance::points, obstacle_avoidance::polys, and _poly::pts.
oa_poly_t* oa_new_poly | ( | uint8_t | size | ) |
Create a new obstacle polygon. Return NULL on error.
Definition at line 84 of file obstacle_avoidance.c.
References obstacle_avoidance::cur_poly_idx, obstacle_avoidance::cur_pt_idx, _poly::l, MAX_POLY, MAX_PTS, obstacle_avoidance::points, obstacle_avoidance::polys, and _poly::pts.
void oa_poly_set_point | ( | oa_poly_t * | pol, | |
int32_t | x, | |||
int32_t | y, | |||
uint8_t | i | |||
) |
set a point of the polygon.
Add a point to the polygon.
Definition at line 101 of file obstacle_avoidance.c.
References DEBUG, E_OA, _poly::pts, _ext_point::valid, _ext_point::weight, _ext_point::x, and _ext_point::y.
int8_t oa_process | ( | void | ) |
process the path from start to end. Return 0 on sucess.
Definition at line 687 of file obstacle_avoidance.c.
References calc_rays(), calc_rays_weight(), obstacle_avoidance::cur_poly_idx, DEBUG, dijkstra(), E_OA, get_path(), obstacle_avoidance::polys, _poly::pts, obstacle_avoidance::ray_n, obstacle_avoidance::rays, obstacle_avoidance::u, obstacle_avoidance::weight, _ext_point::x, and _ext_point::y.
void oa_start_end_points | ( | int32_t | st_x, | |
int32_t | st_y, | |||
int32_t | en_x, | |||
int32_t | en_y | |||
) |
Set the start and destination point.
Set the start and destination point. Return 0 on sucess
Definition at line 56 of file obstacle_avoidance.c.
References obstacle_avoidance::cur_poly_idx, obstacle_avoidance::cur_pt_idx, obstacle_avoidance::points, _ext_point::valid, _ext_point::weight, _ext_point::x, and _ext_point::y.
Referenced by oa_init().