Browse Source

Merge superviseur/robot depuis la branche dev

Sébastien DI MERCURIO 5 years ago
parent
commit
491fae55d5

+ 1
- 0
software/raspberry/superviseur-robot/README.md View File

1
+# TP-RT_C

+ 6
- 0
software/raspberry/superviseur-robot/lib/.gitignore View File

1
+CMakeFiles/
2
+
3
+libdestjil.a
4
+Makefile
5
+*.cmake
6
+

+ 0
- 7
software/raspberry/superviseur-robot/lib/camera.cpp View File

22
 using namespace cv;
22
 using namespace cv;
23
 
23
 
24
 /**
24
 /**
25
- * Create an object for accessing camera with default values (size = sm and 
26
- * fps = 10)
27
- */
28
-Camera::Camera():Camera(sm, 10){
29
-}
30
-
31
-/**
32
  * Create an object for accessing camera
25
  * Create an object for accessing camera
33
  * @param size Size of picture to grab (@see captureSize)
26
  * @param size Size of picture to grab (@see captureSize)
34
  * @param fps speed of sampling
27
  * @param fps speed of sampling

+ 0
- 7
software/raspberry/superviseur-robot/lib/camera.h View File

35
  * Class for camera (image grab)
35
  * Class for camera (image grab)
36
  * 
36
  * 
37
  * @brief Class for camera (image grab)
37
  * @brief Class for camera (image grab)
38
- * How to grab an image and send it to the monitor:
39
- *  1. Grab an image, for example:
40
- *          Img * img = new Img(cam->Grab());
41
- *  2. Instanciate the message to send the image:
42
- *          MessageImg *msgImg = new MessageImg(MESSAGE_CAM_IMAGE, img);
43
  */
38
  */
44
 class Camera {
39
 class Camera {
45
 public:
40
 public:
46
-    Camera();
47
-    
48
     /**
41
     /**
49
      * Create an object for accessing camera
42
      * Create an object for accessing camera
50
      * @param size Size of picture to grab (@see captureSize)
43
      * @param size Size of picture to grab (@see captureSize)

+ 5
- 7
software/raspberry/superviseur-robot/lib/messages.cpp View File

131
 }
131
 }
132
 
132
 
133
 /**
133
 /**
134
- * Check message ID
134
+ * Get message ID
135
  * @return Current message ID
135
  * @return Current message ID
136
  */
136
  */
137
 bool Message::CheckID(MessageID id) {
137
 bool Message::CheckID(MessageID id) {
162
  */
162
  */
163
 MessageInt::MessageInt(MessageID id, int val) {
163
 MessageInt::MessageInt(MessageID id, int val) {
164
     MessageInt::SetID(id);
164
     MessageInt::SetID(id);
165
+
165
     value = val;
166
     value = val;
166
 }
167
 }
167
 
168
 
281
  * Create a new, empty image message
282
  * Create a new, empty image message
282
  */
283
  */
283
 MessageImg::MessageImg() {
284
 MessageImg::MessageImg() {
284
-    this->messageID = MESSAGE_CAM_IMAGE;
285
     image = NULL;
285
     image = NULL;
286
 }
286
 }
287
 
287
 
362
  * Create a new, empty battery message
362
  * Create a new, empty battery message
363
  */
363
  */
364
 MessageBattery::MessageBattery() {
364
 MessageBattery::MessageBattery() {
365
-    this->messageID = MESSAGE_ROBOT_BATTERY_LEVEL;
366
     this->level = BATTERY_UNKNOWN;
365
     this->level = BATTERY_UNKNOWN;
367
 }
366
 }
368
 
367
 
456
 /* class MessagePosition */
455
 /* class MessagePosition */
457
 
456
 
458
 /**
457
 /**
459
- * Create a new, empty position message
458
+ * Create a new, empty string message
460
  */
459
  */
461
 MessagePosition::MessagePosition() {
460
 MessagePosition::MessagePosition() {
462
-    this->messageID = MESSAGE_CAM_POSITION;
463
     this->pos.angle = 0.0;
461
     this->pos.angle = 0.0;
464
     this->pos.robotId = 0;
462
     this->pos.robotId = 0;
465
     this->pos.center.x=0.0;
463
     this->pos.center.x=0.0;
469
 }
467
 }
470
 
468
 
471
 /**
469
 /**
472
- * Create a new position message, with given ID and position
470
+ * Create a new string message, with given ID and string
473
  * @param id Message ID
471
  * @param id Message ID
474
- * @param pos Message position
472
+ * @param s Message string
475
  * @throw std::runtime_error if message ID is incompatible with string data
473
  * @throw std::runtime_error if message ID is incompatible with string data
476
  */
474
  */
477
 MessagePosition::MessagePosition(MessageID id, Position& pos) {
475
 MessagePosition::MessagePosition(MessageID id, Position& pos) {

+ 2
- 11
software/raspberry/superviseur-robot/lib/messages.h View File

47
     MESSAGE_ROBOT_COM_OPEN,
47
     MESSAGE_ROBOT_COM_OPEN,
48
     MESSAGE_ROBOT_COM_CLOSE,
48
     MESSAGE_ROBOT_COM_CLOSE,
49
          
49
          
50
-    // Messages for camera from Monitor to Supervisor
50
+    // Messages for camera   
51
     MESSAGE_CAM_OPEN,
51
     MESSAGE_CAM_OPEN,
52
     MESSAGE_CAM_CLOSE,
52
     MESSAGE_CAM_CLOSE,
53
     MESSAGE_CAM_ASK_ARENA,
53
     MESSAGE_CAM_ASK_ARENA,
55
     MESSAGE_CAM_ARENA_INFIRM,
55
     MESSAGE_CAM_ARENA_INFIRM,
56
     MESSAGE_CAM_POSITION_COMPUTE_START,
56
     MESSAGE_CAM_POSITION_COMPUTE_START,
57
     MESSAGE_CAM_POSITION_COMPUTE_STOP,
57
     MESSAGE_CAM_POSITION_COMPUTE_STOP,
58
-            
59
-    // Messages for camera from Supervisor to Monitor 
60
     MESSAGE_CAM_POSITION,
58
     MESSAGE_CAM_POSITION,
61
     MESSAGE_CAM_IMAGE,
59
     MESSAGE_CAM_IMAGE,
62
             
60
             
501
  * Message class for holding battery level, based on Message class
499
  * Message class for holding battery level, based on Message class
502
  * 
500
  * 
503
  * @brief Battery message class
501
  * @brief Battery message class
504
- * How to use:
505
- *  1. Ask the battery level to the robot:
506
- *      MessageBattery * msg;
507
- *      msg = (MessageBattery*)robot.Write(new Message(MESSAGE_ROBOT_BATTERY_GET));
508
- *  2. Send the message, for example:
509
- *          monitor.send(msg);
510
- *      or
511
- *          WriteInQueue(&q_messageToMon, msg);
502
+ * 
512
  */
503
  */
513
 class MessageBattery : public Message {
504
 class MessageBattery : public Message {
514
 public:
505
 public:

+ 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.08:22</developmentServer>
44
+        <developmentServer>pi@10.105.1.13:22</developmentServer>
45
         <platform>2</platform>
45
         <platform>2</platform>
46
       </toolsSet>
46
       </toolsSet>
47
       <dbx_gdbdebugger version="1">
47
       <dbx_gdbdebugger version="1">

+ 3
- 3
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_pers/pehladik/dumber/software/raspberry/superviseur-robot/lib/camera.h</file>
11
-            <file>file:/home_pers/pehladik/dumber/software/raspberry/superviseur-robot/lib/messages.cpp</file>
10
+            <file>file:/home_pers/pehladik/dumber/software/raspberry/superviseur-robot/main.cpp</file>
12
             <file>file:/home_pers/pehladik/dumber/software/raspberry/superviseur-robot/tasks.h</file>
11
             <file>file:/home_pers/pehladik/dumber/software/raspberry/superviseur-robot/tasks.h</file>
13
-            <file>file:/home_pers/pehladik/dumber/software/raspberry/superviseur-robot/lib/camera.cpp</file>
14
             <file>file:/home_pers/pehladik/dumber/software/raspberry/superviseur-robot/tasks.cpp</file>
12
             <file>file:/home_pers/pehladik/dumber/software/raspberry/superviseur-robot/tasks.cpp</file>
13
+            <file>file:/home_pers/pehladik/dumber/software/raspberry/superviseur-robot/lib/comrobot.h</file>
15
             <file>file:/home_pers/pehladik/dumber/software/raspberry/superviseur-robot/lib/messages.h</file>
14
             <file>file:/home_pers/pehladik/dumber/software/raspberry/superviseur-robot/lib/messages.h</file>
15
+            <file>file:/home_pers/pehladik/dumber/software/raspberry/superviseur-robot/lib/commonitor.h</file>
16
         </group>
16
         </group>
17
     </open-files>
17
     </open-files>
18
 </project-private>
18
 </project-private>

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

64
     /**********************************************************************/
64
     /**********************************************************************/
65
     ComMonitor monitor;
65
     ComMonitor monitor;
66
     ComRobot robot;
66
     ComRobot robot;
67
-    int robotStarted = 0;
67
+    int robotStarted;
68
     int move = MESSAGE_ROBOT_STOP;
68
     int move = MESSAGE_ROBOT_STOP;
69
     
69
     
70
     /**********************************************************************/
70
     /**********************************************************************/

Loading…
Cancel
Save