Re-merge depuis la branche dev du repertoire software/raspberry/superviseur-robot qui n'etait pas à jour
This commit is contained in:
parent
491fae55d5
commit
e44af5cddc
7 changed files with 37 additions and 12 deletions
|
@ -21,6 +21,13 @@
|
||||||
|
|
||||||
using namespace cv;
|
using namespace cv;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an object for accessing camera with default values (size = sm and
|
||||||
|
* fps = 10)
|
||||||
|
*/
|
||||||
|
Camera::Camera():Camera(sm, 10){
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an object for accessing camera
|
* Create an object for accessing camera
|
||||||
* @param size Size of picture to grab (@see captureSize)
|
* @param size Size of picture to grab (@see captureSize)
|
||||||
|
|
|
@ -35,9 +35,16 @@ enum captureSize {xs, sm, md, lg};
|
||||||
* Class for camera (image grab)
|
* Class for camera (image grab)
|
||||||
*
|
*
|
||||||
* @brief Class for camera (image grab)
|
* @brief Class for camera (image grab)
|
||||||
|
* How to grab an image and send it to the monitor:
|
||||||
|
* 1. Grab an image, for example:
|
||||||
|
* Img * img = new Img(cam->Grab());
|
||||||
|
* 2. Instanciate the message to send the image:
|
||||||
|
* MessageImg *msgImg = new MessageImg(MESSAGE_CAM_IMAGE, img);
|
||||||
*/
|
*/
|
||||||
class Camera {
|
class Camera {
|
||||||
public:
|
public:
|
||||||
|
Camera();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an object for accessing camera
|
* Create an object for accessing camera
|
||||||
* @param size Size of picture to grab (@see captureSize)
|
* @param size Size of picture to grab (@see captureSize)
|
||||||
|
|
|
@ -131,7 +131,7 @@ Message* Message::Copy() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get message ID
|
* Check message ID
|
||||||
* @return Current message ID
|
* @return Current message ID
|
||||||
*/
|
*/
|
||||||
bool Message::CheckID(MessageID id) {
|
bool Message::CheckID(MessageID id) {
|
||||||
|
@ -162,7 +162,6 @@ MessageInt::MessageInt() {
|
||||||
*/
|
*/
|
||||||
MessageInt::MessageInt(MessageID id, int val) {
|
MessageInt::MessageInt(MessageID id, int val) {
|
||||||
MessageInt::SetID(id);
|
MessageInt::SetID(id);
|
||||||
|
|
||||||
value = val;
|
value = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,6 +281,7 @@ bool MessageString::CheckID(MessageID id) {
|
||||||
* Create a new, empty image message
|
* Create a new, empty image message
|
||||||
*/
|
*/
|
||||||
MessageImg::MessageImg() {
|
MessageImg::MessageImg() {
|
||||||
|
this->messageID = MESSAGE_CAM_IMAGE;
|
||||||
image = NULL;
|
image = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -362,6 +362,7 @@ bool MessageImg::CheckID(MessageID id) {
|
||||||
* Create a new, empty battery message
|
* Create a new, empty battery message
|
||||||
*/
|
*/
|
||||||
MessageBattery::MessageBattery() {
|
MessageBattery::MessageBattery() {
|
||||||
|
this->messageID = MESSAGE_ROBOT_BATTERY_LEVEL;
|
||||||
this->level = BATTERY_UNKNOWN;
|
this->level = BATTERY_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -455,9 +456,10 @@ bool MessageBattery::CheckID(MessageID id) {
|
||||||
/* class MessagePosition */
|
/* class MessagePosition */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new, empty string message
|
* Create a new, empty position message
|
||||||
*/
|
*/
|
||||||
MessagePosition::MessagePosition() {
|
MessagePosition::MessagePosition() {
|
||||||
|
this->messageID = MESSAGE_CAM_POSITION;
|
||||||
this->pos.angle = 0.0;
|
this->pos.angle = 0.0;
|
||||||
this->pos.robotId = 0;
|
this->pos.robotId = 0;
|
||||||
this->pos.center.x=0.0;
|
this->pos.center.x=0.0;
|
||||||
|
@ -467,9 +469,9 @@ MessagePosition::MessagePosition() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new string message, with given ID and string
|
* Create a new position message, with given ID and position
|
||||||
* @param id Message ID
|
* @param id Message ID
|
||||||
* @param s Message string
|
* @param pos Message position
|
||||||
* @throw std::runtime_error if message ID is incompatible with string data
|
* @throw std::runtime_error if message ID is incompatible with string data
|
||||||
*/
|
*/
|
||||||
MessagePosition::MessagePosition(MessageID id, Position& pos) {
|
MessagePosition::MessagePosition(MessageID id, Position& pos) {
|
||||||
|
|
|
@ -47,7 +47,7 @@ typedef enum {
|
||||||
MESSAGE_ROBOT_COM_OPEN,
|
MESSAGE_ROBOT_COM_OPEN,
|
||||||
MESSAGE_ROBOT_COM_CLOSE,
|
MESSAGE_ROBOT_COM_CLOSE,
|
||||||
|
|
||||||
// Messages for camera
|
// Messages for camera from Monitor to Supervisor
|
||||||
MESSAGE_CAM_OPEN,
|
MESSAGE_CAM_OPEN,
|
||||||
MESSAGE_CAM_CLOSE,
|
MESSAGE_CAM_CLOSE,
|
||||||
MESSAGE_CAM_ASK_ARENA,
|
MESSAGE_CAM_ASK_ARENA,
|
||||||
|
@ -55,6 +55,8 @@ typedef enum {
|
||||||
MESSAGE_CAM_ARENA_INFIRM,
|
MESSAGE_CAM_ARENA_INFIRM,
|
||||||
MESSAGE_CAM_POSITION_COMPUTE_START,
|
MESSAGE_CAM_POSITION_COMPUTE_START,
|
||||||
MESSAGE_CAM_POSITION_COMPUTE_STOP,
|
MESSAGE_CAM_POSITION_COMPUTE_STOP,
|
||||||
|
|
||||||
|
// Messages for camera from Supervisor to Monitor
|
||||||
MESSAGE_CAM_POSITION,
|
MESSAGE_CAM_POSITION,
|
||||||
MESSAGE_CAM_IMAGE,
|
MESSAGE_CAM_IMAGE,
|
||||||
|
|
||||||
|
@ -499,7 +501,14 @@ protected:
|
||||||
* Message class for holding battery level, based on Message class
|
* Message class for holding battery level, based on Message class
|
||||||
*
|
*
|
||||||
* @brief Battery message class
|
* @brief Battery message class
|
||||||
*
|
* How to use:
|
||||||
|
* 1. Ask the battery level to the robot:
|
||||||
|
* MessageBattery * msg;
|
||||||
|
* msg = (MessageBattery*)robot.Write(new Message(MESSAGE_ROBOT_BATTERY_GET));
|
||||||
|
* 2. Send the message, for example:
|
||||||
|
* monitor.send(msg);
|
||||||
|
* or
|
||||||
|
* WriteInQueue(&q_messageToMon, msg);
|
||||||
*/
|
*/
|
||||||
class MessageBattery : public Message {
|
class MessageBattery : public Message {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
</conf>
|
</conf>
|
||||||
<conf name="Debug__RPI_" type="1">
|
<conf name="Debug__RPI_" type="1">
|
||||||
<toolsSet>
|
<toolsSet>
|
||||||
<developmentServer>pi@10.105.1.13:22</developmentServer>
|
<developmentServer>pi@10.105.1.08:22</developmentServer>
|
||||||
<platform>2</platform>
|
<platform>2</platform>
|
||||||
</toolsSet>
|
</toolsSet>
|
||||||
<dbx_gdbdebugger version="1">
|
<dbx_gdbdebugger version="1">
|
||||||
|
|
|
@ -7,12 +7,12 @@
|
||||||
<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_pers/pehladik/dumber/software/raspberry/superviseur-robot/main.cpp</file>
|
<file>file:/home_pers/pehladik/dumber/software/raspberry/superviseur-robot/lib/camera.h</file>
|
||||||
|
<file>file:/home_pers/pehladik/dumber/software/raspberry/superviseur-robot/lib/messages.cpp</file>
|
||||||
<file>file:/home_pers/pehladik/dumber/software/raspberry/superviseur-robot/tasks.h</file>
|
<file>file:/home_pers/pehladik/dumber/software/raspberry/superviseur-robot/tasks.h</file>
|
||||||
|
<file>file:/home_pers/pehladik/dumber/software/raspberry/superviseur-robot/lib/camera.cpp</file>
|
||||||
<file>file:/home_pers/pehladik/dumber/software/raspberry/superviseur-robot/tasks.cpp</file>
|
<file>file:/home_pers/pehladik/dumber/software/raspberry/superviseur-robot/tasks.cpp</file>
|
||||||
<file>file:/home_pers/pehladik/dumber/software/raspberry/superviseur-robot/lib/comrobot.h</file>
|
|
||||||
<file>file:/home_pers/pehladik/dumber/software/raspberry/superviseur-robot/lib/messages.h</file>
|
<file>file:/home_pers/pehladik/dumber/software/raspberry/superviseur-robot/lib/messages.h</file>
|
||||||
<file>file:/home_pers/pehladik/dumber/software/raspberry/superviseur-robot/lib/commonitor.h</file>
|
|
||||||
</group>
|
</group>
|
||||||
</open-files>
|
</open-files>
|
||||||
</project-private>
|
</project-private>
|
||||||
|
|
|
@ -64,7 +64,7 @@ private:
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
ComMonitor monitor;
|
ComMonitor monitor;
|
||||||
ComRobot robot;
|
ComRobot robot;
|
||||||
int robotStarted;
|
int robotStarted = 0;
|
||||||
int move = MESSAGE_ROBOT_STOP;
|
int move = MESSAGE_ROBOT_STOP;
|
||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
|
|
Loading…
Reference in a new issue