From cac70c70dfa27e549927e0c66f0ba3d7a5038da9 Mon Sep 17 00:00:00 2001 From: Lacroix Raphael Date: Mon, 3 Apr 2023 15:21:59 +0200 Subject: [PATCH] temp not working --- .../nbproject/configurations.xml | 2 +- .../nbproject/private/configurations.xml | 2 +- .../private/downloads-10.105.1.3-xenomai-22 | 0 .../nbproject/private/private.xml | 9 ++--- .../private/timestamps-10.105.1.3-xenomai-22 | 39 +++++++++++++++++++ .../raspberry/superviseur-robot/tasks.cpp | 20 +++++----- software/raspberry/superviseur-robot/tasks.h | 7 ++++ 7 files changed, 61 insertions(+), 18 deletions(-) create mode 100644 software/raspberry/superviseur-robot/nbproject/private/downloads-10.105.1.3-xenomai-22 create mode 100644 software/raspberry/superviseur-robot/nbproject/private/timestamps-10.105.1.3-xenomai-22 diff --git a/software/raspberry/superviseur-robot/nbproject/configurations.xml b/software/raspberry/superviseur-robot/nbproject/configurations.xml index 48dba36..f78aea7 100644 --- a/software/raspberry/superviseur-robot/nbproject/configurations.xml +++ b/software/raspberry/superviseur-robot/nbproject/configurations.xml @@ -119,7 +119,7 @@ - GNU|GNU + default true false diff --git a/software/raspberry/superviseur-robot/nbproject/private/configurations.xml b/software/raspberry/superviseur-robot/nbproject/private/configurations.xml index 7d18332..a20af05 100644 --- a/software/raspberry/superviseur-robot/nbproject/private/configurations.xml +++ b/software/raspberry/superviseur-robot/nbproject/private/configurations.xml @@ -41,7 +41,7 @@ - xenomai@10.105.1.10:22 + xenomai@10.105.1.3:22 2 diff --git a/software/raspberry/superviseur-robot/nbproject/private/downloads-10.105.1.3-xenomai-22 b/software/raspberry/superviseur-robot/nbproject/private/downloads-10.105.1.3-xenomai-22 new file mode 100644 index 0000000..e69de29 diff --git a/software/raspberry/superviseur-robot/nbproject/private/private.xml b/software/raspberry/superviseur-robot/nbproject/private/private.xml index 307d1c7..d6f1567 100644 --- a/software/raspberry/superviseur-robot/nbproject/private/private.xml +++ b/software/raspberry/superviseur-robot/nbproject/private/private.xml @@ -7,12 +7,9 @@ - file:/home/alejeune/Documents/4ir/S2/dumber/software/raspberry/superviseur-robot/lib/camera.h - file:/home/alejeune/Documents/4ir/S2/dumber/software/raspberry/superviseur-robot/tasks.h - file:/home/alejeune/Documents/4ir/S2/dumber/software/raspberry/superviseur-robot/tasks.cpp - file:/home/alejeune/Documents/4ir/S2/dumber/software/raspberry/superviseur-robot/lib/messages.cpp - file:/home/alejeune/Documents/4ir/S2/dumber/software/raspberry/superviseur-robot/main.cpp - file:/home/alejeune/Documents/4ir/S2/dumber/software/raspberry/superviseur-robot/lib/messages.h + file:/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/tasks.cpp + file:/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/main.cpp + file:/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/tasks.h diff --git a/software/raspberry/superviseur-robot/nbproject/private/timestamps-10.105.1.3-xenomai-22 b/software/raspberry/superviseur-robot/nbproject/private/timestamps-10.105.1.3-xenomai-22 new file mode 100644 index 0000000..5fe6d98 --- /dev/null +++ b/software/raspberry/superviseur-robot/nbproject/private/timestamps-10.105.1.3-xenomai-22 @@ -0,0 +1,39 @@ +#Mon Apr 03 15:16:34 CEST 2023 +/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/lib/messages.cpp=c1680524819149 +/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/lib/camera.cpp=c1680524985794 +/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/tasks.cpp=c1680527791011 +/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/Makefile=c1680524818973 +/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/wrapper.c=c1680524985856 +/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/lib/base64/README.md=c1680524819097 +/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/.gitignore=c1680524818971 +/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/lib/base64/compile-and-run-test=c1680524819108 +/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/nbproject/Makefile-variables.mk=c1680526563389 +/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/superviseur.doxygen=c1680524819223 +/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/nbproject/Package-Debug__PC_.bash=c1680524819176 +/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/nbproject/private/Makefile-variables.mk=c1680524819187 +/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/main.cpp=c1680524819156 +/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/lib/base64/LICENSE=c1680524819095 +/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/lib/base64/base64.cpp=c1680524819101 +/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/.dep.inc=c1680524818965 +/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/nbproject/Makefile-Debug__PC_.mk=c1680524985812 +/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/lib/comrobot.cpp=c1680524985801 +/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/nbproject/project.properties=c1680524819214 +/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/lib/camera.h=c1680524985797 +/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/lib/img.h=c1680524985807 +/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/README.md=c1680524818978 +/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/lib/img.cpp=c1680524985804 +/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/lib/.gitignore=c1680524819087 +/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/lib/base64/.gitignore=c1680524819092 +/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/nbproject/Makefile-Debug__RPI_.mk=c1680526563363 +/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/lib/commonitor.h=c1680524819130 +/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/gdbsudo.sh=c1680524819082 +/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/lib/commonitor.cpp=c1680524819127 +/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/nbproject/Package-Debug__RPI_.bash=c1680526563376 +/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/lib/base64/base64.h=c1680524819103 +/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/lib/base64/test.cpp=c1680524819116 +/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/lib/comrobot.h=c1680524819138 +/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/nbproject/project.xml=c1680524985847 +/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/lib/messages.h=c1680524819153 +VERSION=1.3 +/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/nbproject/Makefile-impl.mk=c1680524819168 +/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/tasks.h=c1680527667578 diff --git a/software/raspberry/superviseur-robot/tasks.cpp b/software/raspberry/superviseur-robot/tasks.cpp index 9811532..5531358 100644 --- a/software/raspberry/superviseur-robot/tasks.cpp +++ b/software/raspberry/superviseur-robot/tasks.cpp @@ -53,14 +53,14 @@ * @brief Initialisation des structures de l'application (tâches, mutex, * semaphore, etc.) */ -void Tasks::robotLossCounter(){ - int status; +void Tasks::RobotLossCounter(void* arg){ + int state; // wait for connexion establishement cout << "Start " << __PRETTY_FUNCTION__ << endl << flush; // Synchronization barrier (waiting that all tasks are starting) rt_sem_p(&sem_barrier, TM_INFINITE); - rt_sem_p(&sem_connexionEstablished); + rt_sem_p(&sem_connexionEstablished, TM_INFINITE); cout << "Starting to monitor packet losses " << endl << flush; rt_task_set_periodic(NULL, TM_NOW, 100*1000*1000); while(1){ @@ -88,7 +88,7 @@ void Tasks::robotLossCounter(){ } -MessageID traitementMessage(MessageID msg){ +MessageID Tasks::parseMessage(MessageID msg){ if (msg == MESSAGE_ANSWER_COM_ERROR){ // increment @@ -102,7 +102,7 @@ MessageID traitementMessage(MessageID msg){ compteurRobotLoss = 0; rt_mutex_release(&mutex_compteurRobotLoss); } - return msg + return msg; } @@ -468,7 +468,7 @@ void Tasks::StartRobotTask(void *arg) { rt_sem_p(&sem_startRobot, TM_INFINITE); cout << "Start robot without watchdog ("; rt_mutex_acquire(&mutex_robot, TM_INFINITE); - msgSend = call(robot.Write(robot.StartWithoutWD())); + msgSend = parseMessage(robot.Write(robot.StartWithoutWD())); // TODO : convert Message MessageID rt_mutex_release(&mutex_robot); cout << msgSend->GetID(); cout << ")" << endl; @@ -503,7 +503,7 @@ void Tasks::StartRobotTask(void *arg) { rt_sem_p(&sem_startRobot, TM_INFINITE); cout << "Start robot without watchdog ("; rt_mutex_acquire(&mutex_robot, TM_INFINITE); - msgSend = call(robot.Write(robot.StartWithWD())); + msgSend = parseMessage(robot.Write(robot.StartWithWD())); // TODO : convert Message MessageID rt_mutex_release(&mutex_robot); cout << msgSend->GetID(); cout << ")" << endl; @@ -536,7 +536,7 @@ void Tasks::RobotReloadMessage(void *arg) { rt_task_set_periodic(NULL, TM_NOW, 500*1000*1000); while(1) { rt_task_wait_period(NULL); - status = (robot.Write(robot.reloadWD())); + status = parseMessage(robot.Write(robot.reloadWD())); // TODO : convert Message MessageID // send info to monitor if (state < 0) { WriteInQueue(&q_messageToMon, new Message(MESSAGE_ANSWER_NACK)); @@ -615,7 +615,7 @@ void Tasks::MoveTask(void *arg) { cout << " move: " << cpMove; rt_mutex_acquire(&mutex_robot, TM_INFINITE); - robot.Write(new Message((MessageID)cpMove)); + parseMessage(robot.Write(new Message((MessageID)cpMove))); rt_mutex_release(&mutex_robot); } rt_mutex_release(&mutex_robotStarted); @@ -644,7 +644,7 @@ void Tasks::BatteryTask(void *arg) { rs = robotStarted; if (rs == 1) { rt_mutex_acquire(&mutex_robot, TM_INFINITE); - Message* batteryReply = robot.Write(robot.GetBattery()); + Message* batteryReply = parseMessage(robot.Write(robot.GetBattery())); // TODO : convert Message MessageID string batteryLevel = batteryReply->ToString(); rt_mutex_release(&mutex_robot); WriteInQueue(&q_messageToMon, batteryReply); diff --git a/software/raspberry/superviseur-robot/tasks.h b/software/raspberry/superviseur-robot/tasks.h index 1dbd069..0533cb5 100644 --- a/software/raspberry/superviseur-robot/tasks.h +++ b/software/raspberry/superviseur-robot/tasks.h @@ -192,6 +192,13 @@ private: */ Message *ReadInQueue(RT_QUEUE *queue); + /** + * Read a message from the robot, returns it while editing the counter of packet losses + * @param Message + * @return Message + */ + MessageID parseMessage(MessageID msg); + }; #endif // __TASKS_H__