Restart detectLostSupMon ok but ping doesn't work after restart
This commit is contained in:
parent
153fc3a049
commit
e479fec3eb
1 changed files with 50 additions and 42 deletions
|
@ -731,16 +731,21 @@ void Tasks::DetectLostSupRob(void *arg){
|
||||||
bool kill_detectLostSupRobOk=0;
|
bool kill_detectLostSupRobOk=0;
|
||||||
Message* msgSend;
|
Message* msgSend;
|
||||||
|
|
||||||
|
//Period = 1s
|
||||||
|
rt_task_set_periodic(NULL, TM_NOW, 1000000000);
|
||||||
|
|
||||||
|
while(1){
|
||||||
|
|
||||||
//Wait the Communication with the Robot to be Set
|
//Wait the Communication with the Robot to be Set
|
||||||
rt_sem_p(&sem_detectLostSupRob, TM_INFINITE);
|
rt_sem_p(&sem_detectLostSupRob, TM_INFINITE);
|
||||||
|
cout << "Start DetectLostSupRob" << endl << flush;
|
||||||
|
|
||||||
|
kill_detectLostSupRobOk = 0;
|
||||||
//Initialize the variable for the loop condition
|
//Initialize the variable for the loop condition
|
||||||
rt_mutex_acquire(&mutex_killDetectLostSupRob, TM_INFINITE);
|
rt_mutex_acquire(&mutex_killDetectLostSupRob, TM_INFINITE);
|
||||||
killDetectLostSupRob = 0;
|
killDetectLostSupRob = 0;
|
||||||
rt_mutex_release(&mutex_killDetectLostSupRob);
|
rt_mutex_release(&mutex_killDetectLostSupRob);
|
||||||
|
|
||||||
//Period = 1s
|
|
||||||
rt_task_set_periodic(NULL, TM_NOW, 1000000000);
|
|
||||||
|
|
||||||
while(!kill_detectLostSupRobOk){
|
while(!kill_detectLostSupRobOk){
|
||||||
rt_task_wait_period(NULL);
|
rt_task_wait_period(NULL);
|
||||||
|
@ -749,6 +754,8 @@ void Tasks::DetectLostSupRob(void *arg){
|
||||||
rt_mutex_acquire(&mutex_robot, TM_INFINITE);
|
rt_mutex_acquire(&mutex_robot, TM_INFINITE);
|
||||||
msgSend = robot.Write(robot.Ping());
|
msgSend = robot.Write(robot.Ping());
|
||||||
rt_mutex_release(&mutex_robot);
|
rt_mutex_release(&mutex_robot);
|
||||||
|
cout << "J'écris un message" << endl << flush;
|
||||||
|
|
||||||
|
|
||||||
if(msgSend->GetID() == MESSAGE_ANSWER_COM_ERROR || msgSend->GetID() == MESSAGE_ANSWER_ROBOT_TIMEOUT){
|
if(msgSend->GetID() == MESSAGE_ANSWER_COM_ERROR || msgSend->GetID() == MESSAGE_ANSWER_ROBOT_TIMEOUT){
|
||||||
|
|
||||||
|
@ -779,6 +786,7 @@ void Tasks::DetectLostSupRob(void *arg){
|
||||||
}
|
}
|
||||||
cout << "DetectLostSupRob dies";
|
cout << "DetectLostSupRob dies";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write a message in a given queue
|
* Write a message in a given queue
|
||||||
|
|
Loading…
Reference in a new issue