mirror of
https://github.com/moveit/moveit_task_constructor.git
synced 2025-11-04 14:49:57 +08:00
definition of PropertyInitializerSource moved to Stage
This commit is contained in:
parent
f6253c46a4
commit
4db7e8eb88
@ -49,21 +49,21 @@ int main(int argc, char** argv){
|
|||||||
|
|
||||||
{
|
{
|
||||||
auto move = std::make_unique<stages::Gripper>("open gripper");
|
auto move = std::make_unique<stages::Gripper>("open gripper");
|
||||||
move->properties().configureInitFrom(PARENT);
|
move->properties().configureInitFrom(Stage::PARENT);
|
||||||
move->setTo("open");
|
move->setTo("open");
|
||||||
t.add(std::move(move));
|
t.add(std::move(move));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
auto move = std::make_unique<stages::Move>("move to pre-grasp");
|
auto move = std::make_unique<stages::Move>("move to pre-grasp");
|
||||||
move->properties().configureInitFrom(PARENT);
|
move->properties().configureInitFrom(Stage::PARENT);
|
||||||
move->setTimeout(8.0);
|
move->setTimeout(8.0);
|
||||||
t.add(std::move(move));
|
t.add(std::move(move));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
auto move = std::make_unique<stages::CartesianPositionMotion>("proceed to grasp pose");
|
auto move = std::make_unique<stages::CartesianPositionMotion>("proceed to grasp pose");
|
||||||
move->properties().configureInitFrom(PARENT);
|
move->properties().configureInitFrom(Stage::PARENT);
|
||||||
move->setMinMaxDistance(.05, 0.1);
|
move->setMinMaxDistance(.05, 0.1);
|
||||||
move->setCartesianStepSize(0.02);
|
move->setCartesianStepSize(0.02);
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ int main(int argc, char** argv){
|
|||||||
|
|
||||||
{
|
{
|
||||||
auto gengrasp = std::make_unique<stages::GenerateGraspPose>("generate grasp pose");
|
auto gengrasp = std::make_unique<stages::GenerateGraspPose>("generate grasp pose");
|
||||||
gengrasp->properties().configureInitFrom(PARENT);
|
gengrasp->properties().configureInitFrom(Stage::PARENT);
|
||||||
gengrasp->setGripperGraspPose("open");
|
gengrasp->setGripperGraspPose("open");
|
||||||
gengrasp->setObject("object");
|
gengrasp->setObject("object");
|
||||||
gengrasp->setGraspFrame(Eigen::Translation3d(0,0,.05)*
|
gengrasp->setGraspFrame(Eigen::Translation3d(0,0,.05)*
|
||||||
@ -88,7 +88,7 @@ int main(int argc, char** argv){
|
|||||||
|
|
||||||
{
|
{
|
||||||
auto move = std::make_unique<stages::Gripper>("grasp");
|
auto move = std::make_unique<stages::Gripper>("grasp");
|
||||||
move->properties().configureInitFrom(PARENT);
|
move->properties().configureInitFrom(Stage::PARENT);
|
||||||
move->setTo("closed");
|
move->setTo("closed");
|
||||||
move->graspObject("object");
|
move->graspObject("object");
|
||||||
t.add(std::move(move));
|
t.add(std::move(move));
|
||||||
@ -96,7 +96,7 @@ int main(int argc, char** argv){
|
|||||||
|
|
||||||
{
|
{
|
||||||
auto move = std::make_unique<stages::CartesianPositionMotion>("lift object");
|
auto move = std::make_unique<stages::CartesianPositionMotion>("lift object");
|
||||||
move->properties().configureInitFrom(PARENT);
|
move->properties().configureInitFrom(Stage::PARENT);
|
||||||
move->setMinMaxDistance(0.03, 0.05);
|
move->setMinMaxDistance(0.03, 0.05);
|
||||||
move->setCartesianStepSize(0.01);
|
move->setCartesianStepSize(0.01);
|
||||||
|
|
||||||
|
|||||||
@ -49,14 +49,14 @@ int main(int argc, char** argv){
|
|||||||
|
|
||||||
{
|
{
|
||||||
auto move = std::make_unique<stages::Gripper>("open gripper");
|
auto move = std::make_unique<stages::Gripper>("open gripper");
|
||||||
move->properties().configureInitFrom(PARENT);
|
move->properties().configureInitFrom(Stage::PARENT);
|
||||||
move->setTo("open");
|
move->setTo("open");
|
||||||
t.add(std::move(move));
|
t.add(std::move(move));
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
auto move = std::make_unique<stages::Move>("move to pre-grasp");
|
auto move = std::make_unique<stages::Move>("move to pre-grasp");
|
||||||
move->properties().configureInitFrom(PARENT);
|
move->properties().configureInitFrom(Stage::PARENT);
|
||||||
move->setTimeout(8.0);
|
move->setTimeout(8.0);
|
||||||
t.add(std::move(move));
|
t.add(std::move(move));
|
||||||
}
|
}
|
||||||
@ -64,7 +64,7 @@ int main(int argc, char** argv){
|
|||||||
{
|
{
|
||||||
auto move = std::make_unique<stages::CartesianPositionMotion>("proceed to grasp pose");
|
auto move = std::make_unique<stages::CartesianPositionMotion>("proceed to grasp pose");
|
||||||
// move->addSolutionCallback(std::ref(t.introspection()));
|
// move->addSolutionCallback(std::ref(t.introspection()));
|
||||||
move->properties().configureInitFrom(PARENT);
|
move->properties().configureInitFrom(Stage::PARENT);
|
||||||
move->setMinMaxDistance(.03, 0.1);
|
move->setMinMaxDistance(.03, 0.1);
|
||||||
move->setCartesianStepSize(0.02);
|
move->setCartesianStepSize(0.02);
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ int main(int argc, char** argv){
|
|||||||
|
|
||||||
{
|
{
|
||||||
auto gengrasp = std::make_unique<stages::GenerateGraspPose>("generate grasp pose");
|
auto gengrasp = std::make_unique<stages::GenerateGraspPose>("generate grasp pose");
|
||||||
gengrasp->properties().configureInitFrom(PARENT);
|
gengrasp->properties().configureInitFrom(Stage::PARENT);
|
||||||
gengrasp->setGripperGraspPose("open");
|
gengrasp->setGripperGraspPose("open");
|
||||||
gengrasp->setObject("object");
|
gengrasp->setObject("object");
|
||||||
gengrasp->setGraspFrame(Eigen::Translation3d(.03,0,0), "s_model_tool0");
|
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<stages::Gripper>("grasp");
|
auto move = std::make_unique<stages::Gripper>("grasp");
|
||||||
move->properties().configureInitFrom(PARENT);
|
move->properties().configureInitFrom(Stage::PARENT);
|
||||||
move->setTo("closed");
|
move->setTo("closed");
|
||||||
move->graspObject("object");
|
move->graspObject("object");
|
||||||
t.add(std::move(move));
|
t.add(std::move(move));
|
||||||
@ -95,7 +95,7 @@ int main(int argc, char** argv){
|
|||||||
|
|
||||||
{
|
{
|
||||||
auto move = std::make_unique<stages::CartesianPositionMotion>("lift object");
|
auto move = std::make_unique<stages::CartesianPositionMotion>("lift object");
|
||||||
move->properties().configureInitFrom(PARENT);
|
move->properties().configureInitFrom(Stage::PARENT);
|
||||||
move->setMinMaxDistance(0.03, 0.05);
|
move->setMinMaxDistance(0.03, 0.05);
|
||||||
move->setCartesianStepSize(0.01);
|
move->setCartesianStepSize(0.01);
|
||||||
|
|
||||||
|
|||||||
@ -53,11 +53,6 @@ class PropertyMap;
|
|||||||
/// initializer function, using given name from the passed property map
|
/// initializer function, using given name from the passed property map
|
||||||
boost::any fromName(const PropertyMap& other, const std::string& other_name);
|
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.
|
/** 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.
|
* Properties can be configured to be initialized from another PropertyMap - if still undefined.
|
||||||
|
|||||||
@ -80,6 +80,17 @@ class Stage {
|
|||||||
public:
|
public:
|
||||||
PRIVATE_CLASS(Stage)
|
PRIVATE_CLASS(Stage)
|
||||||
typedef std::unique_ptr<Stage> pointer;
|
typedef std::unique_ptr<Stage> 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();
|
virtual ~Stage();
|
||||||
|
|
||||||
/// auto-convert Stage to StagePrivate* when needed
|
/// auto-convert Stage to StagePrivate* when needed
|
||||||
|
|||||||
@ -240,8 +240,8 @@ const InterfaceState& PropagatingEitherWayPrivate::fetchEndState(){
|
|||||||
void PropagatingEitherWayPrivate::initProperties(const InterfaceState& state)
|
void PropagatingEitherWayPrivate::initProperties(const InterfaceState& state)
|
||||||
{
|
{
|
||||||
properties_.reset();
|
properties_.reset();
|
||||||
properties_.performInitFrom(PARENT, parent()->properties());
|
properties_.performInitFrom(Stage::PARENT, parent()->properties());
|
||||||
properties_.performInitFrom(INTERFACE, state.properties());
|
properties_.performInitFrom(Stage::INTERFACE, state.properties());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PropagatingEitherWayPrivate::canCompute() const
|
bool PropagatingEitherWayPrivate::canCompute() const
|
||||||
@ -433,7 +433,7 @@ bool GeneratorPrivate::compute() {
|
|||||||
void GeneratorPrivate::initProperties()
|
void GeneratorPrivate::initProperties()
|
||||||
{
|
{
|
||||||
properties_.reset();
|
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)
|
void ConnectingPrivate::initProperties(const InterfaceState &start, const InterfaceState &end)
|
||||||
{
|
{
|
||||||
properties_.reset();
|
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 from start/end states need to be consistent to each other
|
||||||
properties_.performInitFrom(INTERFACE, start.properties());
|
properties_.performInitFrom(Stage::INTERFACE, start.properties());
|
||||||
properties_.performInitFrom(INTERFACE, end.properties(), true);
|
properties_.performInitFrom(Stage::INTERFACE, end.properties(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ConnectingPrivate::canCompute() const{
|
bool ConnectingPrivate::canCompute() const{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user