diff --git a/software/raspberry/superviseur-robot/nbproject/private/configurations.xml b/software/raspberry/superviseur-robot/nbproject/private/configurations.xml index de996c9..6d84df4 100644 --- a/software/raspberry/superviseur-robot/nbproject/private/configurations.xml +++ b/software/raspberry/superviseur-robot/nbproject/private/configurations.xml @@ -41,7 +41,7 @@ - xenomai@10.105.0.144:22 + xenomai@10.105.0.140:22 2 diff --git a/software/raspberry/superviseur-robot/nbproject/private/downloads-10.105.0.140-xenomai-22 b/software/raspberry/superviseur-robot/nbproject/private/downloads-10.105.0.140-xenomai-22 new file mode 100644 index 0000000..e69de29 diff --git a/software/raspberry/superviseur-robot/nbproject/private/timestamps-10.105.0.140-xenomai-22 b/software/raspberry/superviseur-robot/nbproject/private/timestamps-10.105.0.140-xenomai-22 new file mode 100644 index 0000000..053d279 --- /dev/null +++ b/software/raspberry/superviseur-robot/nbproject/private/timestamps-10.105.0.140-xenomai-22 @@ -0,0 +1,39 @@ +#Thu Apr 04 17:02:01 CEST 2024 +/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/main.cpp=c1712238648769 +/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/Makefile-Debug__PC_.mk=c1712238648773 +/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/private/Makefile-variables.mk=c1712238648790 +/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/Makefile=c1712238648634 +/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/comrobot.h=c1712238648755 +/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/messages.h=c1712238648766 +/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/Makefile-Debug__RPI_.mk=c1712238648775 +/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/.gitignore=c1712238648721 +/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/Package-Debug__PC_.bash=c1712238648782 +/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/tasks.h=c1712238648836 +/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/README.md=c1712238648637 +/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/project.xml=c1712238648826 +/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/Makefile-impl.mk=c1712238648778 +/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/superviseur.doxygen=c1712238648829 +/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/base64/README.md=c1712238648730 +/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/tasks.cpp=c1712242917288 +/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/comrobot.cpp=c1712238648753 +/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/.dep.inc=c1712238648629 +/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/img.h=c1712238648760 +/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/camera.h=c1712238648744 +/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/base64/test.cpp=c1712238648739 +/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/img.cpp=c1712238648758 +/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/base64/base64.h=c1712238648735 +/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/base64/compile-and-run-test=c1712238648737 +/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/commonitor.h=c1712238648750 +/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/wrapper.c=c1712238648838 +/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/camera.cpp=c1712238648742 +/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/messages.cpp=c1712238648763 +/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/gdbsudo.sh=c1712238648718 +/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/base64/base64.cpp=c1712238648733 +/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/base64/LICENSE=c1712238648728 +VERSION=1.3 +/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/commonitor.cpp=c1712238648747 +/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/Makefile-variables.mk=c1712238648780 +/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/Package-Debug__RPI_.bash=c1712238648784 +/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/.gitignore=c1712238648632 +/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/nbproject/project.properties=c1712238648823 +/home/marin-muller/Documents/4A/Robot/dumber/software/raspberry/superviseur-robot/lib/base64/.gitignore=c1712238648726 diff --git a/software/raspberry/superviseur-robot/tasks.cpp b/software/raspberry/superviseur-robot/tasks.cpp index 207cbe1..ddfb3f2 100644 --- a/software/raspberry/superviseur-robot/tasks.cpp +++ b/software/raspberry/superviseur-robot/tasks.cpp @@ -25,7 +25,7 @@ #define PRIORITY_TSENDTOMON 22 #define PRIORITY_TRECEIVEFROMMON 25 #define PRIORITY_TSTARTROBOT 20 -#define PRIORITY_TCAMERA 21 +#define PRIORITY_TCAMERA 18 #define PRIORITY_TBATTERY 19 /* @@ -324,7 +324,7 @@ void Tasks::ReceiveFromMonTask(void *arg) { } else if (msgRcv->CompareID(MESSAGE_CAM_OPEN)) { rt_mutex_acquire(&mutex_cameraStatus, TM_INFINITE); - if(cameraStatus != CameraStatusEnum::OPENED) + if(cameraStatus == CameraStatusEnum::CLOSED) cameraStatus = CameraStatusEnum::OPENING; rt_mutex_release(&mutex_cameraStatus); } @@ -522,8 +522,13 @@ void Tasks::OpenCamera(void * arg) // Synchronization barrier (waiting that all tasks are starting) rt_sem_p(&sem_barrier, TM_INFINITE); + + /* The task starts here */ + rt_task_set_periodic(NULL, TM_NOW, 500000000); + while(1) { + rt_task_wait_period(NULL); // Verify that the robot has started rt_mutex_acquire(&mutex_robotStarted, TM_INFINITE); rs = robotStarted; @@ -537,9 +542,14 @@ void Tasks::OpenCamera(void * arg) { rt_mutex_acquire(&mutex_camera, TM_INFINITE); cam = new Camera(sm, 10); + bool is_opened = cam->Open(); rt_mutex_release(&mutex_camera); rt_mutex_acquire(&mutex_cameraStatus, TM_INFINITE); - cameraStatus = CameraStatusEnum::OPENED; + if(is_opened) + { + cameraStatus = CameraStatusEnum::OPENED; + std::cout << "Camera Opened" << std::endl; + } rt_mutex_release(&mutex_cameraStatus); } } @@ -553,9 +563,12 @@ void Tasks::ImageCamera(void * arg) cout << "Start " << __PRETTY_FUNCTION__ << endl << flush; // Synchronization barrier (waiting that all tasks are starting) rt_sem_p(&sem_barrier, TM_INFINITE); + + rt_task_set_periodic(NULL, TM_NOW, 100000000); while(1) { + rt_task_wait_period(NULL); // Check the status of the camera rt_mutex_acquire(&mutex_cameraStatus, TM_INFINITE); cs = cameraStatus;