temp not working

This commit is contained in:
Lacroix Raphael 2023-04-03 15:21:59 +02:00
parent 6da7c4091b
commit cac70c70df
7 changed files with 61 additions and 18 deletions

View file

@ -119,7 +119,7 @@
</conf> </conf>
<conf name="Debug__RPI_" type="1"> <conf name="Debug__RPI_" type="1">
<toolsSet> <toolsSet>
<compilerSet>GNU|GNU</compilerSet> <compilerSet>default</compilerSet>
<dependencyChecking>true</dependencyChecking> <dependencyChecking>true</dependencyChecking>
<rebuildPropChanged>false</rebuildPropChanged> <rebuildPropChanged>false</rebuildPropChanged>
</toolsSet> </toolsSet>

View file

@ -41,7 +41,7 @@
</conf> </conf>
<conf name="Debug__RPI_" type="1"> <conf name="Debug__RPI_" type="1">
<toolsSet> <toolsSet>
<developmentServer>xenomai@10.105.1.10:22</developmentServer> <developmentServer>xenomai@10.105.1.3:22</developmentServer>
<platform>2</platform> <platform>2</platform>
</toolsSet> </toolsSet>
<dbx_gdbdebugger version="1"> <dbx_gdbdebugger version="1">

View file

@ -7,12 +7,9 @@
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/> <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"> <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group> <group>
<file>file:/home/alejeune/Documents/4ir/S2/dumber/software/raspberry/superviseur-robot/lib/camera.h</file> <file>file:/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/tasks.cpp</file>
<file>file:/home/alejeune/Documents/4ir/S2/dumber/software/raspberry/superviseur-robot/tasks.h</file> <file>file:/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/main.cpp</file>
<file>file:/home/alejeune/Documents/4ir/S2/dumber/software/raspberry/superviseur-robot/tasks.cpp</file> <file>file:/home/rlacroix/Bureau/4ir/Temps-Reel_Lejeune_Robert_Lacroix/software/raspberry/superviseur-robot/tasks.h</file>
<file>file:/home/alejeune/Documents/4ir/S2/dumber/software/raspberry/superviseur-robot/lib/messages.cpp</file>
<file>file:/home/alejeune/Documents/4ir/S2/dumber/software/raspberry/superviseur-robot/main.cpp</file>
<file>file:/home/alejeune/Documents/4ir/S2/dumber/software/raspberry/superviseur-robot/lib/messages.h</file>
</group> </group>
</open-files> </open-files>
</project-private> </project-private>

View file

@ -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

View file

@ -53,14 +53,14 @@
* @brief Initialisation des structures de l'application (tâches, mutex, * @brief Initialisation des structures de l'application (tâches, mutex,
* semaphore, etc.) * semaphore, etc.)
*/ */
void Tasks::robotLossCounter(){ void Tasks::RobotLossCounter(void* arg){
int status; int state;
// wait for connexion establishement // wait for connexion establishement
cout << "Start " << __PRETTY_FUNCTION__ << endl << flush; cout << "Start " << __PRETTY_FUNCTION__ << endl << flush;
// Synchronization barrier (waiting that all tasks are starting) // Synchronization barrier (waiting that all tasks are starting)
rt_sem_p(&sem_barrier, TM_INFINITE); 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; cout << "Starting to monitor packet losses " << endl << flush;
rt_task_set_periodic(NULL, TM_NOW, 100*1000*1000); rt_task_set_periodic(NULL, TM_NOW, 100*1000*1000);
while(1){ while(1){
@ -88,7 +88,7 @@ void Tasks::robotLossCounter(){
} }
MessageID traitementMessage(MessageID msg){ MessageID Tasks::parseMessage(MessageID msg){
if (msg == MESSAGE_ANSWER_COM_ERROR){ if (msg == MESSAGE_ANSWER_COM_ERROR){
// increment // increment
@ -102,7 +102,7 @@ MessageID traitementMessage(MessageID msg){
compteurRobotLoss = 0; compteurRobotLoss = 0;
rt_mutex_release(&mutex_compteurRobotLoss); 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); rt_sem_p(&sem_startRobot, TM_INFINITE);
cout << "Start robot without watchdog ("; cout << "Start robot without watchdog (";
rt_mutex_acquire(&mutex_robot, TM_INFINITE); 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); rt_mutex_release(&mutex_robot);
cout << msgSend->GetID(); cout << msgSend->GetID();
cout << ")" << endl; cout << ")" << endl;
@ -503,7 +503,7 @@ void Tasks::StartRobotTask(void *arg) {
rt_sem_p(&sem_startRobot, TM_INFINITE); rt_sem_p(&sem_startRobot, TM_INFINITE);
cout << "Start robot without watchdog ("; cout << "Start robot without watchdog (";
rt_mutex_acquire(&mutex_robot, TM_INFINITE); 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); rt_mutex_release(&mutex_robot);
cout << msgSend->GetID(); cout << msgSend->GetID();
cout << ")" << endl; cout << ")" << endl;
@ -536,7 +536,7 @@ void Tasks::RobotReloadMessage(void *arg) {
rt_task_set_periodic(NULL, TM_NOW, 500*1000*1000); rt_task_set_periodic(NULL, TM_NOW, 500*1000*1000);
while(1) { while(1) {
rt_task_wait_period(NULL); rt_task_wait_period(NULL);
status = (robot.Write(robot.reloadWD())); status = parseMessage(robot.Write(robot.reloadWD())); // TODO : convert Message MessageID
// send info to monitor // send info to monitor
if (state < 0) { if (state < 0) {
WriteInQueue(&q_messageToMon, new Message(MESSAGE_ANSWER_NACK)); WriteInQueue(&q_messageToMon, new Message(MESSAGE_ANSWER_NACK));
@ -615,7 +615,7 @@ void Tasks::MoveTask(void *arg) {
cout << " move: " << cpMove; cout << " move: " << cpMove;
rt_mutex_acquire(&mutex_robot, TM_INFINITE); 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_robot);
} }
rt_mutex_release(&mutex_robotStarted); rt_mutex_release(&mutex_robotStarted);
@ -644,7 +644,7 @@ void Tasks::BatteryTask(void *arg) {
rs = robotStarted; rs = robotStarted;
if (rs == 1) { if (rs == 1) {
rt_mutex_acquire(&mutex_robot, TM_INFINITE); 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(); string batteryLevel = batteryReply->ToString();
rt_mutex_release(&mutex_robot); rt_mutex_release(&mutex_robot);
WriteInQueue(&q_messageToMon, batteryReply); WriteInQueue(&q_messageToMon, batteryReply);

View file

@ -192,6 +192,13 @@ private:
*/ */
Message *ReadInQueue(RT_QUEUE *queue); 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__ #endif // __TASKS_H__