Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unnecessary check of isActive in Maneuvers/Maneuver consumes #170

Open
krisgry opened this issue Mar 18, 2019 · 0 comments
Open

Unnecessary check of isActive in Maneuvers/Maneuver consumes #170

krisgry opened this issue Mar 18, 2019 · 0 comments

Comments

@krisgry
Copy link
Contributor

krisgry commented Mar 18, 2019

Hi,
Did some digging in the Maneuvers/Maneuver, and found that bind is defined such that the consume function is only called if the task is active:

bind(T* task_obj, bool always = false)
{
if (always)
{
Task::bind<M>(task_obj);
}
else
{
void (Maneuver::* func)(const M*) = &Maneuver::consumeIfActive<M, T>;
Task::bind<M>(this, func);
}
}

Then I discovered that the consume functions of PathControlState and StopManeuver still check if the task is active:

Maneuver::consume(const IMC::PathControlState* pcs)
{
if (!isActive())
return;

and
Maneuver::consume(const IMC::StopManeuver* sm)
{
(void)sm;
if (isActive())
{
requestDeactivation();
IMC::ManeuverControlState mcs;
mcs.state = IMC::ManeuverControlState::MCS_STOPPED;
mcs.info = "stopped";
mcs.eta = 0;
dispatch(mcs);
}

which should not be necessary (unless I'm missing something?).

@krisgry krisgry changed the title Consumes in Maneuvers/Maneuver that stil check isActive Unnecessary check of isActive in Maneuvers/Maneuver consumes Mar 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant