39#include <rviz_common/properties/int_property.hpp>
40#include <rviz_common/properties/float_property.hpp>
41#include <rviz_common/properties/string_property.hpp>
49 :
rviz_common::properties::PropertyTreeWidget(parent)
51 property_tree_model_ =
nullptr;
56 delete property_tree_model_;
68 group_name_ = group_name;
70 if (property_tree_model_)
71 delete property_tree_model_;
72 property_tree_model_ =
nullptr;
78 lvalue = value.toLong(&ok);
85 dvalue = value.toDouble(&ok);
89rviz_common::properties::Property* MotionPlanningParamWidget::createPropertyTree()
91 if (planner_id_.empty())
93 const std::map<std::string, std::string>& params = move_group_->getPlannerParams(planner_id_, group_name_);
95 auto root =
new rviz_common::properties::Property(QString::fromStdString(planner_id_ +
" parameters"));
96 for (
const std::pair<const std::string, std::string>& param : params)
98 const QString key = QString::fromStdString(param.first);
99 const QString value = QString::fromStdString(param.second);
105 new rviz_common::properties::IntProperty(key, value_long, QString(), root, SLOT(changedValue()),
this);
109 new rviz_common::properties::FloatProperty(key, value_double, QString(), root, SLOT(changedValue()),
this);
112 new rviz_common::properties::StringProperty(key, value, QString(), root, SLOT(changedValue()),
this);
117void MotionPlanningParamWidget::changedValue()
121 rviz_common::properties::Property* source = qobject_cast<rviz_common::properties::Property*>(QObject::sender());
122 std::map<std::string, std::string> params;
123 params[source->getName().toStdString()] = source->getValue().toString().toStdString();
124 move_group_->setPlannerParams(planner_id_, group_name_, params);
129 planner_id_ = planner_id;
133 rviz_common::properties::PropertyTreeModel* old_model = property_tree_model_;
134 rviz_common::properties::Property* root = createPropertyTree();
135 property_tree_model_ = root ?
new rviz_common::properties::PropertyTreeModel(root) :
nullptr;
136 setModel(property_tree_model_);
Simple interface to MoveIt components.
bool tryLexicalConvert(const QString &value, long &lvalue)