mirror of
https://github.com/moveit/moveit_task_constructor.git
synced 2025-11-04 14:49:57 +08:00
fix interface detection for nested SerialContainers
This commit is contained in:
parent
159beeb044
commit
6d859840c3
@ -104,13 +104,13 @@ protected:
|
||||
// if the interface is unknown: in this case greedily assume a push interface.
|
||||
// If, during pruneInterface() later, we notice that it's not needed, prune there.
|
||||
inline void setChildsPushBackwardInterface(Stage& child) {
|
||||
bool allowed = (child.pimpl()->requiredInterface() & WRITES_PREV_END) ||
|
||||
(child.pimpl()->requiredInterface() == UNKNOWN);
|
||||
InterfaceFlags required = child.pimpl()->requiredInterface();
|
||||
bool allowed = (required & WRITES_PREV_END) || (required == UNKNOWN);
|
||||
child.pimpl()->setPrevEnds(allowed ? pending_backward_ : InterfacePtr());
|
||||
}
|
||||
inline void setChildsPushForwardInterface(Stage& child) {
|
||||
bool allowed = (child.pimpl()->requiredInterface() & WRITES_NEXT_START) ||
|
||||
(child.pimpl()->requiredInterface() == UNKNOWN);
|
||||
InterfaceFlags required = child.pimpl()->requiredInterface();
|
||||
bool allowed = (required & WRITES_NEXT_START) || (required == UNKNOWN);
|
||||
child.pimpl()->setNextStarts(allowed ? pending_forward_ : InterfacePtr());
|
||||
}
|
||||
|
||||
|
||||
@ -399,8 +399,8 @@ InterfaceFlags SerialContainerPrivate::requiredInterface() const
|
||||
{
|
||||
if (children().empty())
|
||||
return UNKNOWN;
|
||||
return (children().front()->pimpl()->requiredInterface() & INPUT_IF_MASK)
|
||||
| (children().back()->pimpl()->requiredInterface() & OUTPUT_IF_MASK);
|
||||
return (children().front()->pimpl()->interfaceFlags() & INPUT_IF_MASK)
|
||||
| (children().back()->pimpl()->interfaceFlags() & OUTPUT_IF_MASK);
|
||||
}
|
||||
|
||||
// connect cur stage to its predecessor and successor by setting the push interface pointers
|
||||
|
||||
@ -117,7 +117,6 @@ protected:
|
||||
}
|
||||
void reset(bool start=true, bool end=true) {
|
||||
container.reset();
|
||||
container.clear();
|
||||
ContainerBasePrivate *impl = container.pimpl();
|
||||
impl->setNextStarts(InterfacePtr());
|
||||
impl->setPrevEnds(InterfacePtr());
|
||||
@ -214,11 +213,13 @@ TEST_F(SerialTest, insertion_order) {
|
||||
|
||||
#define EXPECT_INIT_FAILURE(start, end, ...) {\
|
||||
SCOPED_TRACE("validateInit({" #__VA_ARGS__ "})"); \
|
||||
container.clear(); \
|
||||
validateInit(start, end, {__VA_ARGS__}, true); \
|
||||
}
|
||||
|
||||
#define EXPECT_INIT_SUCCESS(start, end, ...) {\
|
||||
SCOPED_TRACE("validateInit({" #__VA_ARGS__ "})"); \
|
||||
container.clear(); \
|
||||
validateInit(start, end, {__VA_ARGS__}, false); \
|
||||
}
|
||||
|
||||
@ -343,6 +344,13 @@ TEST_F(SerialTest, interface_detection) {
|
||||
EXPECT_EQ(container.pimpl()->interfaceFlags(), UNKNOWN);
|
||||
}
|
||||
|
||||
TEST_F(SerialTest, nested_interface_detection) {
|
||||
auto inner = std::make_unique<SerialContainer>("inner");
|
||||
append(*inner, {GEN, ANY});
|
||||
container.insert(std::move(inner));
|
||||
validateInit(true, true, {ANY}, false);
|
||||
}
|
||||
|
||||
|
||||
class ParallelTest : public InitTest<Alternatives> {
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user