mirror of
https://github.com/moveit/moveit_task_constructor.git
synced 2025-11-04 14:49:57 +08:00
fixup! improve error msg for mismatching container/child interfaces
We need to consider input and output interfaces separately. Also, use console output symbols (<- / -> / <->)
This commit is contained in:
parent
1e0a9401e7
commit
d741f36ee3
@ -554,14 +554,17 @@ void SerialContainer::validateConnectivity() const
|
||||
// check that input / output interface of first / last child matches this' resp. interface
|
||||
if (!impl->children().empty()) {
|
||||
const StagePrivate* start = impl->children().front()->pimpl();
|
||||
if ((start->interfaceFlags() & INPUT_IF_MASK) != (this->pimpl()->interfaceFlags() & INPUT_IF_MASK))
|
||||
errors.push_back(*this, (desc % "input" % start->name() % flowSymbol(start->interfaceFlags())
|
||||
% flowSymbol(this->pimpl()->interfaceFlags())).str());
|
||||
const auto my_flags = this->pimpl()->interfaceFlags();
|
||||
auto child_flags = start->interfaceFlags() & INPUT_IF_MASK;
|
||||
if (child_flags != (my_flags & INPUT_IF_MASK))
|
||||
errors.push_back(*this, (desc % "input" % start->name() % flowSymbol(child_flags)
|
||||
% flowSymbol(my_flags & INPUT_IF_MASK)).str());
|
||||
|
||||
const StagePrivate* last = impl->children().back()->pimpl();
|
||||
if ((last->interfaceFlags() & OUTPUT_IF_MASK) != (this->pimpl()->interfaceFlags() & OUTPUT_IF_MASK))
|
||||
errors.push_back(*this, (desc % "output" % last->name() % flowSymbol(last->interfaceFlags())
|
||||
% flowSymbol(this->pimpl()->interfaceFlags())).str());
|
||||
child_flags = last->interfaceFlags() & OUTPUT_IF_MASK;
|
||||
if (child_flags != (my_flags & OUTPUT_IF_MASK))
|
||||
errors.push_back(*this, (desc % "output" % last->name() % flowSymbol(child_flags)
|
||||
% flowSymbol(my_flags & OUTPUT_IF_MASK)).str());
|
||||
}
|
||||
|
||||
// validate connectivity of children amongst each other
|
||||
|
||||
@ -349,13 +349,21 @@ const char* direction(const StagePrivate& stage) {
|
||||
return "<-";
|
||||
}
|
||||
|
||||
const char* flowSymbol(moveit::task_constructor::InterfaceFlags f) {
|
||||
if (f == InterfaceFlags(CONNECT)) return "∞";
|
||||
if (f == InterfaceFlags(PROPAGATE_FORWARDS)) return "↓";
|
||||
if (f == InterfaceFlags(PROPAGATE_BACKWARDS)) return "↑";
|
||||
if (f == PROPAGATE_BOTHWAYS) return "⇅";
|
||||
if (f == InterfaceFlags(GENERATE)) return "↕";
|
||||
return "?";
|
||||
const char* flowSymbol(InterfaceFlags f) {
|
||||
if (f == InterfaceFlags())
|
||||
return "?"; // unknown interface
|
||||
|
||||
// f should have either INPUT or OUTPUT flags set (not both)
|
||||
assert(static_cast<bool>(f & INPUT_IF_MASK) ^ static_cast<bool>(f & OUTPUT_IF_MASK));
|
||||
|
||||
if (f & INPUT_IF_MASK) {
|
||||
if (f == READS_START) return "->";
|
||||
if (f == WRITES_PREV_END) return "<-";
|
||||
} else if (f & OUTPUT_IF_MASK) {
|
||||
if (f == READS_END) return "<-";
|
||||
if (f == WRITES_NEXT_START) return "->";
|
||||
}
|
||||
return "<->";
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const StagePrivate& impl) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user