diff --git a/software/raspberry/superviseur-robot/nbproject/private/private.xml b/software/raspberry/superviseur-robot/nbproject/private/private.xml
index 87ac888..0ffd21c 100644
--- a/software/raspberry/superviseur-robot/nbproject/private/private.xml
+++ b/software/raspberry/superviseur-robot/nbproject/private/private.xml
@@ -9,7 +9,7 @@
tasks.cpp
- 471
+ 447
diff --git a/software/raspberry/superviseur-robot/tasks.cpp b/software/raspberry/superviseur-robot/tasks.cpp
index ab809fe..431575a 100644
--- a/software/raspberry/superviseur-robot/tasks.cpp
+++ b/software/raspberry/superviseur-robot/tasks.cpp
@@ -76,6 +76,10 @@ void Tasks::Init() {
cerr << "Error mutex create: " << strerror(-err) << endl << flush;
exit(EXIT_FAILURE);
}
+ if (err = rt_mutex_create(&mutex_compteurGestionCom, NULL)) {
+ cerr << "Error mutex create: " << strerror(-err) << endl << flush;
+ exit(EXIT_FAILURE);
+ }
cout << "Mutexes created successfully" << endl << flush;
/**************************************************************************************/
@@ -364,6 +368,7 @@ void Tasks::OpenComRobot(void *arg) {
WriteInQueue(&q_messageToMon, msgSend); // msgSend will be deleted by sendToMon
}
}
+
/**
* @brief Thread starting the communication with the robot.
*/
@@ -399,9 +404,13 @@ void Tasks::StartRobotTask(void *arg) {
if ((MessageID) cpStart == MESSAGE_ROBOT_START_WITH_WD) {
rt_sem_v(&sem_startReloadWD);
}
+ } else {
+ WriteInQueue(&q_messageToMon, new Message(MESSAGE_ANSWER_ACK));
}
+
}
}
+
/**
* @brief Thread managing the Robot's coms
*/
@@ -478,7 +487,9 @@ void Tasks::MoveTask(void *arg) {
msgRcv = robot.Write(new Message((MessageID) cpMove));
rt_mutex_release(&mutex_robot);
if (msgRcv->CompareID(MESSAGE_ANSWER_ACK)) {
+ rt_mutex_acquire(&mutex_compteurGestionCom,TM_INFINITE);
compteur_gestionCom = 0;
+ rt_mutex_release (&mutex_compteurGestionCom);
} else {
compteur_gestionCom += 1;
diff --git a/software/raspberry/superviseur-robot/tasks.h b/software/raspberry/superviseur-robot/tasks.h
index 75bbac3..10f6d3b 100644
--- a/software/raspberry/superviseur-robot/tasks.h
+++ b/software/raspberry/superviseur-robot/tasks.h
@@ -91,6 +91,7 @@ private:
RT_MUTEX mutex_robot;
RT_MUTEX mutex_robotStarted;
RT_MUTEX mutex_move;
+ RT_MUTEX mutex_compteurGestionCom;
/**********************************************************************/
/* Semaphores */