mirror of
https://github.com/moveit/moveit_task_constructor.git
synced 2025-11-04 14:49:57 +08:00
SerialContainer: Resolve interfaces of all stages
This commit is contained in:
parent
499fcfb04b
commit
c4d0ab0636
@ -433,7 +433,9 @@ void SerialContainerPrivate::resolveInterface(InterfaceFlags expected) {
|
|||||||
Stage& first = *children().front();
|
Stage& first = *children().front();
|
||||||
Stage& last = *children().back();
|
Stage& last = *children().back();
|
||||||
|
|
||||||
// FIRST child
|
InitStageException exceptions;
|
||||||
|
|
||||||
|
try { // FIRST child
|
||||||
first.pimpl()->resolveInterface(expected & START_IF_MASK);
|
first.pimpl()->resolveInterface(expected & START_IF_MASK);
|
||||||
// connect first child's (start) push interface
|
// connect first child's (start) push interface
|
||||||
setChildsPushBackwardInterface(first.pimpl());
|
setChildsPushBackwardInterface(first.pimpl());
|
||||||
@ -443,16 +445,23 @@ void SerialContainerPrivate::resolveInterface(InterfaceFlags expected) {
|
|||||||
if (const InterfacePtr& target = first.pimpl()->starts())
|
if (const InterfacePtr& target = first.pimpl()->starts())
|
||||||
starts_.reset(new Interface(
|
starts_.reset(new Interface(
|
||||||
[this, target](Interface::iterator it, bool updated) { this->copyState(it, target, updated); }));
|
[this, target](Interface::iterator it, bool updated) { this->copyState(it, target, updated); }));
|
||||||
|
} catch (InitStageException& e) {
|
||||||
|
exceptions.append(e);
|
||||||
|
}
|
||||||
|
|
||||||
// process all children and connect them
|
// process all children and connect them
|
||||||
for (auto it = ++children().begin(), previous_it = children().begin(); it != children().end(); ++it, ++previous_it) {
|
for (auto it = ++children().begin(), previous_it = children().begin(); it != children().end(); ++it, ++previous_it) {
|
||||||
|
try {
|
||||||
StagePrivate* child_impl = (**it).pimpl();
|
StagePrivate* child_impl = (**it).pimpl();
|
||||||
StagePrivate* previous_impl = (**previous_it).pimpl();
|
StagePrivate* previous_impl = (**previous_it).pimpl();
|
||||||
child_impl->resolveInterface(invert(previous_impl->requiredInterface()) & START_IF_MASK);
|
child_impl->resolveInterface(invert(previous_impl->requiredInterface()) & START_IF_MASK);
|
||||||
connect(*previous_impl, *child_impl);
|
connect(*previous_impl, *child_impl);
|
||||||
|
} catch (InitStageException& e) {
|
||||||
|
exceptions.append(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// connect last child's (end) push interface
|
try { // connect last child's (end) push interface
|
||||||
setChildsPushForwardInterface(last.pimpl());
|
setChildsPushForwardInterface(last.pimpl());
|
||||||
// validate that last child's and this container's end interfaces match
|
// validate that last child's and this container's end interfaces match
|
||||||
validateInterface<END_IF_MASK>(*last.pimpl(), expected);
|
validateInterface<END_IF_MASK>(*last.pimpl(), expected);
|
||||||
@ -460,8 +469,14 @@ void SerialContainerPrivate::resolveInterface(InterfaceFlags expected) {
|
|||||||
if (const InterfacePtr& target = last.pimpl()->ends())
|
if (const InterfacePtr& target = last.pimpl()->ends())
|
||||||
ends_.reset(new Interface(
|
ends_.reset(new Interface(
|
||||||
[this, target](Interface::iterator it, bool updated) { this->copyState(it, target, updated); }));
|
[this, target](Interface::iterator it, bool updated) { this->copyState(it, target, updated); }));
|
||||||
|
} catch (InitStageException& e) {
|
||||||
|
exceptions.append(e);
|
||||||
|
}
|
||||||
|
|
||||||
required_interface_ = first.pimpl()->interfaceFlags() & START_IF_MASK | last.pimpl()->interfaceFlags() & END_IF_MASK;
|
required_interface_ = first.pimpl()->interfaceFlags() & START_IF_MASK | last.pimpl()->interfaceFlags() & END_IF_MASK;
|
||||||
|
|
||||||
|
if (exceptions)
|
||||||
|
throw exceptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SerialContainerPrivate::validateConnectivity() const {
|
void SerialContainerPrivate::validateConnectivity() const {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user