mirror of
https://github.com/moveit/moveit_task_constructor.git
synced 2025-11-04 14:49:57 +08:00
ParallelContainer's requiredInterface()
This commit is contained in:
parent
3e4aa19246
commit
0dc4f5c53e
@ -702,14 +702,31 @@ InterfaceFlags ParallelContainerBasePrivate::requiredInterface() const
|
|||||||
{
|
{
|
||||||
if (children().empty())
|
if (children().empty())
|
||||||
return UNKNOWN;
|
return UNKNOWN;
|
||||||
/* TODO: replace this with a proper check for consistency of interfaces. Allowed combinations are:
|
/* The interfaces of all children need to be consistent with each other. Allowed combinations are:
|
||||||
* ❘ ❘ = ❘ (connecting stages)
|
* ❘ ❘ = ❘ (connecting stages)
|
||||||
* ↑ ↑ = ↑ (backward propagating)
|
* ↑ ↑ = ↑ (backward propagating)
|
||||||
* ↓ ↓ = ↓ (forward propagating)
|
* ↓ ↓ = ↓ (forward propagating)
|
||||||
* ↑ ↓ = ⇅ = ⇅ ↑ = ⇅ ↓ (propagating in both directions)
|
* ↑ ↓ = ⇅ = ⇅ ↑ = ⇅ ↓ (propagating in both directions)
|
||||||
* ↕ ↕ = ↕ (generating)
|
* ↕ ↕ = ↕ (generating)
|
||||||
*/
|
*/
|
||||||
return children().front()->pimpl()->requiredInterface();
|
|
||||||
|
InterfaceFlags accumulated = children().front()->pimpl()->requiredInterface();
|
||||||
|
for (const Stage::pointer& stage : children()) {
|
||||||
|
InterfaceFlags current = stage->pimpl()->requiredInterface();
|
||||||
|
if (accumulated != PROPAGATE_BOTHWAYS &&
|
||||||
|
(accumulated & current) == current) // all flags of current are already available in accumulated
|
||||||
|
continue;
|
||||||
|
|
||||||
|
bool current_is_propagating = (current == PROPAGATE_BOTHWAYS ||
|
||||||
|
current == PROPAGATE_FORWARDS ||
|
||||||
|
current == PROPAGATE_BACKWARDS);
|
||||||
|
|
||||||
|
if (current_is_propagating && accumulated != CONNECT && accumulated != GENERATE)
|
||||||
|
accumulated |= current; // propagating is compatible to all except CONNECT and GENERATE
|
||||||
|
else
|
||||||
|
throw InitStageException(*me(), "child '" + stage->name() + "' has conflicting interface to previous children");
|
||||||
|
}
|
||||||
|
return accumulated;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParallelContainerBasePrivate::pruneInterface(InterfaceFlags accepted)
|
void ParallelContainerBasePrivate::pruneInterface(InterfaceFlags accepted)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user