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 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.
|
// If, during pruneInterface() later, we notice that it's not needed, prune there.
|
||||||
inline void setChildsPushBackwardInterface(Stage& child) {
|
inline void setChildsPushBackwardInterface(Stage& child) {
|
||||||
bool allowed = (child.pimpl()->requiredInterface() & WRITES_PREV_END) ||
|
InterfaceFlags required = child.pimpl()->requiredInterface();
|
||||||
(child.pimpl()->requiredInterface() == UNKNOWN);
|
bool allowed = (required & WRITES_PREV_END) || (required == UNKNOWN);
|
||||||
child.pimpl()->setPrevEnds(allowed ? pending_backward_ : InterfacePtr());
|
child.pimpl()->setPrevEnds(allowed ? pending_backward_ : InterfacePtr());
|
||||||
}
|
}
|
||||||
inline void setChildsPushForwardInterface(Stage& child) {
|
inline void setChildsPushForwardInterface(Stage& child) {
|
||||||
bool allowed = (child.pimpl()->requiredInterface() & WRITES_NEXT_START) ||
|
InterfaceFlags required = child.pimpl()->requiredInterface();
|
||||||
(child.pimpl()->requiredInterface() == UNKNOWN);
|
bool allowed = (required & WRITES_NEXT_START) || (required == UNKNOWN);
|
||||||
child.pimpl()->setNextStarts(allowed ? pending_forward_ : InterfacePtr());
|
child.pimpl()->setNextStarts(allowed ? pending_forward_ : InterfacePtr());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -399,8 +399,8 @@ InterfaceFlags SerialContainerPrivate::requiredInterface() const
|
|||||||
{
|
{
|
||||||
if (children().empty())
|
if (children().empty())
|
||||||
return UNKNOWN;
|
return UNKNOWN;
|
||||||
return (children().front()->pimpl()->requiredInterface() & INPUT_IF_MASK)
|
return (children().front()->pimpl()->interfaceFlags() & INPUT_IF_MASK)
|
||||||
| (children().back()->pimpl()->requiredInterface() & OUTPUT_IF_MASK);
|
| (children().back()->pimpl()->interfaceFlags() & OUTPUT_IF_MASK);
|
||||||
}
|
}
|
||||||
|
|
||||||
// connect cur stage to its predecessor and successor by setting the push interface pointers
|
// 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) {
|
void reset(bool start=true, bool end=true) {
|
||||||
container.reset();
|
container.reset();
|
||||||
container.clear();
|
|
||||||
ContainerBasePrivate *impl = container.pimpl();
|
ContainerBasePrivate *impl = container.pimpl();
|
||||||
impl->setNextStarts(InterfacePtr());
|
impl->setNextStarts(InterfacePtr());
|
||||||
impl->setPrevEnds(InterfacePtr());
|
impl->setPrevEnds(InterfacePtr());
|
||||||
@ -214,11 +213,13 @@ TEST_F(SerialTest, insertion_order) {
|
|||||||
|
|
||||||
#define EXPECT_INIT_FAILURE(start, end, ...) {\
|
#define EXPECT_INIT_FAILURE(start, end, ...) {\
|
||||||
SCOPED_TRACE("validateInit({" #__VA_ARGS__ "})"); \
|
SCOPED_TRACE("validateInit({" #__VA_ARGS__ "})"); \
|
||||||
|
container.clear(); \
|
||||||
validateInit(start, end, {__VA_ARGS__}, true); \
|
validateInit(start, end, {__VA_ARGS__}, true); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define EXPECT_INIT_SUCCESS(start, end, ...) {\
|
#define EXPECT_INIT_SUCCESS(start, end, ...) {\
|
||||||
SCOPED_TRACE("validateInit({" #__VA_ARGS__ "})"); \
|
SCOPED_TRACE("validateInit({" #__VA_ARGS__ "})"); \
|
||||||
|
container.clear(); \
|
||||||
validateInit(start, end, {__VA_ARGS__}, false); \
|
validateInit(start, end, {__VA_ARGS__}, false); \
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -343,6 +344,13 @@ TEST_F(SerialTest, interface_detection) {
|
|||||||
EXPECT_EQ(container.pimpl()->interfaceFlags(), UNKNOWN);
|
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> {
|
class ParallelTest : public InitTest<Alternatives> {
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user