File tree Expand file tree Collapse file tree 3 files changed +18
-9
lines changed
include/moveit/task_constructor Expand file tree Collapse file tree 3 files changed +18
-9
lines changed Original file line number Diff line number Diff line change 4747#include < sstream>
4848#include < ros/serialization.h>
4949
50+ #include < moveit_task_constructor_msgs/Property.h>
51+
5052namespace moveit {
5153namespace task_constructor {
5254
@@ -297,13 +299,16 @@ class PropertyMap
297299 Property& property (const std::string& name);
298300 const Property& property (const std::string& name) const { return const_cast <PropertyMap*>(this )->property (name); }
299301
302+ void fillMsgs (std::vector<moveit_task_constructor_msgs::Property>& msg) const ;
303+
300304 using iterator = std::map<std::string, Property>::iterator;
301305 using const_iterator = std::map<std::string, Property>::const_iterator;
302306
303307 iterator begin () { return props_.begin (); }
304308 iterator end () { return props_.end (); }
305309 const_iterator begin () const { return props_.begin (); }
306310 const_iterator end () const { return props_.end (); }
311+ size_t size () const { return props_.size (); }
307312
308313 // / allow initialization from given source for listed properties - always using the same name
309314 void configureInitFrom (Property::SourceFlags source, const std::set<std::string>& properties = {});
Original file line number Diff line number Diff line change @@ -225,15 +225,7 @@ Introspection::fillTaskDescription(moveit_task_constructor_msgs::TaskDescription
225225 desc.name = stage.name ();
226226 desc.flags = stage.pimpl ()->interfaceFlags ();
227227
228- // fill stage properties
229- for (const auto & pair : stage.properties ()) {
230- moveit_task_constructor_msgs::Property p;
231- p.name = pair.first ;
232- p.description = pair.second .description ();
233- p.type = pair.second .typeName ();
234- p.value = pair.second .serialize ();
235- desc.properties .push_back (p);
236- }
228+ stage.properties ().fillMsgs (desc.properties );
237229
238230 auto it = impl->stage_to_id_map_ .find (stage.pimpl ()->parent ()->pimpl ());
239231 assert (it != impl->stage_to_id_map_ .cend ());
Original file line number Diff line number Diff line change @@ -212,6 +212,18 @@ Property& PropertyMap::property(const std::string& name) {
212212 return it->second ;
213213}
214214
215+ void PropertyMap::fillMsgs (std::vector<moveit_task_constructor_msgs::Property>& msgs) const {
216+ msgs.reserve (size ());
217+ for (const auto & pair : *this ) {
218+ msgs.emplace_back ();
219+ auto & p{ msgs.back () };
220+ p.name = pair.first ;
221+ p.description = pair.second .description ();
222+ p.type = pair.second .typeName ();
223+ p.value = pair.second .serialize ();
224+ }
225+ }
226+
215227void PropertyMap::exposeTo (PropertyMap& other, const std::set<std::string>& properties) const {
216228 for (const std::string& name : properties)
217229 exposeTo (other, name, name);
You can’t perform that action at this time.
0 commit comments