update lib
This commit is contained in:
parent
4934190959
commit
cc84086479
7 changed files with 37 additions and 12 deletions
|
@ -21,6 +21,13 @@
|
|||
|
||||
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
|
||||
* @param size Size of picture to grab (@see captureSize)
|
||||
|
|
|
@ -35,9 +35,16 @@ enum captureSize {xs, sm, md, lg};
|
|||
* 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 {
|
||||
public:
|
||||
Camera();
|
||||
|
||||
/**
|
||||
* Create an object for accessing camera
|
||||
* @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
|
||||
*/
|
||||
bool Message::CheckID(MessageID id) {
|
||||
|
@ -162,7 +162,6 @@ MessageInt::MessageInt() {
|
|||
*/
|
||||
MessageInt::MessageInt(MessageID id, int val) {
|
||||
MessageInt::SetID(id);
|
||||
|
||||
value = val;
|
||||
}
|
||||
|
||||
|
@ -282,6 +281,7 @@ bool MessageString::CheckID(MessageID id) {
|
|||
* Create a new, empty image message
|
||||
*/
|
||||
MessageImg::MessageImg() {
|
||||
this->messageID = MESSAGE_CAM_IMAGE;
|
||||
image = NULL;
|
||||
}
|
||||
|
||||
|
@ -362,6 +362,7 @@ bool MessageImg::CheckID(MessageID id) {
|
|||
* Create a new, empty battery message
|
||||
*/
|
||||
MessageBattery::MessageBattery() {
|
||||
this->messageID = MESSAGE_ROBOT_BATTERY_LEVEL;
|
||||
this->level = BATTERY_UNKNOWN;
|
||||
}
|
||||
|
||||
|
@ -455,9 +456,10 @@ bool MessageBattery::CheckID(MessageID id) {
|
|||
/* class MessagePosition */
|
||||
|
||||
/**
|
||||
* Create a new, empty string message
|
||||
* Create a new, empty position message
|
||||
*/
|
||||
MessagePosition::MessagePosition() {
|
||||
this->messageID = MESSAGE_CAM_POSITION;
|
||||
this->pos.angle = 0.0;
|
||||
this->pos.robotId = 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 s Message string
|
||||
* @param pos Message position
|
||||
* @throw std::runtime_error if message ID is incompatible with string data
|
||||
*/
|
||||
MessagePosition::MessagePosition(MessageID id, Position& pos) {
|
||||
|
|
|
@ -47,7 +47,7 @@ typedef enum {
|
|||
MESSAGE_ROBOT_COM_OPEN,
|
||||
MESSAGE_ROBOT_COM_CLOSE,
|
||||
|
||||
// Messages for camera
|
||||
// Messages for camera from Monitor to Supervisor
|
||||
MESSAGE_CAM_OPEN,
|
||||
MESSAGE_CAM_CLOSE,
|
||||
MESSAGE_CAM_ASK_ARENA,
|
||||
|
@ -55,6 +55,8 @@ typedef enum {
|
|||
MESSAGE_CAM_ARENA_INFIRM,
|
||||
MESSAGE_CAM_POSITION_COMPUTE_START,
|
||||
MESSAGE_CAM_POSITION_COMPUTE_STOP,
|
||||
|
||||
// Messages for camera from Supervisor to Monitor
|
||||
MESSAGE_CAM_POSITION,
|
||||
MESSAGE_CAM_IMAGE,
|
||||
|
||||
|
@ -499,7 +501,14 @@ protected:
|
|||
* Message class for holding battery level, based on 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 {
|
||||
public:
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
</conf>
|
||||
<conf name="Debug__RPI_" type="1">
|
||||
<toolsSet>
|
||||
<developmentServer>pi@10.105.1.13:22</developmentServer>
|
||||
<developmentServer>pi@10.105.1.08:22</developmentServer>
|
||||
<platform>2</platform>
|
||||
</toolsSet>
|
||||
<dbx_gdbdebugger version="1">
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
<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">
|
||||
<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/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/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/commonitor.h</file>
|
||||
</group>
|
||||
</open-files>
|
||||
</project-private>
|
||||
|
|
|
@ -64,7 +64,7 @@ private:
|
|||
/**********************************************************************/
|
||||
ComMonitor monitor;
|
||||
ComRobot robot;
|
||||
int robotStarted;
|
||||
int robotStarted = 0;
|
||||
int move = MESSAGE_ROBOT_STOP;
|
||||
|
||||
/**********************************************************************/
|
||||
|
|
Loading…
Reference in a new issue