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>
|
||||
|
||||
// Déclaration des priorités des taches
|
||||
#define PRIORITY_TSERVER 30
|
||||
#define PRIORITY_TSERVER 10
|
||||
#define PRIORITY_TOPENCOMROBOT 50
|
||||
#define PRIORITY_TMOVE 20
|
||||
#define PRIORITY_TSENDTOMON 22
|
||||
#define PRIORITY_TRECEIVEFROMMON 25
|
||||
#define PRIORITY_TRECEIVEFROMMON 50
|
||||
#define PRIORITY_TSTARTROBOTWITHOUTWATCHDOG 22
|
||||
#define PRIORITY_TSTARTROBOTWITHWATCHDOG 22
|
||||
#define PRIORITY_TCAMERA 21
|
||||
|
@ -366,15 +366,14 @@ void Tasks::ReceiveFromMonTask(void *arg) {
|
|||
Message *msgRcv;
|
||||
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)
|
||||
rt_sem_p(&sem_barrier, TM_INFINITE);
|
||||
|
||||
while(1){
|
||||
|
||||
//rt_sem_p(&sem_restart,TM_INFINITE);
|
||||
|
||||
|
||||
//Reinitialize control boolean
|
||||
rt_mutex_acquire(&mutex_killReceiveFromMon, TM_INFINITE);
|
||||
killReceiveFromMon=0;
|
||||
|
@ -393,7 +392,6 @@ void Tasks::ReceiveFromMonTask(void *arg) {
|
|||
if (msgRcv->CompareID(MESSAGE_MONITOR_LOST)) {
|
||||
delete(msgRcv);
|
||||
cout << "Connection to monitor lost" << endl;
|
||||
monitor.Close();
|
||||
|
||||
rt_mutex_acquire(&mutex_killReceiveFromMon, TM_INFINITE);
|
||||
killReceiveFromMon=1;
|
||||
|
@ -421,6 +419,17 @@ void Tasks::ReceiveFromMonTask(void *arg) {
|
|||
acquireImage=0;
|
||||
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);
|
||||
|
||||
|
||||
|
@ -508,29 +517,24 @@ void Tasks::ReceiveFromMonTask(void *arg) {
|
|||
delete(msgRcv); // must be deleted manually, no consumer
|
||||
|
||||
//Update loop condition
|
||||
|
||||
//cout << "J'arrive la" << endl << flush;
|
||||
|
||||
|
||||
cout << "J'arrive la" << endl << flush;
|
||||
|
||||
rt_mutex_acquire(&mutex_killReceiveFromMon, TM_INFINITE);
|
||||
killReceiveFromMonOk = killReceiveFromMon;
|
||||
rt_mutex_release(&mutex_killReceiveFromMon);
|
||||
|
||||
|
||||
cout << "Kill Receive From Mon Ok = " << killReceiveFromMonOk << endl << flush;
|
||||
}
|
||||
|
||||
monitor.Close();
|
||||
robot.Close();
|
||||
|
||||
|
||||
cout << "ReceiveFromMon dies" << endl << flush;
|
||||
//Restart all the process
|
||||
Tasks::Join();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 err;
|
||||
//bool killOpenComRobotOk = 0;
|
||||
|
@ -543,7 +547,6 @@ void Tasks::OpenComRobot(void *arg) {
|
|||
/* The task openComRobot starts here */
|
||||
/**************************************************************************************/
|
||||
while (1) {
|
||||
|
||||
rt_sem_p(&sem_openComRobot, TM_INFINITE);
|
||||
cout << "Open serial com (";
|
||||
rt_mutex_acquire(&mutex_robot, TM_INFINITE);
|
||||
|
@ -758,12 +761,12 @@ void Tasks::DetectLostSupRob(void *arg){
|
|||
if(cpt==3){
|
||||
//Trigger Kill of DetectLostSupRob
|
||||
rt_mutex_acquire(&mutex_killDetectLostSupRob, TM_INFINITE);
|
||||
killDetectLostSupRob=0;
|
||||
killDetectLostSupRob=1;
|
||||
rt_mutex_release(&mutex_killDetectLostSupRob);
|
||||
|
||||
//Trigger Kill of the Battery acquisition
|
||||
rt_mutex_acquire(&mutex_killBattery, TM_INFINITE);
|
||||
killBattery=0;
|
||||
killBattery=1;
|
||||
rt_mutex_release(&mutex_killBattery);
|
||||
|
||||
}
|
||||
|
@ -777,6 +780,7 @@ void Tasks::DetectLostSupRob(void *arg){
|
|||
kill_detectLostSupRobOk=killDetectLostSupRob;
|
||||
rt_mutex_release(&mutex_killDetectLostSupRob);
|
||||
}
|
||||
cout << "DetectLostSupRob dies";
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue