expose Stage API to get the matching introspection ID

This was implicitly requested in #192 .
This commit is contained in:
v4hn 2020-07-29 17:46:54 +02:00 committed by Robert Haschke
parent 6bebe3f3ed
commit 62d894199f
2 changed files with 8 additions and 0 deletions

View File

@ -180,6 +180,8 @@ public:
const std::string& name() const; const std::string& name() const;
void setName(const std::string& name); void setName(const std::string& name);
uint32_t introspectionId() const;
/** set computation timeout (in seconds) /** set computation timeout (in seconds)
* *
* The logic of the individual stage should ensure this limit is respected. * The logic of the individual stage should ensure this limit is respected.

View File

@ -283,6 +283,12 @@ void Stage::setName(const std::string& name) {
pimpl_->name_ = name; pimpl_->name_ = name;
} }
uint32_t Stage::introspectionId() const {
if (!pimpl_->introspection_)
throw std::runtime_error("Task is not initialized yet or Introspection was disabled.");
return const_cast<const moveit::task_constructor::Introspection*>(pimpl_->introspection_)->stageId(this);
}
void Stage::forwardProperties(const InterfaceState& source, InterfaceState& dest) { void Stage::forwardProperties(const InterfaceState& source, InterfaceState& dest) {
const PropertyMap& src = source.properties(); const PropertyMap& src = source.properties();
PropertyMap& dst = dest.properties(); PropertyMap& dst = dest.properties();