68 , planning_display_(pdisplay)
70 , ui_(new
Ui::MotionPlanningUI())
71 , logger_(
moveit::getLogger(
"moveit.ros.motion_planning_frame"))
74 auto ros_node_abstraction =
context_->getRosNodeAbstraction().lock();
75 if (!ros_node_abstraction)
77 RCLCPP_INFO(logger_,
"Unable to lock weak_ptr from DisplayContext in MotionPlanningFrame constructor");
80 node_ = ros_node_abstraction->get_raw_node();
83 if (!node_->has_parameter(
"warehouse_host"))
84 node_->declare_parameter<std::string>(
"warehouse_host",
"127.0.0.1");
85 if (!node_->has_parameter(
"warehouse_plugin"))
86 node_->declare_parameter<std::string>(
"warehouse_plugin",
"warehouse_ros_mongo::MongoDatabaseConnection");
87 if (!node_->has_parameter(
"warehouse_port"))
88 node_->declare_parameter<
int>(
"warehouse_port", 33829);
92 ui_->shapes_combo_box->addItem(
"Box", shapes::BOX);
93 ui_->shapes_combo_box->addItem(
"Sphere", shapes::SPHERE);
94 ui_->shapes_combo_box->addItem(
"Cylinder", shapes::CYLINDER);
95 ui_->shapes_combo_box->addItem(
"Cone", shapes::CONE);
96 ui_->shapes_combo_box->addItem(
"Mesh from file", shapes::MESH);
97 ui_->shapes_combo_box->addItem(
"Mesh from URL", shapes::MESH);
98 setLocalSceneEdited(
false);
108 connect(
ui_->plan_button, SIGNAL(clicked()),
this, SLOT(planButtonClicked()));
109 connect(
ui_->execute_button, SIGNAL(clicked()),
this, SLOT(executeButtonClicked()));
110 connect(
ui_->plan_and_execute_button, SIGNAL(clicked()),
this, SLOT(planAndExecuteButtonClicked()));
111 connect(
ui_->stop_button, SIGNAL(clicked()),
this, SLOT(stopButtonClicked()));
112 connect(
ui_->start_state_combo_box, SIGNAL(activated(QString)),
this, SLOT(startStateTextChanged(QString)));
113 connect(
ui_->goal_state_combo_box, SIGNAL(activated(QString)),
this, SLOT(goalStateTextChanged(QString)));
114 connect(
ui_->planning_group_combo_box, SIGNAL(currentIndexChanged(QString)),
this,
115 SLOT(planningGroupTextChanged(QString)));
116 connect(
ui_->database_connect_button, SIGNAL(clicked()),
this, SLOT(databaseConnectButtonClicked()));
117 connect(
ui_->save_scene_button, SIGNAL(clicked()),
this, SLOT(saveSceneButtonClicked()));
118 connect(
ui_->save_query_button, SIGNAL(clicked()),
this, SLOT(saveQueryButtonClicked()));
119 connect(
ui_->delete_scene_button, SIGNAL(clicked()),
this, SLOT(deleteSceneButtonClicked()));
120 connect(
ui_->delete_query_button, SIGNAL(clicked()),
this, SLOT(deleteQueryButtonClicked()));
121 connect(
ui_->planning_scene_tree, SIGNAL(itemSelectionChanged()),
this, SLOT(planningSceneItemClicked()));
122 connect(
ui_->load_scene_button, SIGNAL(clicked()),
this, SLOT(loadSceneButtonClicked()));
123 connect(
ui_->load_query_button, SIGNAL(clicked()),
this, SLOT(loadQueryButtonClicked()));
124 connect(
ui_->allow_looking, SIGNAL(toggled(
bool)),
this, SLOT(allowLookingToggled(
bool)));
125 connect(
ui_->allow_replanning, SIGNAL(toggled(
bool)),
this, SLOT(allowReplanningToggled(
bool)));
126 connect(
ui_->allow_external_program, SIGNAL(toggled(
bool)),
this, SLOT(allowExternalProgramCommunication(
bool)));
127 connect(
ui_->planning_pipeline_combo_box, SIGNAL(currentIndexChanged(
int)),
this,
128 SLOT(planningPipelineIndexChanged(
int)));
129 connect(
ui_->planning_algorithm_combo_box, SIGNAL(currentIndexChanged(
int)),
this,
130 SLOT(planningAlgorithmIndexChanged(
int)));
131 connect(
ui_->clear_scene_button, SIGNAL(clicked()),
this, SLOT(clearScene()));
132 connect(
ui_->scene_scale, SIGNAL(valueChanged(
int)),
this, SLOT(sceneScaleChanged(
int)));
133 connect(
ui_->scene_scale, SIGNAL(sliderPressed()),
this, SLOT(sceneScaleStartChange()));
134 connect(
ui_->scene_scale, SIGNAL(sliderReleased()),
this, SLOT(sceneScaleEndChange()));
135 connect(
ui_->remove_object_button, SIGNAL(clicked()),
this, SLOT(removeSceneObject()));
136 connect(
ui_->object_x, SIGNAL(valueChanged(
double)),
this, SLOT(objectPoseValueChanged(
double)));
137 connect(
ui_->object_y, SIGNAL(valueChanged(
double)),
this, SLOT(objectPoseValueChanged(
double)));
138 connect(
ui_->object_z, SIGNAL(valueChanged(
double)),
this, SLOT(objectPoseValueChanged(
double)));
139 connect(
ui_->object_rx, SIGNAL(valueChanged(
double)),
this, SLOT(objectPoseValueChanged(
double)));
140 connect(
ui_->object_ry, SIGNAL(valueChanged(
double)),
this, SLOT(objectPoseValueChanged(
double)));
141 connect(
ui_->object_rz, SIGNAL(valueChanged(
double)),
this, SLOT(objectPoseValueChanged(
double)));
142 connect(
ui_->publish_current_scene_button, SIGNAL(clicked()),
this, SLOT(publishScene()));
143 connect(
ui_->collision_objects_list, SIGNAL(itemSelectionChanged()),
this, SLOT(selectedCollisionObjectChanged()));
144 connect(
ui_->collision_objects_list, SIGNAL(itemChanged(QListWidgetItem*)),
this,
145 SLOT(collisionObjectChanged(QListWidgetItem*)));
146 connect(
ui_->path_constraints_combo_box, SIGNAL(currentIndexChanged(
int)),
this,
147 SLOT(pathConstraintsIndexChanged(
int)));
148 connect(
ui_->clear_octomap_button, SIGNAL(clicked()),
this, SLOT(onClearOctomapClicked()));
149 connect(
ui_->planning_scene_tree, SIGNAL(itemChanged(QTreeWidgetItem*,
int)),
this,
150 SLOT(warehouseItemNameChanged(QTreeWidgetItem*,
int)));
151 connect(
ui_->reset_db_button, SIGNAL(clicked()),
this, SLOT(resetDbButtonClicked()));
153 connect(
ui_->add_object_button, &QPushButton::clicked,
this, &MotionPlanningFrame::addSceneObject);
154 connect(
ui_->shapes_combo_box, &QComboBox::currentTextChanged,
this, &MotionPlanningFrame::shapesComboBoxChanged);
155 connect(
ui_->export_scene_geometry_text_button, SIGNAL(clicked()),
this, SLOT(exportGeometryAsTextButtonClicked()));
156 connect(
ui_->import_scene_geometry_text_button, SIGNAL(clicked()),
this, SLOT(importGeometryFromTextButtonClicked()));
157 connect(
ui_->load_state_button, SIGNAL(clicked()),
this, SLOT(loadStateButtonClicked()));
158 connect(
ui_->save_start_state_button, SIGNAL(clicked()),
this, SLOT(saveStartStateButtonClicked()));
159 connect(
ui_->save_goal_state_button, SIGNAL(clicked()),
this, SLOT(saveGoalStateButtonClicked()));
160 connect(
ui_->set_as_start_state_button, SIGNAL(clicked()),
this, SLOT(setAsStartStateButtonClicked()));
161 connect(
ui_->set_as_goal_state_button, SIGNAL(clicked()),
this, SLOT(setAsGoalStateButtonClicked()));
162 connect(
ui_->remove_state_button, SIGNAL(clicked()),
this, SLOT(removeStateButtonClicked()));
163 connect(
ui_->clear_states_button, SIGNAL(clicked()),
this, SLOT(clearStatesButtonClicked()));
164 connect(
ui_->approximate_ik, SIGNAL(stateChanged(
int)),
this, SLOT(approximateIKChanged(
int)));
166 connect(
ui_->detect_objects_button, SIGNAL(clicked()),
this, SLOT(detectObjectsButtonClicked()));
167 connect(
ui_->pick_button, SIGNAL(clicked()),
this, SLOT(pickObjectButtonClicked()));
168 connect(
ui_->place_button, SIGNAL(clicked()),
this, SLOT(placeObjectButtonClicked()));
169 connect(
ui_->detected_objects_list, SIGNAL(itemSelectionChanged()),
this, SLOT(selectedDetectedObjectChanged()));
170 connect(
ui_->detected_objects_list, SIGNAL(itemChanged(QListWidgetItem*)),
this,
171 SLOT(detectedObjectChanged(QListWidgetItem*)));
172 connect(
ui_->support_surfaces_list, SIGNAL(itemSelectionChanged()),
this, SLOT(selectedSupportSurfaceChanged()));
174 connect(
ui_->tabWidget, SIGNAL(currentChanged(
int)),
this, SLOT(tabChanged(
int)));
177 connect(
ui_->database_host, SIGNAL(textChanged(QString)),
this, SIGNAL(
configChanged()));
178 connect(
ui_->database_port, SIGNAL(valueChanged(
int)),
this, SIGNAL(
configChanged()));
180 connect(
ui_->planning_time, SIGNAL(valueChanged(
double)),
this, SIGNAL(
configChanged()));
181 connect(
ui_->planning_attempts, SIGNAL(valueChanged(
int)),
this, SIGNAL(
configChanged()));
182 connect(
ui_->velocity_scaling_factor, SIGNAL(valueChanged(
double)),
this, SIGNAL(
configChanged()));
183 connect(
ui_->acceleration_scaling_factor, SIGNAL(valueChanged(
double)),
this, SIGNAL(
configChanged()));
185 connect(
ui_->allow_replanning, SIGNAL(stateChanged(
int)),
this, SIGNAL(
configChanged()));
186 connect(
ui_->allow_looking, SIGNAL(stateChanged(
int)),
this, SIGNAL(
configChanged()));
187 connect(
ui_->allow_external_program, SIGNAL(stateChanged(
int)),
this, SIGNAL(
configChanged()));
188 connect(
ui_->use_cartesian_path, SIGNAL(stateChanged(
int)),
this, SIGNAL(
configChanged()));
189 connect(
ui_->collision_aware_ik, SIGNAL(stateChanged(
int)),
this, SIGNAL(
configChanged()));
190 connect(
ui_->approximate_ik, SIGNAL(stateChanged(
int)),
this, SIGNAL(
configChanged()));
192 connect(
ui_->wcenter_x, SIGNAL(valueChanged(
double)),
this, SIGNAL(
configChanged()));
193 connect(
ui_->wcenter_y, SIGNAL(valueChanged(
double)),
this, SIGNAL(
configChanged()));
194 connect(
ui_->wcenter_z, SIGNAL(valueChanged(
double)),
this, SIGNAL(
configChanged()));
195 connect(
ui_->wsize_x, SIGNAL(valueChanged(
double)),
this, SIGNAL(
configChanged()));
196 connect(
ui_->wsize_y, SIGNAL(valueChanged(
double)),
this, SIGNAL(
configChanged()));
197 connect(
ui_->wsize_z, SIGNAL(valueChanged(
double)),
this, SIGNAL(
configChanged()));
199 QShortcut* copy_object_shortcut =
new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_C),
ui_->collision_objects_list);
200 connect(copy_object_shortcut, SIGNAL(activated()),
this, SLOT(copySelectedCollisionObject()));
202 ui_->reset_db_button->hide();
203 ui_->background_job_progress->hide();
204 ui_->background_job_progress->setMaximum(0);
206 ui_->tabWidget->setCurrentIndex(1);
208 known_collision_objects_version_ = 0;
212 object_recognition_client_ = rclcpp_action::create_client<object_recognition_msgs::action::ObjectRecognition>(
215 if (object_recognition_client_)
217 if (!object_recognition_client_->wait_for_action_server(std::chrono::seconds(3)))
220 object_recognition_client_.reset();