]> rtime.felk.cvut.cz Git - eurobot/public.git/blob - src/pathplan/aalgorithm.h
robotfsm, pathplan: add angle for pathplan start point
[eurobot/public.git] / src / pathplan / aalgorithm.h
1 /**
2  * @file        aalgorithm.h
3  * @brief       Header file of aalgorithm.c
4  * @author      Jose Maria Martin Laguna <jmmartin@etud.insa-toulouse.fr>
5  *
6 */
7 #ifndef _AALGORITHM_H
8 #define _AALGORITHM_H
9
10 #include <stdbool.h>
11 #ifdef CONFIG_PP_USES_RBTREE
12 #include <rbtree.h>
13 #endif
14
15 /**
16  * Information of a cell in A* Algorithm
17 */
18 typedef struct _GraphMapCell {
19         float h;        /**<  @brief Heuristic cost of shortest path from cell to goal */
20         float f;        /**<  @brief Estimated cost of shortest path from start to goal */
21         float g;        /**<  @brief Backpointer length */
22         struct _GraphMapCell *backpointer; /**< Backpointer. */
23         bool processed; /**<  @brief Processed flag */
24         bool in_queue;
25 #ifndef CONFIG_PP_USES_RBTREE
26         struct _GraphMapCell *next; /**< Pointer to the next cell in a list. */
27 #else
28         struct _GraphMapCell *next; /**< Pointer to the next cell in a path. */
29         struct rb_node node;    /**< Red-Black tree data */
30 #endif
31 } GraphMapCell;
32
33 //bitmap max. dimension of robot (robodim.h) calculate to cell dimension
34 //TODO calculate automatic
35
36 #define TESTBITMAPS
37
38 #define BITMAP_AB 9     //AB/MAP_CELL_SIZE_MM 
39 #define BITMAP_AF 2     //AF/MAP_CELL_SIZE_MM 
40 #define BITMAP_W2 6     //W/2/MAP_CELL_SIZE_MM 
41
42 #define BITMAP_AB_ACROSS 6      //AB/MAP_CELL_SIZE_MM 
43 #define BITMAP_AF_ACROSS 2      //AF/MAP_CELL_SIZE_MM 
44 #define BITMAP_W2_ACROSS 5      //W/2/MAP_CELL_SIZE_MM 
45
46 typedef struct {
47   int x_min;
48   int x_max;
49   int y_min;
50   int y_max;
51 } bitmap_dim;
52
53 #ifdef __cplusplus
54 extern "C" {
55 #endif 
56 void GraphCell2XY(GraphMapCell *c, int *x, int *y);
57
58 int aAlgorithm(double xstart_real,double ystart_real, double xgoal_real, double ygoal_real, GraphMapCell **original_path);
59
60 int aAlgorithm_shape(double xstart_real,double ystart_real, double xgoal_real, double ygoal_real, double start_angle, double goal_angle, GraphMapCell **original_path);
61
62 #ifdef TESTBITMAPS
63 void init_bitmap(bitmap_dim bitmap[], int bitmap_ab, int bitmap_af, int bitmap_w2);
64 bool check_bot_position_straight(int x_0, int y_0, bitmap_dim bitmap_straight[], int angle);
65 bool check_bot_position_across(int x_0, int y_0, bitmap_dim bitmap_across[], int angle);
66 bool check_bot_position(int x_0, int y_0, bitmap_dim bitmap_straight[], bitmap_dim bitmap_across[], int angle
67 );
68 #endif
69 #ifdef __cplusplus
70 }
71 #endif 
72
73
74
75
76 #endif  /* _AALGORITHM_H */