Compare commits
No commits in common. "9f2bbe5bdfffba4848f42de34a9b735da4be611a" and "c2c23e912cf19f445c071a34c4b7cea32fdb724a" have entirely different histories.
9f2bbe5bdf
...
c2c23e912c
2 changed files with 4 additions and 20 deletions
|
|
@ -98,10 +98,6 @@ void Tasks::Init() {
|
|||
cerr << "Error semaphore create sem_startRobot: " << strerror(-err) << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if ((err = rt_sem_create(&sem_stopRobot, nullptr, 0, S_FIFO))) {
|
||||
cerr << "Error semaphore create sem_stopRobot: " << strerror(-err) << endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
cout << "Semaphores created successfully" << endl;
|
||||
|
||||
/* *************************************************************************************
|
||||
|
|
@ -404,7 +400,6 @@ void Tasks::ReceiveFromMonTask(void *arg) {
|
|||
[[noreturn]] void Tasks::MoveTask(void *arg) {
|
||||
int rs;
|
||||
int cpMove;
|
||||
int counter = 0;
|
||||
|
||||
cout << "Start " << __PRETTY_FUNCTION__ << endl;
|
||||
// Synchronization barrier (waiting that all tasks are starting)
|
||||
|
|
@ -417,7 +412,7 @@ void Tasks::ReceiveFromMonTask(void *arg) {
|
|||
|
||||
while (true) {
|
||||
rt_task_wait_period(nullptr);
|
||||
cout << "Periodic movement update" << endl;
|
||||
cout << "Periodic movement update";
|
||||
rt_mutex_acquire(&mutex_robotStarted, TM_INFINITE);
|
||||
rs = robotStarted;
|
||||
rt_mutex_release(&mutex_robotStarted);
|
||||
|
|
@ -426,23 +421,13 @@ void Tasks::ReceiveFromMonTask(void *arg) {
|
|||
cpMove = move;
|
||||
rt_mutex_release(&mutex_move);
|
||||
|
||||
cout << "move: " << cpMove << endl;
|
||||
cout << " move: " << cpMove;
|
||||
|
||||
rt_mutex_acquire(&mutex_robot, TM_INFINITE);
|
||||
auto msgSend = robot.Write(new Message((MessageID) cpMove));
|
||||
if (msgSend->CompareID(MESSAGE_ANSWER_ACK)) {
|
||||
counter = 0;
|
||||
} else {
|
||||
counter ++;
|
||||
}
|
||||
if (counter == 3) {
|
||||
rt_sem_v(&sem_stopRobot);
|
||||
rt_mutex_acquire(&mutex_monitor, TM_INFINITE);
|
||||
monitor.Write(new Message(MESSAGE_ANSWER_COM_ERROR));
|
||||
rt_mutex_release(&mutex_monitor);
|
||||
}
|
||||
robot.Write(new Message((MessageID) cpMove));
|
||||
rt_mutex_release(&mutex_robot);
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -91,7 +91,6 @@ private:
|
|||
RT_SEM sem_openComRobot;
|
||||
RT_SEM sem_serverOk;
|
||||
RT_SEM sem_startRobot;
|
||||
RT_SEM sem_stopRobot;
|
||||
|
||||
/* *********************************************************************
|
||||
* Message queues
|
||||
|
|
|
|||
Loading…
Reference in a new issue