robot whitout WD perfect + (with WD and vision not ok)

This commit is contained in:
Raphael Benistant 2020-03-31 15:39:09 +02:00
parent fc10a54aae
commit 4208c91f0e
3 changed files with 49 additions and 40 deletions

View file

@ -9,10 +9,6 @@
<group> <group>
<file>file:/home/raphael/Documents/real_time/software/raspberry/superviseur-robot/tasks.cpp</file> <file>file:/home/raphael/Documents/real_time/software/raspberry/superviseur-robot/tasks.cpp</file>
<file>file:/home/raphael/Documents/real_time/software/raspberry/superviseur-robot/tasks.h</file> <file>file:/home/raphael/Documents/real_time/software/raspberry/superviseur-robot/tasks.h</file>
<file>file:/home/raphael/Documents/real_time/software/raspberry/superviseur-robot/main.cpp</file>
<file>file:/home/raphael/Documents/real_time/software/raspberry/superviseur-robot/lib/comrobot.h</file>
<file>file:/home/raphael/Documents/real_time/software/raspberry/superviseur-robot/lib/commonitor.cpp</file>
<file>file:/home/raphael/Documents/real_time/software/raspberry/superviseur-robot/lib/comrobot.cpp</file>
<file>file:/home/raphael/Documents/real_time/software/raspberry/superviseur-robot/lib/messages.h</file> <file>file:/home/raphael/Documents/real_time/software/raspberry/superviseur-robot/lib/messages.h</file>
</group> </group>
</open-files> </open-files>

View file

@ -429,6 +429,10 @@ void Tasks::ReceiveFromMonTask(void *arg) {
acquireImage=0; acquireImage=0;
rt_mutex_release(&mutex_acquireImage); rt_mutex_release(&mutex_acquireImage);
rt_mutex_acquire(&mutex_robotStarted, TM_INFINITE);
robotStarted=0;
rt_mutex_release(&mutex_robotStarted);
//Wait every task to die //Wait every task to die
sleep(1); sleep(1);
@ -603,14 +607,16 @@ void Tasks::OpenComRobot(void *arg) { //PAS DE SOUCIS AU REDEMARAGE
* @brief Thread starting the communication with the robot. * @brief Thread starting the communication with the robot.
*/ */
void Tasks::StartRobotTaskWithoutWatchdog(void *arg) { void Tasks::StartRobotTaskWithoutWatchdog(void *arg) {
cout << "Start " << __PRETTY_FUNCTION__ << endl << flush;
// Synchronization barrier (waiting that all tasks are starting)
rt_sem_p(&sem_barrier, TM_INFINITE);
int killBatteryOk=0; int killBatteryOk=0;
Message * msgSend; Message * msgSend;
/**************************************************************************************/ /**************************************************************************************/
/* The task startRobot starts here */ /* The task startRobot starts here */
/**************************************************************************************/ /**************************************************************************************/
while(1){
cout << "Start " << __PRETTY_FUNCTION__ << endl << flush;
// Synchronization barrier (waiting that all tasks are starting)
rt_sem_p(&sem_barrier, TM_INFINITE);
//Boolean to get the battery //Boolean to get the battery
rt_mutex_acquire(&mutex_killBattery, TM_INFINITE); rt_mutex_acquire(&mutex_killBattery, TM_INFINITE);
killBatteryOk=0; killBatteryOk=0;
@ -639,6 +645,7 @@ void Tasks::StartRobotTaskWithoutWatchdog(void *arg) {
} }
} }
} }
}
/** /**
@ -647,18 +654,22 @@ void Tasks::StartRobotTaskWithoutWatchdog(void *arg) {
* @brief Thread starting the communication with the robot. * @brief Thread starting the communication with the robot.
*/ */
void Tasks::StartRobotTaskWithWatchdog(void *arg) { void Tasks::StartRobotTaskWithWatchdog(void *arg) {
cout << "Start " << __PRETTY_FUNCTION__ << endl << flush;
// Synchronization barrier (waiting that all tasks are starting)
rt_sem_p(&sem_barrier, TM_INFINITE);
int killBatteryOk=0; int killBatteryOk=0;
int cpt=1; int cpt=1;
Message * msgSend; Message * msgSend;
/**************************************************************************************/
/* The task startRobot starts here */
/**************************************************************************************/
int err; int err;
while(1){ while(1){
cout << "Start " << __PRETTY_FUNCTION__ << endl << flush;
// Synchronization barrier (waiting that all tasks are starting)
rt_sem_p(&sem_barrier, TM_INFINITE);
/**************************************************************************************/
/* The task startRobot starts here */
/**************************************************************************************/
//Boolean to get the battery //Boolean to get the battery
rt_mutex_acquire(&mutex_killBattery, TM_INFINITE); rt_mutex_acquire(&mutex_killBattery, TM_INFINITE);
killBattery=0; killBattery=0;
@ -795,6 +806,10 @@ void Tasks::DetectLostSupRob(void *arg){
killBattery=1; killBattery=1;
rt_mutex_release(&mutex_killBattery); rt_mutex_release(&mutex_killBattery);
rt_mutex_acquire(&mutex_robotStarted, TM_INFINITE);
robotStarted=0;
rt_mutex_release(&mutex_robotStarted);
rt_sem_v(&sem_openComRobot); rt_sem_v(&sem_openComRobot);

View file

@ -6,8 +6,6 @@
</data> </data>
<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/raphael/Documents/real_time/software/simulateur/main.cpp</file>
</group>
</open-files> </open-files>
</project-private> </project-private>