mirror of
https://github.com/moveit/moveit_task_constructor.git
synced 2025-11-04 14:49:57 +08:00
ComputeIK: auto-configure default timeout from JMG's default
TODO: actually set the default value but not the current value!
This commit is contained in:
parent
1e0a9401e7
commit
c72a6cddac
@ -65,7 +65,7 @@ boost::any fromName(const PropertyMap& other, const std::string& other_name);
|
|||||||
*
|
*
|
||||||
* Setting the value via setValue() updates both, the current value and the default value.
|
* Setting the value via setValue() updates both, the current value and the default value.
|
||||||
* Using reset() the default value can be restored.
|
* Using reset() the default value can be restored.
|
||||||
* Using setCurrentValue() only updates the current value, allowing for later reset to the original default.
|
* setCurrentValue() and setDefaultValue() only set the specific value.
|
||||||
*/
|
*/
|
||||||
class Property {
|
class Property {
|
||||||
friend class PropertyMap;
|
friend class PropertyMap;
|
||||||
@ -97,6 +97,7 @@ public:
|
|||||||
/// set current value and default value
|
/// set current value and default value
|
||||||
void setValue(const boost::any& value);
|
void setValue(const boost::any& value);
|
||||||
void setCurrentValue(const boost::any& value);
|
void setCurrentValue(const boost::any& value);
|
||||||
|
void setDefaultValue(const boost::any& value);
|
||||||
|
|
||||||
/// reset to default value (which can be empty)
|
/// reset to default value (which can be empty)
|
||||||
void reset();
|
void reset();
|
||||||
@ -274,6 +275,7 @@ public:
|
|||||||
/// declare given property name as other_name in other PropertyMap
|
/// declare given property name as other_name in other PropertyMap
|
||||||
void exposeTo(PropertyMap& other, const std::string& name, const std::string& other_name) const;
|
void exposeTo(PropertyMap& other, const std::string& name, const std::string& other_name) const;
|
||||||
|
|
||||||
|
/// check whether given property is declared
|
||||||
bool hasProperty(const std::string &name) const;
|
bool hasProperty(const std::string &name) const;
|
||||||
|
|
||||||
/// get the property with given name, throws Property::undeclared for unknown name
|
/// get the property with given name, throws Property::undeclared for unknown name
|
||||||
|
|||||||
@ -142,6 +142,14 @@ void Property::setCurrentValue(const boost::any &value)
|
|||||||
initialized_from_ = 1; // manually initialized TODO: use enums
|
initialized_from_ = 1; // manually initialized TODO: use enums
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Property::setDefaultValue(const boost::any& value)
|
||||||
|
{
|
||||||
|
if (!value.empty() && type_info_ != typeid(boost::any) && value.type() != type_info_)
|
||||||
|
throw Property::type_error(value.type().name(), type_info_.name());
|
||||||
|
|
||||||
|
default_ = value;
|
||||||
|
}
|
||||||
|
|
||||||
void Property::reset()
|
void Property::reset()
|
||||||
{
|
{
|
||||||
if (initialized_from_ == 0) // TODO: use enum
|
if (initialized_from_ == 0) // TODO: use enum
|
||||||
|
|||||||
@ -54,7 +54,6 @@ namespace moveit { namespace task_constructor { namespace stages {
|
|||||||
ComputeIK::ComputeIK(const std::string &name, Stage::pointer &&child)
|
ComputeIK::ComputeIK(const std::string &name, Stage::pointer &&child)
|
||||||
: WrapperBase(name, std::move(child))
|
: WrapperBase(name, std::move(child))
|
||||||
{
|
{
|
||||||
setTimeout(1.0);
|
|
||||||
auto& p = properties();
|
auto& p = properties();
|
||||||
p.declare<std::string>("eef", "name of end-effector group");
|
p.declare<std::string>("eef", "name of end-effector group");
|
||||||
p.declare<std::string>("group", "name of active group (derived from eef if not provided)");
|
p.declare<std::string>("group", "name of active group (derived from eef if not provided)");
|
||||||
@ -229,6 +228,7 @@ void ComputeIK::onNewSolution(const SolutionBase &s)
|
|||||||
ROS_WARN_STREAM_NAMED("ComputeIK", "Neither eef nor group are well defined");
|
ROS_WARN_STREAM_NAMED("ComputeIK", "Neither eef nor group are well defined");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
properties().property("timeout").setDefaultValue(jmg->getDefaultIKTimeout());
|
||||||
|
|
||||||
// extract target_pose
|
// extract target_pose
|
||||||
geometry_msgs::PoseStamped target_pose_msg = props.get<geometry_msgs::PoseStamped>("target_pose");
|
geometry_msgs::PoseStamped target_pose_msg = props.get<geometry_msgs::PoseStamped>("target_pose");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user