Skip to content

Unnecessary check of isActive in Maneuvers/Maneuver consumes #170

@krisgry

Description

@krisgry

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?).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions