Skip to content

Commit 7d91954

Browse files
committed
Deleted useless define
1 parent 315c2c9 commit 7d91954

File tree

9 files changed

+29
-53
lines changed

9 files changed

+29
-53
lines changed

include/PathPlanning/Mapping.h

+3-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
//using namespace NodeList;
1515
//using namespace Obstacle;
1616

17-
1817
namespace Mapping
1918
{
2019
/****************************************************************************************
@@ -30,8 +29,8 @@ namespace Mapping
3029
#define MAP_X_MAX 3000 // Attention: format paysage
3130
#define MAP_Y_MAX 2000
3231

33-
#define MAP_FILE_TEAM_A "Map2024Jaune.cpp"
34-
#define MAP_FILE_TEAM_B "Map2024Bleue.cpp"
32+
//#define MAP_FILE_TEAM_A "Map2024Jaune.cpp"
33+
//#define MAP_FILE_TEAM_B "Map2024Bleue.cpp"
3534

3635
/****************************************************************************************
3736
* Global Variables
@@ -43,7 +42,7 @@ namespace Mapping
4342
/****************************************************************************************
4443
* Prototypes
4544
****************************************************************************************/
46-
void Initialize_Map(uint8 team);
45+
void Initialize_Map(Team team);
4746

4847
void Set_Adjacent(t_vertexID id1, t_vertexID id2);
4948
void Clear_Adjacent(t_vertexID id1, t_vertexID id2);

include/Structure.h

+4-29
Original file line numberDiff line numberDiff line change
@@ -61,40 +61,15 @@ typedef double float64; // about 16 decimal digits
6161
/****************************************************************************************
6262
* Constantes Génériques
6363
****************************************************************************************/
64-
#define OK 1
65-
#define NOK 0
66-
67-
#define ON 1
68-
#define OFF 0
69-
70-
#define YES 1
71-
#define NO 0
72-
73-
//#define HIGH 1
74-
//#define LOW 0
75-
76-
#define TRUE 1
77-
#define FALSE 0
78-
79-
#define FOREVER 1
80-
81-
#define EXIT_OK 0
82-
83-
#ifndef NULL
84-
#define NULL (0)
85-
#endif
64+
enum class Team {Jaune, Bleue};
65+
enum class Mode {Match, Test};
8666

67+
/*
8768
#define CMD_FREE 0
8869
#define CMD_BUSY 1
8970
#define CMD_DONE 2
9071
#define CMD_FAIL 3
91-
92-
// Team color, A = jaune, B = bleue
93-
#define TEAM_A 0
94-
#define TEAM_B 1
95-
96-
#define MODE_MATCH 0
97-
#define MODE_TEST 1
72+
*/
9873

9974
/****************************************************************************************
10075
* MAPPING

include/pins.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
#define RGB_BRIGHTNESS 64
5353

5454
//******************** Pins IN
55-
#define SWITCH_PIN 14
55+
#define MODE_PIN 14
5656
#define TEAM_PIN 13
5757
#define BAU_PIN 15
5858
#define START_PIN 16

src/Motion.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ void Motion::SetMargin(float margin_mm_or_rad)
110110
****************************************************************************************/
111111
// boolean Motion::Check_Position()
112112
// {
113-
// return ((position.command == true) ? OK : NOK);
113+
// return (position.command == true);
114114
// }
115115

116116
/****************************************************************************************

src/PathPlanning/Mapping.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ t_vertexID end_vertex_ID;
2222
/****************************************************************************************
2323
* Initialize all map with defined segment, circle, vertex and potential false obstacle
2424
****************************************************************************************/
25-
void Initialize_Map(uint8 team)
25+
void Initialize_Map(Team team)
2626
{
27-
if (team == TEAM_A)
27+
if (team == Team::Jaune)
2828
{
2929
//#include MAP_FILE_TEAM_A
3030
// Segment
@@ -48,7 +48,7 @@ void Initialize_Map(uint8 team)
4848
vertex[7].point = Point(2175, 1600);
4949
vertex[8].point = Point(2625, 1750);
5050
}
51-
else if (team == TEAM_B)
51+
else if (team == Team::Bleue)
5252
{
5353
//#include MAP_FILE_TEAM_B
5454
// Segment

src/PathPlanning/NodeList.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ namespace NodeList
6969
{
7070
int i = 0;
7171
int j = 0;
72-
boolean find = FALSE;
72+
boolean find = false;
7373

7474
// si la liste est vide
7575
if (list[0].currentID == INVALID_VERTEX_ID)
@@ -85,14 +85,14 @@ namespace NodeList
8585
{
8686
if (Node::NodeFCmp(list[i], data) > 0)
8787
{
88-
find = TRUE;
88+
find = true;
8989
break;
9090
}
9191
}
9292
else
9393
break;
9494
}
95-
if (find == TRUE)
95+
if (find == true)
9696
{
9797
// on décale toute la liste jusqu'é l'élément trouvé inclus
9898
for (j = LIST_LENGTH - 1; j >= i; j--)

src/PathPlanning/Obstacle.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Circle obstacle[MAX_OBSTACLE];
1313
uint8 obs_cursor = 0;
1414
uint16 obstacleFading[MAX_OBSTACLE];
1515
Circle false_obstacle[MAX_FALSE_OBSTACLE];
16-
boolean obstacle_enable = NO;
16+
boolean obstacle_enable = false;
1717

1818
/****************************************************************************************
1919
* Return the pointer address of obstacle (circle) from obstacle ID
@@ -53,7 +53,7 @@ void Initialize_Obstacle(void)
5353
}
5454

5555
// enable obstacle detection
56-
obstacle_enable = YES;
56+
obstacle_enable = true;
5757
}
5858

5959
/****************************************************************************************
@@ -171,7 +171,7 @@ void Add_Obstacle_Polar(uint8 id)
171171
uint16 distance = 0;
172172
Circle obs;
173173
uint8 i = 0;
174-
boolean newObs = TRUE;
174+
boolean newObs = true;
175175

176176
if (obstacle_enable)
177177
{
@@ -187,7 +187,7 @@ void Add_Obstacle_Polar(uint8 id)
187187
{
188188
if (abs(obstacle[i].p.x - obs.p.x) < 100 && abs(obstacle[i].p.y - obs.p.y) < 100)
189189
{
190-
newObs = FALSE;
190+
newObs = false;
191191
obstacle[i] = obs;
192192
break;
193193
}

src/PathPlanning/PathFinding.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,9 @@ uint32 timeout_pf = 0;
2121
boolean Path_Planning(void)
2222
{
2323
boolean result;
24-
//LED = !LED;
2524
//Update_Obstacles(BRAKE_DISTANCE);
2625
Update_Passability_Graph();
2726
result = Path_Finding();
28-
//LED = OFF;
2927
return result;
3028
}
3129

@@ -89,7 +87,7 @@ boolean Path_Finding()
8987
ListPrint(close , "close");
9088
ListVertexPrint(solution);
9189
#endif
92-
return TRUE;
90+
return true;
9391
}
9492
// on ajoute le noeud évalué à la liste close
9593
ListAddEnd(close, best);
@@ -112,7 +110,7 @@ boolean Path_Finding()
112110
#ifdef SERIAL_PRINT
113111
printf("No solution founded !\n");
114112
#endif
115-
return FALSE;
113+
return false;
116114

117115

118116
}

src/main.cpp

+8-4
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ Robot robot;
1515

1616
OpticalTrackingOdometrySensor otos;
1717

18+
Team team;
19+
Mode mode;
20+
1821
PoseF goTo = {500, 500, 0}; // TODO: pourquoi parfois il démarre en 0;0 ? c'est réinitialisé à 0 par défaut au lieu de ces valeurs ?
1922

20-
bool mode_test = false;
2123

2224
unsigned long startChrono = 0;
2325
unsigned long endChrono = 0;
@@ -44,12 +46,14 @@ void setup()
4446
println("Robot Holonome Firmware");
4547

4648
// Init IHM
47-
pinMode(SWITCH_PIN, INPUT);
49+
pinMode(MODE_PIN, INPUT);
4850
pinMode(TEAM_PIN, INPUT);
4951
pinMode(BAU_PIN, INPUT);
5052
pinMode(START_PIN, INPUT);
5153

52-
mode_test = digitalRead(SWITCH_PIN); // Mode TEST ou OK
54+
// TODO : boucle de lecture dans la loop de démarrage
55+
digitalRead(MODE_PIN) == LOW ? mode = Mode::Match : mode = Mode::Test;
56+
digitalRead(TEAM_PIN) == LOW ? team = Team::Jaune : team = Team::Bleue;
5357

5458
led_builtin.Initialisation(1, RGB_BUILTIN);
5559
//led_ring.Initialisation(36, WS2812_LED);
@@ -78,7 +82,7 @@ void setup()
7882
Trajectory::Initialisation(&linear, &angular, &robot);
7983

8084
// Init Path Planning
81-
Mapping::Initialize_Map(TEAM_A);
85+
Mapping::Initialize_Map(team);
8286
Obstacle::Initialize_Obstacle();
8387
Mapping::Initialize_Passability_Graph();
8488

0 commit comments

Comments
 (0)