Restart receiveFromMon doesn't work
This commit is contained in:
parent
e4f00f6816
commit
e912211b00
1 changed files with 26 additions and 22 deletions
|
@ -19,11 +19,11 @@
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
// Déclaration des priorités des taches
|
// Déclaration des priorités des taches
|
||||||
#define PRIORITY_TSERVER 30
|
#define PRIORITY_TSERVER 10
|
||||||
#define PRIORITY_TOPENCOMROBOT 50
|
#define PRIORITY_TOPENCOMROBOT 50
|
||||||
#define PRIORITY_TMOVE 20
|
#define PRIORITY_TMOVE 20
|
||||||
#define PRIORITY_TSENDTOMON 22
|
#define PRIORITY_TSENDTOMON 22
|
||||||
#define PRIORITY_TRECEIVEFROMMON 25
|
#define PRIORITY_TRECEIVEFROMMON 50
|
||||||
#define PRIORITY_TSTARTROBOTWITHOUTWATCHDOG 22
|
#define PRIORITY_TSTARTROBOTWITHOUTWATCHDOG 22
|
||||||
#define PRIORITY_TSTARTROBOTWITHWATCHDOG 22
|
#define PRIORITY_TSTARTROBOTWITHWATCHDOG 22
|
||||||
#define PRIORITY_TCAMERA 21
|
#define PRIORITY_TCAMERA 21
|
||||||
|
@ -366,13 +366,12 @@ void Tasks::ReceiveFromMonTask(void *arg) {
|
||||||
Message *msgRcv;
|
Message *msgRcv;
|
||||||
bool killReceiveFromMonOk=0;
|
bool killReceiveFromMonOk=0;
|
||||||
|
|
||||||
cout << "Start " << __PRETTY_FUNCTION__ << endl << flush;
|
cout << "Start " << __PRETTY_FUNCTION__ << endl << flush;
|
||||||
|
|
||||||
|
|
||||||
|
while(1){
|
||||||
// Synchronization barrier (waiting that all tasks are starting)
|
// Synchronization barrier (waiting that all tasks are starting)
|
||||||
rt_sem_p(&sem_barrier, TM_INFINITE);
|
rt_sem_p(&sem_barrier, TM_INFINITE);
|
||||||
|
|
||||||
while(1){
|
|
||||||
//rt_sem_p(&sem_restart,TM_INFINITE);
|
//rt_sem_p(&sem_restart,TM_INFINITE);
|
||||||
|
|
||||||
//Reinitialize control boolean
|
//Reinitialize control boolean
|
||||||
|
@ -393,7 +392,6 @@ void Tasks::ReceiveFromMonTask(void *arg) {
|
||||||
if (msgRcv->CompareID(MESSAGE_MONITOR_LOST)) {
|
if (msgRcv->CompareID(MESSAGE_MONITOR_LOST)) {
|
||||||
delete(msgRcv);
|
delete(msgRcv);
|
||||||
cout << "Connection to monitor lost" << endl;
|
cout << "Connection to monitor lost" << endl;
|
||||||
monitor.Close();
|
|
||||||
|
|
||||||
rt_mutex_acquire(&mutex_killReceiveFromMon, TM_INFINITE);
|
rt_mutex_acquire(&mutex_killReceiveFromMon, TM_INFINITE);
|
||||||
killReceiveFromMon=1;
|
killReceiveFromMon=1;
|
||||||
|
@ -421,6 +419,17 @@ void Tasks::ReceiveFromMonTask(void *arg) {
|
||||||
acquireImage=0;
|
acquireImage=0;
|
||||||
rt_mutex_release(&mutex_acquireImage);
|
rt_mutex_release(&mutex_acquireImage);
|
||||||
|
|
||||||
|
sleep(1);
|
||||||
|
|
||||||
|
monitor.Close();
|
||||||
|
robot.Close();
|
||||||
|
|
||||||
|
//Tasks::Join();
|
||||||
|
|
||||||
|
cout << "End sleep" << endl << flush;
|
||||||
|
rt_sem_broadcast(&sem_barrier);
|
||||||
|
cout << "Mes couilles" << endl << flush;
|
||||||
|
|
||||||
//exit(-1);
|
//exit(-1);
|
||||||
|
|
||||||
|
|
||||||
|
@ -509,7 +518,7 @@ void Tasks::ReceiveFromMonTask(void *arg) {
|
||||||
|
|
||||||
//Update loop condition
|
//Update loop condition
|
||||||
|
|
||||||
//cout << "J'arrive la" << endl << flush;
|
cout << "J'arrive la" << endl << flush;
|
||||||
|
|
||||||
rt_mutex_acquire(&mutex_killReceiveFromMon, TM_INFINITE);
|
rt_mutex_acquire(&mutex_killReceiveFromMon, TM_INFINITE);
|
||||||
killReceiveFromMonOk = killReceiveFromMon;
|
killReceiveFromMonOk = killReceiveFromMon;
|
||||||
|
@ -518,19 +527,14 @@ void Tasks::ReceiveFromMonTask(void *arg) {
|
||||||
cout << "Kill Receive From Mon Ok = " << killReceiveFromMonOk << endl << flush;
|
cout << "Kill Receive From Mon Ok = " << killReceiveFromMonOk << endl << flush;
|
||||||
}
|
}
|
||||||
|
|
||||||
monitor.Close();
|
|
||||||
robot.Close();
|
|
||||||
|
|
||||||
cout << "ReceiveFromMon dies" << endl << flush;
|
cout << "ReceiveFromMon dies" << endl << flush;
|
||||||
//Restart all the process
|
|
||||||
Tasks::Join();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Thread opening communication with the robot.
|
* @brief Thread opening communication with the robot.
|
||||||
*/
|
*/
|
||||||
void Tasks::OpenComRobot(void *arg) {
|
void Tasks::OpenComRobot(void *arg) { //PAS DE SOUCIS AU REDEMARAGE
|
||||||
int status;
|
int status;
|
||||||
int err;
|
int err;
|
||||||
//bool killOpenComRobotOk = 0;
|
//bool killOpenComRobotOk = 0;
|
||||||
|
@ -543,7 +547,6 @@ void Tasks::OpenComRobot(void *arg) {
|
||||||
/* The task openComRobot starts here */
|
/* The task openComRobot starts here */
|
||||||
/**************************************************************************************/
|
/**************************************************************************************/
|
||||||
while (1) {
|
while (1) {
|
||||||
|
|
||||||
rt_sem_p(&sem_openComRobot, TM_INFINITE);
|
rt_sem_p(&sem_openComRobot, TM_INFINITE);
|
||||||
cout << "Open serial com (";
|
cout << "Open serial com (";
|
||||||
rt_mutex_acquire(&mutex_robot, TM_INFINITE);
|
rt_mutex_acquire(&mutex_robot, TM_INFINITE);
|
||||||
|
@ -758,12 +761,12 @@ void Tasks::DetectLostSupRob(void *arg){
|
||||||
if(cpt==3){
|
if(cpt==3){
|
||||||
//Trigger Kill of DetectLostSupRob
|
//Trigger Kill of DetectLostSupRob
|
||||||
rt_mutex_acquire(&mutex_killDetectLostSupRob, TM_INFINITE);
|
rt_mutex_acquire(&mutex_killDetectLostSupRob, TM_INFINITE);
|
||||||
killDetectLostSupRob=0;
|
killDetectLostSupRob=1;
|
||||||
rt_mutex_release(&mutex_killDetectLostSupRob);
|
rt_mutex_release(&mutex_killDetectLostSupRob);
|
||||||
|
|
||||||
//Trigger Kill of the Battery acquisition
|
//Trigger Kill of the Battery acquisition
|
||||||
rt_mutex_acquire(&mutex_killBattery, TM_INFINITE);
|
rt_mutex_acquire(&mutex_killBattery, TM_INFINITE);
|
||||||
killBattery=0;
|
killBattery=1;
|
||||||
rt_mutex_release(&mutex_killBattery);
|
rt_mutex_release(&mutex_killBattery);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -777,6 +780,7 @@ void Tasks::DetectLostSupRob(void *arg){
|
||||||
kill_detectLostSupRobOk=killDetectLostSupRob;
|
kill_detectLostSupRobOk=killDetectLostSupRob;
|
||||||
rt_mutex_release(&mutex_killDetectLostSupRob);
|
rt_mutex_release(&mutex_killDetectLostSupRob);
|
||||||
}
|
}
|
||||||
|
cout << "DetectLostSupRob dies";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue