diff --git a/core/demo/plan_pick_pa10.cpp b/core/demo/plan_pick_pa10.cpp index f728b0ee..0e343559 100644 --- a/core/demo/plan_pick_pa10.cpp +++ b/core/demo/plan_pick_pa10.cpp @@ -49,21 +49,21 @@ int main(int argc, char** argv){ { auto move = std::make_unique("open gripper"); - move->properties().configureInitFrom(PARENT); + move->properties().configureInitFrom(Stage::PARENT); move->setTo("open"); t.add(std::move(move)); } { auto move = std::make_unique("move to pre-grasp"); - move->properties().configureInitFrom(PARENT); + move->properties().configureInitFrom(Stage::PARENT); move->setTimeout(8.0); t.add(std::move(move)); } { auto move = std::make_unique("proceed to grasp pose"); - move->properties().configureInitFrom(PARENT); + move->properties().configureInitFrom(Stage::PARENT); move->setMinMaxDistance(.05, 0.1); move->setCartesianStepSize(0.02); @@ -75,7 +75,7 @@ int main(int argc, char** argv){ { auto gengrasp = std::make_unique("generate grasp pose"); - gengrasp->properties().configureInitFrom(PARENT); + gengrasp->properties().configureInitFrom(Stage::PARENT); gengrasp->setGripperGraspPose("open"); gengrasp->setObject("object"); gengrasp->setGraspFrame(Eigen::Translation3d(0,0,.05)* @@ -88,7 +88,7 @@ int main(int argc, char** argv){ { auto move = std::make_unique("grasp"); - move->properties().configureInitFrom(PARENT); + move->properties().configureInitFrom(Stage::PARENT); move->setTo("closed"); move->graspObject("object"); t.add(std::move(move)); @@ -96,7 +96,7 @@ int main(int argc, char** argv){ { auto move = std::make_unique("lift object"); - move->properties().configureInitFrom(PARENT); + move->properties().configureInitFrom(Stage::PARENT); move->setMinMaxDistance(0.03, 0.05); move->setCartesianStepSize(0.01); diff --git a/core/demo/plan_pick_ur5.cpp b/core/demo/plan_pick_ur5.cpp index bf76aa3e..e961cf7c 100644 --- a/core/demo/plan_pick_ur5.cpp +++ b/core/demo/plan_pick_ur5.cpp @@ -49,14 +49,14 @@ int main(int argc, char** argv){ { auto move = std::make_unique("open gripper"); - move->properties().configureInitFrom(PARENT); + move->properties().configureInitFrom(Stage::PARENT); move->setTo("open"); t.add(std::move(move)); } { auto move = std::make_unique("move to pre-grasp"); - move->properties().configureInitFrom(PARENT); + move->properties().configureInitFrom(Stage::PARENT); move->setTimeout(8.0); t.add(std::move(move)); } @@ -64,7 +64,7 @@ int main(int argc, char** argv){ { auto move = std::make_unique("proceed to grasp pose"); // move->addSolutionCallback(std::ref(t.introspection())); - move->properties().configureInitFrom(PARENT); + move->properties().configureInitFrom(Stage::PARENT); move->setMinMaxDistance(.03, 0.1); move->setCartesianStepSize(0.02); @@ -76,7 +76,7 @@ int main(int argc, char** argv){ { auto gengrasp = std::make_unique("generate grasp pose"); - gengrasp->properties().configureInitFrom(PARENT); + gengrasp->properties().configureInitFrom(Stage::PARENT); gengrasp->setGripperGraspPose("open"); gengrasp->setObject("object"); gengrasp->setGraspFrame(Eigen::Translation3d(.03,0,0), "s_model_tool0"); @@ -87,7 +87,7 @@ int main(int argc, char** argv){ { auto move = std::make_unique("grasp"); - move->properties().configureInitFrom(PARENT); + move->properties().configureInitFrom(Stage::PARENT); move->setTo("closed"); move->graspObject("object"); t.add(std::move(move)); @@ -95,7 +95,7 @@ int main(int argc, char** argv){ { auto move = std::make_unique("lift object"); - move->properties().configureInitFrom(PARENT); + move->properties().configureInitFrom(Stage::PARENT); move->setMinMaxDistance(0.03, 0.05); move->setCartesianStepSize(0.01); diff --git a/core/include/moveit/task_constructor/properties.h b/core/include/moveit/task_constructor/properties.h index 4cb30c39..3be6fb80 100644 --- a/core/include/moveit/task_constructor/properties.h +++ b/core/include/moveit/task_constructor/properties.h @@ -53,11 +53,6 @@ class PropertyMap; /// initializer function, using given name from the passed property map boost::any fromName(const PropertyMap& other, const std::string& other_name); -enum PropertyInitializerSource { - PARENT, - INTERFACE, -}; - /** Property is a wrapper for a boost::any value, also providing a default value and a description. * * Properties can be configured to be initialized from another PropertyMap - if still undefined. diff --git a/core/include/moveit/task_constructor/stage.h b/core/include/moveit/task_constructor/stage.h index 8a18ed1f..b43ad309 100644 --- a/core/include/moveit/task_constructor/stage.h +++ b/core/include/moveit/task_constructor/stage.h @@ -80,6 +80,17 @@ class Stage { public: PRIVATE_CLASS(Stage) typedef std::unique_ptr pointer; + /** Names for property initialization sources + * + * - INTERFACE allows to pass properties from one stage to the next (in a SerialContainer). + * - PARENT allows to inherit properties from the parent. + * + * INTERFACE takes precedence over PARENT. + */ + enum PropertyInitializerSource { + PARENT, + INTERFACE, + }; virtual ~Stage(); /// auto-convert Stage to StagePrivate* when needed diff --git a/core/src/stage.cpp b/core/src/stage.cpp index 6f2a9952..718f6cd9 100644 --- a/core/src/stage.cpp +++ b/core/src/stage.cpp @@ -240,8 +240,8 @@ const InterfaceState& PropagatingEitherWayPrivate::fetchEndState(){ void PropagatingEitherWayPrivate::initProperties(const InterfaceState& state) { properties_.reset(); - properties_.performInitFrom(PARENT, parent()->properties()); - properties_.performInitFrom(INTERFACE, state.properties()); + properties_.performInitFrom(Stage::PARENT, parent()->properties()); + properties_.performInitFrom(Stage::INTERFACE, state.properties()); } bool PropagatingEitherWayPrivate::canCompute() const @@ -433,7 +433,7 @@ bool GeneratorPrivate::compute() { void GeneratorPrivate::initProperties() { properties_.reset(); - properties_.performInitFrom(PARENT, parent()->properties()); + properties_.performInitFrom(Stage::PARENT, parent()->properties()); } @@ -482,10 +482,10 @@ void ConnectingPrivate::newEndState(const Interface::iterator& it) void ConnectingPrivate::initProperties(const InterfaceState &start, const InterfaceState &end) { properties_.reset(); - properties_.performInitFrom(PARENT, parent()->properties()); + properties_.performInitFrom(Stage::PARENT, parent()->properties()); // properties from start/end states need to be consistent to each other - properties_.performInitFrom(INTERFACE, start.properties()); - properties_.performInitFrom(INTERFACE, end.properties(), true); + properties_.performInitFrom(Stage::INTERFACE, start.properties()); + properties_.performInitFrom(Stage::INTERFACE, end.properties(), true); } bool ConnectingPrivate::canCompute() const{