Commit a21321f7 authored by Sergi Hernandez's avatar Sergi Hernandez
Browse files

Changes to avoid checking the action state when the action is not active.

parent 0b655d6c
......@@ -665,10 +665,13 @@ template<class action_ros>
void CModuleAction<action_ros>::cancel(void)
{
actionlib::SimpleClientGoalState action_state(actionlib::SimpleClientGoalState::PENDING);
action_state=action_client->getState();
if(action_state==actionlib::SimpleClientGoalState::ACTIVE)
this->action_client->cancelGoal();
if(this->status==ACTION_RUNNING)
{
action_state=action_client->getState();
if(action_state==actionlib::SimpleClientGoalState::ACTIVE)
this->action_client->cancelGoal();
}
}
template<class action_ros>
......@@ -676,9 +679,14 @@ bool CModuleAction<action_ros>::is_finished(void)
{
actionlib::SimpleClientGoalState action_state(actionlib::SimpleClientGoalState::PENDING);
action_state=action_client->getState();
if(action_state==actionlib::SimpleClientGoalState::ACTIVE)
return false;
if(this->status==ACTION_RUNNING)
{
action_state=action_client->getState();
if(action_state==actionlib::SimpleClientGoalState::ACTIVE)
return false;
else
return true;
}
else
return true;
}
......@@ -688,9 +696,9 @@ action_status CModuleAction<action_ros>::get_state(void)
{
actionlib::SimpleClientGoalState action_state(actionlib::SimpleClientGoalState::PENDING);
action_state=action_client->getState();
if(this->status==ACTION_RUNNING)
{
action_state=action_client->getState();
if(this->use_timeout && this->is_timeout_active())
this->status=ACTION_TIMEOUT;
if(this->is_watchdog_active())
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment