diff --git a/software/raspberry/superviseur-robot/README.md b/software/raspberry/superviseur-robot/README.md new file mode 100644 index 0000000..53e95d7 --- /dev/null +++ b/software/raspberry/superviseur-robot/README.md @@ -0,0 +1 @@ +# TP-RT_C diff --git a/software/raspberry/superviseur-robot/lib/.gitignore b/software/raspberry/superviseur-robot/lib/.gitignore new file mode 100644 index 0000000..25793f0 --- /dev/null +++ b/software/raspberry/superviseur-robot/lib/.gitignore @@ -0,0 +1,6 @@ +CMakeFiles/ + +libdestjil.a +Makefile +*.cmake + diff --git a/software/raspberry/superviseur-robot/lib/camera.cpp b/software/raspberry/superviseur-robot/lib/camera.cpp index 95a9854..2742ec3 100644 --- a/software/raspberry/superviseur-robot/lib/camera.cpp +++ b/software/raspberry/superviseur-robot/lib/camera.cpp @@ -21,13 +21,6 @@ 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) diff --git a/software/raspberry/superviseur-robot/lib/camera.h b/software/raspberry/superviseur-robot/lib/camera.h index f59e6b3..1d06f9f 100644 --- a/software/raspberry/superviseur-robot/lib/camera.h +++ b/software/raspberry/superviseur-robot/lib/camera.h @@ -35,16 +35,9 @@ 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) diff --git a/software/raspberry/superviseur-robot/lib/messages.cpp b/software/raspberry/superviseur-robot/lib/messages.cpp index 61acfa4..2a07824 100644 --- a/software/raspberry/superviseur-robot/lib/messages.cpp +++ b/software/raspberry/superviseur-robot/lib/messages.cpp @@ -131,7 +131,7 @@ Message* Message::Copy() { } /** - * Check message ID + * Get message ID * @return Current message ID */ bool Message::CheckID(MessageID id) { @@ -162,6 +162,7 @@ MessageInt::MessageInt() { */ MessageInt::MessageInt(MessageID id, int val) { MessageInt::SetID(id); + value = val; } @@ -281,7 +282,6 @@ bool MessageString::CheckID(MessageID id) { * Create a new, empty image message */ MessageImg::MessageImg() { - this->messageID = MESSAGE_CAM_IMAGE; image = NULL; } @@ -362,7 +362,6 @@ bool MessageImg::CheckID(MessageID id) { * Create a new, empty battery message */ MessageBattery::MessageBattery() { - this->messageID = MESSAGE_ROBOT_BATTERY_LEVEL; this->level = BATTERY_UNKNOWN; } @@ -456,10 +455,9 @@ bool MessageBattery::CheckID(MessageID id) { /* class MessagePosition */ /** - * Create a new, empty position message + * Create a new, empty string message */ MessagePosition::MessagePosition() { - this->messageID = MESSAGE_CAM_POSITION; this->pos.angle = 0.0; this->pos.robotId = 0; this->pos.center.x=0.0; @@ -469,9 +467,9 @@ MessagePosition::MessagePosition() { } /** - * Create a new position message, with given ID and position + * Create a new string message, with given ID and string * @param id Message ID - * @param pos Message position + * @param s Message string * @throw std::runtime_error if message ID is incompatible with string data */ MessagePosition::MessagePosition(MessageID id, Position& pos) { diff --git a/software/raspberry/superviseur-robot/lib/messages.h b/software/raspberry/superviseur-robot/lib/messages.h index adbd1b1..d64919a 100644 --- a/software/raspberry/superviseur-robot/lib/messages.h +++ b/software/raspberry/superviseur-robot/lib/messages.h @@ -47,7 +47,7 @@ typedef enum { MESSAGE_ROBOT_COM_OPEN, MESSAGE_ROBOT_COM_CLOSE, - // Messages for camera from Monitor to Supervisor + // Messages for camera MESSAGE_CAM_OPEN, MESSAGE_CAM_CLOSE, MESSAGE_CAM_ASK_ARENA, @@ -55,8 +55,6 @@ 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, @@ -501,14 +499,7 @@ 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: diff --git a/software/raspberry/superviseur-robot/nbproject/private/configurations.xml b/software/raspberry/superviseur-robot/nbproject/private/configurations.xml index 6eedf50..5cb1c88 100644 --- a/software/raspberry/superviseur-robot/nbproject/private/configurations.xml +++ b/software/raspberry/superviseur-robot/nbproject/private/configurations.xml @@ -41,7 +41,7 @@ - pi@10.105.1.08:22 + pi@10.105.1.13:22 2 diff --git a/software/raspberry/superviseur-robot/nbproject/private/private.xml b/software/raspberry/superviseur-robot/nbproject/private/private.xml index 40175b4..7505be8 100644 --- a/software/raspberry/superviseur-robot/nbproject/private/private.xml +++ b/software/raspberry/superviseur-robot/nbproject/private/private.xml @@ -7,12 +7,12 @@ - file:/home_pers/pehladik/dumber/software/raspberry/superviseur-robot/lib/camera.h - file:/home_pers/pehladik/dumber/software/raspberry/superviseur-robot/lib/messages.cpp + file:/home_pers/pehladik/dumber/software/raspberry/superviseur-robot/main.cpp file:/home_pers/pehladik/dumber/software/raspberry/superviseur-robot/tasks.h - file:/home_pers/pehladik/dumber/software/raspberry/superviseur-robot/lib/camera.cpp file:/home_pers/pehladik/dumber/software/raspberry/superviseur-robot/tasks.cpp + file:/home_pers/pehladik/dumber/software/raspberry/superviseur-robot/lib/comrobot.h file:/home_pers/pehladik/dumber/software/raspberry/superviseur-robot/lib/messages.h + file:/home_pers/pehladik/dumber/software/raspberry/superviseur-robot/lib/commonitor.h diff --git a/software/raspberry/superviseur-robot/tasks.h b/software/raspberry/superviseur-robot/tasks.h index 27fe329..9a2578e 100644 --- a/software/raspberry/superviseur-robot/tasks.h +++ b/software/raspberry/superviseur-robot/tasks.h @@ -64,7 +64,7 @@ private: /**********************************************************************/ ComMonitor monitor; ComRobot robot; - int robotStarted = 0; + int robotStarted; int move = MESSAGE_ROBOT_STOP; /**********************************************************************/