add external properties to SolutionInfo - #194
Conversation
Codecov Report
Continue to review full report at Codecov.
|
rhaschke
left a comment
There was a problem hiding this comment.
Note that a Property's value field is a string comprising a serialized version of an arbitrary property.
The serialization/deserialization methods are not (yet) exposed and might be subject to changes. There are also some properties, which don't (yet) have a serialization/deserialization method defined.
Hence, the Property type might not be the best choice to implement the behavior here. At least we would need to expose the deserialization methods...
That's exactly why I would prefer it over some string indicator fields for this.
Same for everything else in MTC.
From a pragmatic point of view it works just fine with |
a3f816a to
89f9d2f
Compare
Better usability for user code if they deserialize individual Propertys. The fallback variants are not used internally and are redundant because there is a separate default behavior. Removed the msg parameter for Property exceptions. It was only used by a single edge-case which didn't really justify the use of the exception anyway. Instead allow `undefined` to be instantiated without parameters because the Property does not know its own name.
Defaults are not supposed to be modified by accident. Instead, provide a writable reference to currentValue.
89f9d2f to
50ef6ea
Compare
50ef6ea to
fb0fa19
Compare
rhaschke
left a comment
There was a problem hiding this comment.
Just a few remarks... We definitely should have a phone call to sync a little bit on our activities 😉
Derive from a type conditioned on the actual capabilities of T.
|
I was long thinking about why I decided against your proposed solution when I worked on Property serialization.
|
|
We discussed pros and cons of the old and the proposed approach in a phone conference. This is the summary:
|
v4hn
left a comment
There was a problem hiding this comment.
thanks for the summary. here are some more comments I wrote before the talk reviewing your changes.
|
I want to execute subsolutions of a solution sequentially and in between set IOs or call services. |
| } catch (Property::undefined& e) { | ||
| e.setName(name); | ||
| throw e; |
There was a problem hiding this comment.
Catching and rethrowing is more costly than the previous version of testing and throwing only once.
| /// the current value defined or will the fallback be used? | ||
| inline bool defined() const { return !value_.empty(); } | ||
| /// is a value defined? | ||
| inline bool defined() const { return !(value_.empty() && default_.empty()); } |
There was a problem hiding this comment.
Here you change the semantics of defined()!
I guess you want to distinguish isDefined() from isSet() == hasCurrentValue()?
Let's discuss the naming over phone...
| const boost::any& v{ value() }; | ||
| if (v.empty()) | ||
| throw Property::undefined(); | ||
| return boost::any_cast<const T&>(value()); |
There was a problem hiding this comment.
| return boost::any_cast<const T&>(value()); | |
| return boost::any_cast<const T&>(v); |
See also my comment on PropertyMap::get().
|
What is the status of this PR ? Would be really useful. I think a lot of people got their own way of dealing with this. BTW this PR needs this patch, to actually print the properties. |
|
@v4hn Trying to serialize the ros msg |
| const Property& property(const std::string& name) const { return const_cast<PropertyMap*>(this)->property(name); } | ||
|
|
||
| void fillMsgs(std::vector<moveit_task_constructor_msgs::Property>& msgs) const; | ||
| void fromMsgs(std::vector<moveit_task_constructor_msgs::Property>& msgs); |
There was a problem hiding this comment.
| void fromMsgs(std::vector<moveit_task_constructor_msgs::Property>& msgs); | |
| void fromMsgs(const std::vector<moveit_task_constructor_msgs::Property>& msgs); |
| } | ||
| } | ||
|
|
||
| void PropertyMap::fromMsgs(std::vector<moveit_task_constructor_msgs::Property>& msgs) { |
There was a problem hiding this comment.
| void PropertyMap::fromMsgs(std::vector<moveit_task_constructor_msgs::Property>& msgs) { | |
| void PropertyMap::fromMsgs(const std::vector<moveit_task_constructor_msgs::Property>& msgs) { |
| #include <rviz/properties/property_tree_model.h> | ||
| #include <rviz/properties/string_property.h> | ||
| #include <rviz/properties/float_property.h> | ||
| #include <rviz/properties/vector_property.h> |
There was a problem hiding this comment.
Compile error on Noetic:
Compilation error:
In file included from /opt/ros/noetic/include/rviz/properties/vector_property.h:32,
from /home/captain-yoshi/ws/ros/mimik_ws/src/moveit_task_constructor/visualization/motion_planning_tasks/properties/property_factory.cpp:46:
/opt/ros/noetic/include/rviz/ogre_helpers/ogre_vector.h:2:10: fatal error: OgrePrerequisites.h: No such file or directory
2 | #include <OgrePrerequisites.h>
```
|
Trying to recreate a The culprit is the Test to add: Output of Property.msg |
|
I have added tests and fixes in this branch. This now works for my use case. I would also prefer the YAML serialization over binary. You can even have exact saving/loading of floating point numbers, at the cost of size increase. |


This interface can be customized by the user to state when/where additional execution hooks should run.
This is an initial thread to discuss/extend this idea as discussed in #192