Robot doesn't wait for client

This commit is contained in:
Raphael Benistant 2020-03-29 13:41:13 +02:00
parent cffd879ccb
commit 2805103953
3 changed files with 25 additions and 5 deletions

View file

@ -6,6 +6,13 @@
</data>
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group/>
<group>
<file>file:/home/raphael/Documents/real_time/software/raspberry/superviseur-robot/tasks.cpp</file>
<file>file:/home/raphael/Documents/real_time/software/raspberry/superviseur-robot/lib/comrobot.cpp</file>
<file>file:/home/raphael/Documents/real_time/software/raspberry/superviseur-robot/lib/commonitor.cpp</file>
<file>file:/home/raphael/Documents/real_time/software/raspberry/superviseur-robot/tasks.h</file>
<file>file:/home/raphael/Documents/real_time/software/raspberry/superviseur-robot/main.cpp</file>
<file>file:/home/raphael/Documents/real_time/software/raspberry/superviseur-robot/lib/comrobot.h</file>
</group>
</open-files>
</project-private>

View file

@ -365,6 +365,7 @@ void Tasks::SendToMonTask(void* arg) {
void Tasks::ReceiveFromMonTask(void *arg) {
Message *msgRcv;
bool killReceiveFromMonOk=0;
int status;
cout << "Start " << __PRETTY_FUNCTION__ << endl << flush;
@ -429,8 +430,15 @@ void Tasks::ReceiveFromMonTask(void *arg) {
rt_mutex_acquire(&mutex_robot, TM_INFINITE);
robot.Close();
status=robot.Close();
rt_mutex_release(&mutex_robot);
if(status<0){
cout << "Close Robot Fail" << endl << flush;
}
else{
cout << "Close Robot Success" << endl << flush;
}
//Tasks::Join();
@ -462,6 +470,13 @@ void Tasks::ReceiveFromMonTask(void *arg) {
cout << "Command Open Communication with Robot Received" << endl << flush;
rt_sem_v(&sem_openComRobot);
} else if (msgRcv->CompareID(MESSAGE_ROBOT_COM_CLOSE)) {
cout << "Command Close Communication with Robot Received" << endl << flush;
rt_mutex_acquire(&mutex_robot, TM_INFINITE);
status=robot.Close();
rt_mutex_release(&mutex_robot);
} else if (msgRcv->CompareID(MESSAGE_ROBOT_START_WITHOUT_WD)) {
cout << "Command Start Robot without Watchdog Received" << endl << flush;

View file

@ -6,8 +6,6 @@
</data>
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group>
<file>file:/home/etud/dumber/software/simulateur/main.cpp</file>
</group>
<group/>
</open-files>
</project-private>