Revision 3aee55de
| devices/DiWheelDrive/amiro_map.hpp | ||
|---|---|---|
| 3 | 3 |
|
| 4 | 4 |
#include "global.hpp" |
| 5 | 5 |
#include "linefollow.hpp" |
| 6 |
#include <amiroosconf.h> |
|
| 7 |
#include <ch.hpp> |
|
| 8 |
#include <cstdint> |
|
| 9 |
#include <math.h> |
|
| 10 | 6 |
|
| 11 | 7 |
|
| 12 | 8 |
namespace amiro {
|
| ... | ... | |
| 16 | 12 |
uint8_t flag; |
| 17 | 13 |
uint8_t left; |
| 18 | 14 |
uint8_t right; |
| 15 |
union edge {
|
|
| 16 |
struct edge_id{
|
|
| 17 |
uint8_t left; |
|
| 18 |
uint8_t right; |
|
| 19 |
} edge_id; |
|
| 20 |
uint8_t arr[2]; |
|
| 21 |
} edge; |
|
| 19 | 22 |
uint8_t visited; |
| 20 | 23 |
types::position pL; // Left |
| 21 | 24 |
types::position pR; // Right |
| 22 | 25 |
types::position pB; // Back |
| 26 |
union p{
|
|
| 27 |
struct{types::position pL, pR, pB;} points;
|
|
| 28 |
types::position arr[3]; |
|
| 29 |
} p; |
|
| 23 | 30 |
}; |
| 24 | 31 |
|
| 25 | 32 |
struct map_state {
|
| ... | ... | |
| 75 | 82 |
Internally the update will be called. |
| 76 | 83 |
If there are no nodes in the node list they will be created. |
| 77 | 84 |
*/ |
| 78 |
uint8_t trackUpdate(uint16_t WL, uint16_t WR, LineFollowStrategy strategy, ut_states state); |
|
| 85 |
uint8_t trackUpdate(uint16_t WL, uint16_t WR, LineFollowStrategy strategy, ut_states ut_state); |
|
| 86 |
|
|
| 87 |
|
|
| 88 |
|
|
| 89 |
|
|
| 79 | 90 |
|
| 80 | 91 |
private: |
| 81 | 92 |
Global *global; |
| ... | ... | |
| 109 | 120 |
* |
| 110 | 121 |
*/ |
| 111 | 122 |
uint32_t calculateDist(types::position *p1, types::position *p2); |
| 112 |
}; |
|
| 123 |
|
|
| 124 |
// add node/fxp to the nodeList and return its id |
|
| 125 |
uint8_t addNode(uint8_t l, uint8_t r, uint8_t flags); |
|
| 126 |
|
|
| 127 |
// Calculate dist and elength if possibel |
|
| 128 |
void calTravelState(); |
|
| 129 |
|
|
| 130 |
// Check if all nodes have followers |
|
| 131 |
// Calculate validity check |
|
| 132 |
void checkMap(); |
|
| 133 |
|
|
| 134 |
void switchToNext(types::position *p1); |
|
| 135 |
|
|
| 136 |
// Copy contents of point from to point to (x, y, f_x) |
|
| 137 |
void copyPoint(types::position *from, types::position *to); |
|
| 138 |
|
|
| 139 |
// Create the first fxp with flag 1 |
|
| 140 |
void createInitNode(); |
|
| 141 |
|
|
| 142 |
uint8_t getNearest(types::position *p1); |
|
| 143 |
|
|
| 144 |
// Either create new fxpoint or assign point to existing one |
|
| 145 |
uint8_t assignFxp(types::position *p1); |
|
| 146 |
}; |
|
| 147 |
|
|
| 113 | 148 |
}; // namespace amiro |
| 114 | 149 |
|
| 115 | 150 |
#endif /* AMIRO_MAP */ |
Also available in: Unified diff