Skip to content

Commit

Permalink
possible fixes for the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
saikishor committed Jun 28, 2023
1 parent 8ecd9fd commit e9780b0
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions controller_manager/src/controller_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2342,36 +2342,6 @@ bool ControllerManager::controller_sorting(
std::find(following_ctrls.begin(), following_ctrls.end(), ctrl_b.info.name) !=
following_ctrls.end())
return true;
else
{
auto ctrl_a_preceding_ctrls = get_preceding_controller_names(ctrl_a.info.name, controllers);
// This is to check that the ctrl_b is in the preceding controllers list of ctrl_a - This
// check is useful when there is a chained controller branching, but they belong to same
// branch
if (
std::find(ctrl_a_preceding_ctrls.begin(), ctrl_a_preceding_ctrls.end(), ctrl_b.info.name) !=
ctrl_a_preceding_ctrls.end())
{
return false;
}

// This is to handle the cases where, the parsed ctrl_a and ctrl_b are not directly related
// but might have a common parent - happens in branched chained controller
auto ctrl_b_preceding_ctrls = get_preceding_controller_names(ctrl_b.info.name, controllers);
std::sort(ctrl_a_preceding_ctrls.begin(), ctrl_a_preceding_ctrls.end());
std::sort(ctrl_b_preceding_ctrls.begin(), ctrl_b_preceding_ctrls.end());
std::list<std::string> intersection;
std::set_intersection(
ctrl_a_preceding_ctrls.begin(), ctrl_a_preceding_ctrls.end(),
ctrl_b_preceding_ctrls.begin(), ctrl_b_preceding_ctrls.end(),
std::back_inserter(intersection));
if (!intersection.empty())
{
// If there is an intersection, then there is a common parent controller for both ctrl_a and
// ctrl_b
return true;
}
}

// If the ctrl_a's state interface is the one exported by the ctrl_b then ctrl_b should be
// infront of ctrl_a
Expand Down

0 comments on commit e9780b0

Please sign in to comment.