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