Browse Source

Robot terminé : Tester les fonctionnalités

Leonie Gallois 3 years ago
parent
commit
674485fd95

+ 1
- 1
software/raspberry/superviseur-robot/nbproject/private/configurations.xml View File

41
     </conf>
41
     </conf>
42
     <conf name="Debug__RPI_" type="1">
42
     <conf name="Debug__RPI_" type="1">
43
       <toolsSet>
43
       <toolsSet>
44
-        <developmentServer>pi@10.105.1.7:22</developmentServer>
44
+        <developmentServer>pi@10.105.1.07:22</developmentServer>
45
         <platform>2</platform>
45
         <platform>2</platform>
46
       </toolsSet>
46
       </toolsSet>
47
       <dbx_gdbdebugger version="1">
47
       <dbx_gdbdebugger version="1">

+ 0
- 0
software/raspberry/superviseur-robot/nbproject/private/downloads-10.105.1.07-pi-22 View File


+ 2
- 0
software/raspberry/superviseur-robot/nbproject/private/private.xml View File

7
     <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
7
     <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
8
     <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
8
     <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
9
         <group>
9
         <group>
10
+            <file>file:/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/lib/messages.h</file>
10
             <file>file:/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/tasks.cpp</file>
11
             <file>file:/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/tasks.cpp</file>
11
             <file>file:/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/lib/comrobot.cpp</file>
12
             <file>file:/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/lib/comrobot.cpp</file>
12
             <file>file:/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/tasks.h</file>
13
             <file>file:/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/tasks.h</file>
14
+            <file>file:/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/lib/comrobot.h</file>
13
         </group>
15
         </group>
14
     </open-files>
16
     </open-files>
15
 </project-private>
17
 </project-private>

+ 38
- 0
software/raspberry/superviseur-robot/nbproject/private/timestamps-10.105.1.07-pi-22 View File

1
+#Wed Mar 17 12:14:13 CET 2021
2
+/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/lib/messages.h=c1615800255000
3
+/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/superviseur.doxygen=c1615800255000
4
+/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/nbproject/project.xml=c1615800255000
5
+/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/lib/img.cpp=c1615800255000
6
+/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/lib/.gitignore=c1615800255000
7
+/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/tasks.h=c1615975893000
8
+/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/.gitignore=c1615800255000
9
+/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/lib/commonitor.h=c1615800255000
10
+/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/nbproject/private/Makefile-variables.mk=c1615800255000
11
+/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/.dep.inc=c1615800255000
12
+/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/nbproject/Makefile-impl.mk=c1615800255000
13
+/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/nbproject/Makefile-variables.mk=c1615800255000
14
+/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/lib/comrobot.h=c1615800255000
15
+/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/lib/base64/compile-and-run-test=c1615800255000
16
+VERSION=1.3
17
+/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/lib/base64/test.cpp=c1615800255000
18
+/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/Makefile=c1615800255000
19
+/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/nbproject/Package-Debug__RPI_.bash=c1615800255000
20
+/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/lib/img.h=c1615800255000
21
+/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/lib/base64/base64.h=c1615800255000
22
+/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/tasks.cpp=c1615979649000
23
+/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/nbproject/Package-Debug__PC_.bash=c1615800255000
24
+/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/lib/camera.h=c1615800255000
25
+/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/lib/messages.cpp=c1615800255000
26
+/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/lib/commonitor.cpp=c1615800255000
27
+/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/lib/base64/README.md=c1615800255000
28
+/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/README.md=c1615800255000
29
+/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/lib/base64/LICENSE=c1615800255000
30
+/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/nbproject/Makefile-Debug__PC_.mk=c1615800255000
31
+/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/lib/base64/.gitignore=c1615800255000
32
+/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/main.cpp=c1615800255000
33
+/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/nbproject/Makefile-Debug__RPI_.mk=c1615800255000
34
+/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/gdbsudo.sh=c1615800255000
35
+/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/lib/camera.cpp=c1615800255000
36
+/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/lib/comrobot.cpp=c1615800255000
37
+/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/lib/base64/base64.cpp=c1615800255000
38
+/home/gallois/Documents/insa4/S2/robot/Temps_Reel_Robot/software/raspberry/superviseur-robot/nbproject/project.properties=c1615800255000

+ 64
- 23
software/raspberry/superviseur-robot/tasks.cpp View File

26
 #define PRIORITY_TRECEIVEFROMMON 25
26
 #define PRIORITY_TRECEIVEFROMMON 25
27
 #define PRIORITY_TSTARTROBOT 20
27
 #define PRIORITY_TSTARTROBOT 20
28
 #define PRIORITY_TCAMERA 21
28
 #define PRIORITY_TCAMERA 21
29
-#define PRIORITY_TBATTERY 31
29
+#define PRIORITY_TBATTERY 19
30
+#define PRIORITY_TWATCHDOG 31
30
 
31
 
31
 
32
 
32
 
33
 
101
         cerr << "Error semaphore create: " << strerror(-err) << endl << flush;
102
         cerr << "Error semaphore create: " << strerror(-err) << endl << flush;
102
         exit(EXIT_FAILURE);
103
         exit(EXIT_FAILURE);
103
     }
104
     }
104
-    
105
+    if (err = rt_sem_create(&sem_robotStopped, NULL, 0, S_FIFO)) {
106
+        cerr << "Error semaphore create: " << strerror(-err) << endl << flush;
107
+        exit(EXIT_FAILURE);
108
+    }
105
     cout << "Semaphores created successfully" << endl << flush;
109
     cout << "Semaphores created successfully" << endl << flush;
106
 
110
 
107
     /**************************************************************************************/
111
     /**************************************************************************************/
135
         cerr << "Error task create: " << strerror(-err) << endl << flush;
139
         cerr << "Error task create: " << strerror(-err) << endl << flush;
136
         exit(EXIT_FAILURE);
140
         exit(EXIT_FAILURE);
137
     }
141
     }
142
+    if (err = rt_task_create(&th_watchDog, "th_watchDog", 0, PRIORITY_TWATCHDOG, 0)) {
143
+        cerr << "Error task create: " << strerror(-err) << endl << flush;
144
+        exit(EXIT_FAILURE);
145
+    }
138
     cout << "Tasks created successfully" << endl << flush;
146
     cout << "Tasks created successfully" << endl << flush;
139
 
147
 
140
     /**************************************************************************************/
148
     /**************************************************************************************/
196
         cerr << "Error task start: " << strerror(-err) << endl << flush;
204
         cerr << "Error task start: " << strerror(-err) << endl << flush;
197
         exit(EXIT_FAILURE);
205
         exit(EXIT_FAILURE);
198
     }
206
     }
199
-    
207
+    if (err = rt_task_start(&th_watchDog, (void(*)(void*)) & Tasks::WatchDog, this)) {
208
+        cerr << "Error task start: " << strerror(-err) << endl << flush;
209
+        exit(EXIT_FAILURE);
210
+    }
200
     cout << "Tasks launched" << endl << flush;
211
     cout << "Tasks launched" << endl << flush;
201
 }
212
 }
202
 
213
 
242
         monitor.AcceptClient(); // Wait the monitor client
253
         monitor.AcceptClient(); // Wait the monitor client
243
         cout << "Rock'n'Roll baby, client accepted!" << endl << flush;
254
         cout << "Rock'n'Roll baby, client accepted!" << endl << flush;
244
         rt_sem_broadcast(&sem_serverOk);
255
         rt_sem_broadcast(&sem_serverOk);
245
-        rt_sem_p(&sem_restartServer);
256
+        rt_sem_p(&sem_restartServer, TM_INFINITE);
257
+        rt_mutex_acquire(&mutex_monitor, TM_INFINITE);
258
+        monitor.Close();
259
+        rt_mutex_release(&mutex_monitor);
246
     }
260
     }
247
 
261
 
248
 }
262
 }
260
     /**************************************************************************************/
274
     /**************************************************************************************/
261
     /* The task sendToMon starts here                                                     */
275
     /* The task sendToMon starts here                                                     */
262
     /**************************************************************************************/
276
     /**************************************************************************************/
277
+    
263
     rt_sem_p(&sem_serverOk, TM_INFINITE);
278
     rt_sem_p(&sem_serverOk, TM_INFINITE);
264
 
279
 
265
     while (1) {
280
     while (1) {
295
 
310
 
296
             if (msgRcv->CompareID(MESSAGE_MONITOR_LOST)) {
311
             if (msgRcv->CompareID(MESSAGE_MONITOR_LOST)) {
297
                 delete(msgRcv);
312
                 delete(msgRcv);
298
-                WriteInQueue(&q_messageComRobot, new Message(MESSAGE_ROBOT_COM_CLOSE));
299
                 WriteInQueue(&q_messageControlRobot, new Message(MESSAGE_ROBOT_RESET));
313
                 WriteInQueue(&q_messageControlRobot, new Message(MESSAGE_ROBOT_RESET));
314
+                WriteInQueue(&q_messageComRobot, new Message(MESSAGE_ROBOT_COM_CLOSE));
300
                 WriteInQueue(&q_messageControlCam, new Message(MESSAGE_CAM_CLOSE));
315
                 WriteInQueue(&q_messageControlCam, new Message(MESSAGE_CAM_CLOSE));
301
-                rt_sem_v(&sem_restartServer, TM_INFINITE);  // A VERIFIER
316
+                rt_sem_v(&sem_restartServer);  // A VERIFIER
302
                 break;
317
                 break;
303
 
318
 
304
             } else if (msgRcv->CompareID(MESSAGE_ROBOT_COM_OPEN) || msgRcv->CompareID(MESSAGE_ROBOT_COM_CLOSE)) {
319
             } else if (msgRcv->CompareID(MESSAGE_ROBOT_COM_OPEN) || msgRcv->CompareID(MESSAGE_ROBOT_COM_CLOSE)) {
324
                     msgRcv->CompareID(MESSAGE_CAM_ARENA_CONFIRM) || 
339
                     msgRcv->CompareID(MESSAGE_CAM_ARENA_CONFIRM) || 
325
                     msgRcv->CompareID(MESSAGE_CAM_ARENA_INFIRM) || 
340
                     msgRcv->CompareID(MESSAGE_CAM_ARENA_INFIRM) || 
326
                     msgRcv->CompareID(MESSAGE_CAM_POSITION_COMPUTE_START) || 
341
                     msgRcv->CompareID(MESSAGE_CAM_POSITION_COMPUTE_START) || 
327
-                    msgRcv->CompareID(MESSAGE_CAM_POSITION_COMPUTE_STOP) || 
328
-                    )
342
+                    msgRcv->CompareID(MESSAGE_CAM_POSITION_COMPUTE_STOP))
329
             {
343
             {
330
                 WriteInQueue(&q_messageControlCam, msgRcv);
344
                 WriteInQueue(&q_messageControlCam, msgRcv);
331
             }
345
             }
367
                 msgSend = new Message(MESSAGE_ANSWER_ACK);
381
                 msgSend = new Message(MESSAGE_ANSWER_ACK);
368
             }
382
             }
369
             WriteInQueue(&q_messageToMon, msgSend); // msgSend will be deleted by sendToMon
383
             WriteInQueue(&q_messageToMon, msgSend); // msgSend will be deleted by sendToMon
370
-        }else if(msg->CompareID(MESSAGE_ROBOT_COM_CLOSE)){
384
+        }else if(msg->CompareID(MESSAGE_ROBOT_COM_CLOSE)){ 
385
+            rt_sem_p(&sem_robotStopped, TM_INFINITE);
371
             cout << "Close serial com (";
386
             cout << "Close serial com (";
372
             rt_mutex_acquire(&mutex_robot, TM_INFINITE);
387
             rt_mutex_acquire(&mutex_robot, TM_INFINITE);
373
             status = robot.Close();
388
             status = robot.Close();
383
             }
398
             }
384
             WriteInQueue(&q_messageToMon, msgSend); // msgSend will be deleted by sendToMon
399
             WriteInQueue(&q_messageToMon, msgSend); // msgSend will be deleted by sendToMon
385
         }
400
         }
386
-        delete(msg);
401
+        //delete(msg);
387
         //rt_sem_p(&sem_openComRobot, TM_INFINITE);
402
         //rt_sem_p(&sem_openComRobot, TM_INFINITE);
388
         
403
         
389
     }
404
     }
423
             cout << "Start robot with watchdog (";
438
             cout << "Start robot with watchdog (";
424
             rt_mutex_acquire(&mutex_robot, TM_INFINITE);
439
             rt_mutex_acquire(&mutex_robot, TM_INFINITE);
425
             msgSend = robot.Write(robot.StartWithWD());
440
             msgSend = robot.Write(robot.StartWithWD());
441
+            rt_task_set_periodic(&th_watchDog,TM_NOW,1000000000);
426
             rt_mutex_release(&mutex_robot);
442
             rt_mutex_release(&mutex_robot);
427
             cout << msgSend->GetID();
443
             cout << msgSend->GetID();
428
             cout << ")" << endl;
444
             cout << ")" << endl;
432
                 rt_mutex_acquire(&mutex_robotStarted, TM_INFINITE);
448
                 rt_mutex_acquire(&mutex_robotStarted, TM_INFINITE);
433
                 robotStarted = 1;
449
                 robotStarted = 1;
434
                 rt_mutex_release(&mutex_robotStarted);
450
                 rt_mutex_release(&mutex_robotStarted);
435
-                rt_task_set_periodic(&th_watchDog,TM_NOW,1000000000);
451
+            } else {
452
+                rt_task_set_periodic(&th_watchDog,TM_NOW,0);
436
             }
453
             }
437
             
454
             
438
         } else if (tmp -> CompareID(MESSAGE_ROBOT_RESET)){
455
         } else if (tmp -> CompareID(MESSAGE_ROBOT_RESET)){
439
             rt_task_set_periodic(&th_watchDog,TM_NOW,0);
456
             rt_task_set_periodic(&th_watchDog,TM_NOW,0);
440
             cout << "Stopping Robot (";
457
             cout << "Stopping Robot (";
458
+            rt_mutex_acquire(&mutex_robotStarted, TM_INFINITE);
459
+            robotStarted = 0;
460
+            rt_mutex_release(&mutex_robotStarted);
461
+            rt_task_sleep(100000000);
441
             rt_mutex_acquire(&mutex_robot, TM_INFINITE);
462
             rt_mutex_acquire(&mutex_robot, TM_INFINITE);
442
-            msgSend = robot.Write(new Message(MESSAGE_ROBOT_RESET));
463
+            msgSend = robot.Write(robot.Reset());
443
             rt_mutex_release(&mutex_robot);
464
             rt_mutex_release(&mutex_robot);
465
+            rt_mutex_acquire(&mutex_move, TM_INFINITE);
466
+            move = MESSAGE_ROBOT_STOP;
467
+            rt_mutex_release(&mutex_move);
444
             cout << msgSend->GetID();
468
             cout << msgSend->GetID();
445
             cout << ")" << endl;
469
             cout << ")" << endl;
446
             cout << "Movement answer: " << msgSend->ToString() << endl << flush;
470
             cout << "Movement answer: " << msgSend->ToString() << endl << flush;
447
             WriteInQueue(&q_messageToMon, msgSend);  // msgSend will be deleted by sendToMon
471
             WriteInQueue(&q_messageToMon, msgSend);  // msgSend will be deleted by sendToMon
448
-            rt_mutex_acquire(&mutex_robotStarted, TM_INFINITE);
449
-            robotStarted = 0;
450
-            rt_mutex_release(&mutex_robotStarted);
472
+            
473
+            rt_sem_v(&sem_robotStopped);
451
         } 
474
         } 
452
         
475
         
453
    
476
    
461
     rt_sem_p(&sem_barrier, TM_INFINITE);
484
     rt_sem_p(&sem_barrier, TM_INFINITE);
462
     rt_task_set_periodic(NULL, TM_NOW, 0);
485
     rt_task_set_periodic(NULL, TM_NOW, 0);
463
     while (1) {
486
     while (1) {
487
+        cout << "Realoading" << endl << flush;
464
         rt_task_wait_period(NULL);
488
         rt_task_wait_period(NULL);
465
         Message * msgSend;
489
         Message * msgSend;
466
         rt_mutex_acquire(&mutex_robot, TM_INFINITE);
490
         rt_mutex_acquire(&mutex_robot, TM_INFINITE);
467
         msgSend = robot.ReloadWD();
491
         msgSend = robot.ReloadWD();
492
+        robot.Write(msgSend);
468
         rt_mutex_release(&mutex_robot);
493
         rt_mutex_release(&mutex_robot);
469
     }
494
     }
470
 }
495
 }
476
     int rs;
501
     int rs;
477
     int previousMove = MESSAGE_ROBOT_GO_FORWARD;
502
     int previousMove = MESSAGE_ROBOT_GO_FORWARD;
478
     int cpMove;
503
     int cpMove;
504
+    int nb_error = 0;
479
     
505
     
480
     cout << "Start " << __PRETTY_FUNCTION__ << endl << flush;
506
     cout << "Start " << __PRETTY_FUNCTION__ << endl << flush;
481
     // Synchronization barrier (waiting that all tasks are starting)
507
     // Synchronization barrier (waiting that all tasks are starting)
486
     /**************************************************************************************/
512
     /**************************************************************************************/
487
     rt_task_set_periodic(NULL, TM_NOW, 100000000);
513
     rt_task_set_periodic(NULL, TM_NOW, 100000000);
488
 
514
 
515
+    Message * msgSend;
489
     while (1) {
516
     while (1) {
490
         rt_task_wait_period(NULL);
517
         rt_task_wait_period(NULL);
491
-        cout << "Periodic movement update";
492
         rt_mutex_acquire(&mutex_robotStarted, TM_INFINITE);
518
         rt_mutex_acquire(&mutex_robotStarted, TM_INFINITE);
493
         rs = robotStarted;
519
         rs = robotStarted;
494
         rt_mutex_release(&mutex_robotStarted);
520
         rt_mutex_release(&mutex_robotStarted);
495
         if (rs == 1) {
521
         if (rs == 1) {
522
+            cout << "Periodic movement update";
496
             rt_mutex_acquire(&mutex_move, TM_INFINITE);
523
             rt_mutex_acquire(&mutex_move, TM_INFINITE);
497
             cpMove = move;
524
             cpMove = move;
498
             rt_mutex_release(&mutex_move);
525
             rt_mutex_release(&mutex_move);
499
-            if (cpMove != previousMove) {
526
+            if (cpMove != previousMove || cpMove != MESSAGE_ROBOT_STOP) {
500
                 cout << " move: " << cpMove;
527
                 cout << " move: " << cpMove;
501
 
528
 
502
                 rt_mutex_acquire(&mutex_robot, TM_INFINITE);
529
                 rt_mutex_acquire(&mutex_robot, TM_INFINITE);
503
-                robot.Write(new Message((MessageID)cpMove));
530
+                msgSend = robot.Write(new Message((MessageID)cpMove));
504
                 rt_mutex_release(&mutex_robot);
531
                 rt_mutex_release(&mutex_robot);
505
-                previousMove = cpMove;
532
+                if (msgSend->CompareID(MESSAGE_ANSWER_ACK)) {
533
+                    nb_error = 0;
534
+                    previousMove = cpMove;
535
+                } else {
536
+                    nb_error++;
537
+                }
538
+                if (nb_error > 2) {
539
+                    cout << "ERREUR ROBOT DETECTED";
540
+                    WriteInQueue(&q_messageToMon, new Message(MESSAGE_ANSWER_COM_ERROR)); 
541
+                    rt_mutex_acquire(&mutex_move, TM_INFINITE);
542
+                    move = MESSAGE_ROBOT_STOP;
543
+                    rt_mutex_release(&mutex_move);
544
+                    rt_mutex_acquire(&mutex_robotStarted, TM_INFINITE);
545
+                    robotStarted = 0;
546
+                    rt_mutex_release(&mutex_robotStarted);
547
+                    rt_task_set_periodic(&th_watchDog,TM_NOW,0);
548
+                }
506
             }
549
             }
550
+            cout << endl << flush;
507
         }
551
         }
508
-        cout << endl << flush;
509
     }
552
     }
510
 }
553
 }
511
 
554
 
555
 
598
 
556
     while (1) {
599
     while (1) {
557
         rt_task_wait_period(NULL);
600
         rt_task_wait_period(NULL);
558
-        cout << "Periodic battery get lvl \n";
559
         rt_mutex_acquire(&mutex_robotStarted, TM_INFINITE);
601
         rt_mutex_acquire(&mutex_robotStarted, TM_INFINITE);
560
         rs = robotStarted;
602
         rs = robotStarted;
561
         rt_mutex_release(&mutex_robotStarted);
603
         rt_mutex_release(&mutex_robotStarted);
562
         if (rs == 1) {
604
         if (rs == 1) {
605
+            cout << "Periodic battery get lvl" << endl << flush;
563
             rt_mutex_acquire(&mutex_robot, TM_INFINITE);
606
             rt_mutex_acquire(&mutex_robot, TM_INFINITE);
564
             Message *msg = robot.Write( robot.GetBattery() ) ; 
607
             Message *msg = robot.Write( robot.GetBattery() ) ; 
565
             rt_mutex_release(&mutex_robot);
608
             rt_mutex_release(&mutex_robot);
569
                 rt_mutex_release(&mutex_monitor);
612
                 rt_mutex_release(&mutex_monitor);
570
             }
613
             }
571
         }
614
         }
572
-       
573
-        cout << endl << flush;
574
     }
615
     }
575
 }
616
 }

+ 2
- 1
software/raspberry/superviseur-robot/tasks.h View File

101
     RT_SEM sem_startRobot;
101
     RT_SEM sem_startRobot;
102
     RT_SEM sem_watchdogStart;
102
     RT_SEM sem_watchdogStart;
103
     RT_SEM sem_restartServer;
103
     RT_SEM sem_restartServer;
104
+    RT_SEM sem_robotStopped;
104
     
105
     
105
     
106
     
106
 
107
 
174
      * Sends periodically a message to the robot
175
      * Sends periodically a message to the robot
175
      * @return Nothing
176
      * @return Nothing
176
      */
177
      */
177
-    void Watchdog(void *arg);
178
+    void WatchDog(void *arg);
178
 
179
 
179
 };
180
 };
180
 
181
 

Loading…
Cancel
Save