Robot doesn't wait for client 2
This commit is contained in:
parent
2805103953
commit
9e5c6003fc
1 changed files with 19 additions and 15 deletions
|
@ -423,12 +423,6 @@ void Tasks::ReceiveFromMonTask(void *arg) {
|
|||
//Wait every task to die
|
||||
sleep(1);
|
||||
|
||||
//All closes
|
||||
rt_mutex_acquire(&mutex_monitor, TM_INFINITE);
|
||||
monitor.Close();
|
||||
rt_mutex_release(&mutex_monitor);
|
||||
|
||||
|
||||
rt_mutex_acquire(&mutex_robot, TM_INFINITE);
|
||||
status=robot.Close();
|
||||
rt_mutex_release(&mutex_robot);
|
||||
|
@ -440,14 +434,13 @@ void Tasks::ReceiveFromMonTask(void *arg) {
|
|||
cout << "Close Robot Success" << endl << flush;
|
||||
}
|
||||
|
||||
//Tasks::Join();
|
||||
//All closes
|
||||
rt_mutex_acquire(&mutex_monitor, TM_INFINITE);
|
||||
monitor.Close();
|
||||
rt_mutex_release(&mutex_monitor);
|
||||
|
||||
//Release restarted tasks
|
||||
// cout << "End sleep" << endl << flush;
|
||||
rt_sem_broadcast(&sem_barrier);
|
||||
// cout << "Mes couilles" << endl << flush;
|
||||
|
||||
//exit(-1);
|
||||
|
||||
|
||||
} else if (msgRcv->CompareID(MESSAGE_CAM_OPEN)) {
|
||||
|
@ -761,8 +754,11 @@ void Tasks::DetectLostSupRob(void *arg){
|
|||
rt_sem_p(&sem_detectLostSupRob, TM_INFINITE);
|
||||
cout << "Start DetectLostSupRob" << endl << flush;
|
||||
|
||||
kill_detectLostSupRobOk = 0;
|
||||
//Initialize counter to detect loss
|
||||
cpt = 0;
|
||||
|
||||
//Initialize the variable for the loop condition
|
||||
kill_detectLostSupRobOk = 0;
|
||||
rt_mutex_acquire(&mutex_killDetectLostSupRob, TM_INFINITE);
|
||||
killDetectLostSupRob = 0;
|
||||
rt_mutex_release(&mutex_killDetectLostSupRob);
|
||||
|
@ -784,16 +780,24 @@ void Tasks::DetectLostSupRob(void *arg){
|
|||
cpt++;
|
||||
|
||||
if(cpt==3){
|
||||
|
||||
//acknowledge loss communication with robot
|
||||
//WriteInQueue(&q_messageToMon, new Message(MESSAGE_MONITOR_LOST));
|
||||
|
||||
cout << "Restart Communication with Robot" << endl << flush;
|
||||
//Trigger Kill of DetectLostSupRob
|
||||
rt_mutex_acquire(&mutex_killDetectLostSupRob, TM_INFINITE);
|
||||
killDetectLostSupRob=1;
|
||||
rt_mutex_release(&mutex_killDetectLostSupRob);
|
||||
|
||||
//Trigger Kill of the Battery acquisition
|
||||
//Trigger Kill of the Battery acquisition and therefore Robot with or without WD
|
||||
rt_mutex_acquire(&mutex_killBattery, TM_INFINITE);
|
||||
killBattery=1;
|
||||
rt_mutex_release(&mutex_killBattery);
|
||||
|
||||
rt_sem_v(&sem_openComRobot);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue