40 #include <QTreeWidgetItem>
41 #include <QListWidgetItem>
52 #include <interactive_markers/interactive_marker_server.hpp>
53 #include <rviz_default_plugins/displays/interactive_markers/interactive_marker.hpp>
54 #include <moveit_msgs/msg/motion_plan_request.hpp>
55 #include <rclcpp_action/rclcpp_action.hpp>
56 #include <object_recognition_msgs/action/object_recognition.hpp>
58 #include <std_msgs/msg/bool.hpp>
59 #include <std_msgs/msg/empty.hpp>
60 #include <std_srvs/srv/empty.hpp>
61 #include <rclcpp/logger.hpp>
75 class MotionPlanningUI;
87 class MotionPlanningDisplay;
88 class MotionPlanningFrameJointsWidget;
92 static const std::string TAB_CONTEXT =
"Context";
93 static const std::string TAB_PLANNING =
"Planning";
94 static const std::string TAB_MANIPULATION =
"Manipulation";
95 static const std::string TAB_OBJECTS =
"Scene Objects";
96 static const std::string TAB_SCENES =
"Stored Scenes";
97 static const std::string TAB_STATES =
"Stored States";
98 static const std::string TAB_STATUS =
"Status";
100 static const double LARGE_MESH_THRESHOLD = 10.0;
131 Ui::MotionPlanningUI*
ui_;
143 std::shared_ptr<rviz_default_plugins::displays::InteractiveMarker>
scene_marker_;
158 void databaseConnectButtonClicked();
159 void planningPipelineIndexChanged(
int index);
160 void planningAlgorithmIndexChanged(
int index);
161 void resetDbButtonClicked();
162 void approximateIKChanged(
int state);
165 bool computeCartesianPlan();
166 bool computeJointSpacePlan();
167 void planButtonClicked();
168 void executeButtonClicked();
169 void planAndExecuteButtonClicked();
170 void stopButtonClicked();
171 void allowReplanningToggled(
bool checked);
172 void allowLookingToggled(
bool checked);
173 void allowExternalProgramCommunication(
bool enable);
174 void pathConstraintsIndexChanged(
int index);
175 void onNewPlanningSceneState();
176 void startStateTextChanged(
const QString& start_state);
177 void goalStateTextChanged(
const QString& goal_state);
178 void planningGroupTextChanged(
const QString& planning_group);
179 void onClearOctomapClicked();
184 void publishSceneIfNeeded();
185 void setLocalSceneEdited(
bool dirty =
true);
186 bool isLocalSceneDirty()
const;
187 void sceneScaleChanged(
int value);
188 void sceneScaleStartChange();
189 void sceneScaleEndChange();
190 void shapesComboBoxChanged(
const QString&
text);
191 void addSceneObject();
192 void removeSceneObject();
193 void selectedCollisionObjectChanged();
194 void objectPoseValueChanged(
double value);
195 void collisionObjectChanged(QListWidgetItem* item);
196 void imProcessFeedback(visualization_msgs::msg::InteractiveMarkerFeedback& feedback);
197 void copySelectedCollisionObject();
198 void exportGeometryAsTextButtonClicked();
199 void importGeometryFromTextButtonClicked();
202 void saveSceneButtonClicked();
203 void planningSceneItemClicked();
204 void saveQueryButtonClicked();
205 void deleteSceneButtonClicked();
206 void deleteQueryButtonClicked();
207 void loadSceneButtonClicked();
208 void loadQueryButtonClicked();
209 void warehouseItemNameChanged(QTreeWidgetItem* item,
int column);
212 void loadStateButtonClicked();
213 void saveStartStateButtonClicked();
214 void saveGoalStateButtonClicked();
215 void removeStateButtonClicked();
216 void clearStatesButtonClicked();
217 void setAsStartStateButtonClicked();
218 void setAsGoalStateButtonClicked();
221 void detectObjectsButtonClicked();
222 void pickObjectButtonClicked();
223 void placeObjectButtonClicked();
224 void selectedDetectedObjectChanged();
225 void detectedObjectChanged(QListWidgetItem* item);
226 void selectedSupportSurfaceChanged();
229 void tabChanged(
int index);
233 void computeDatabaseConnectButtonClicked();
234 void computeDatabaseConnectButtonClickedHelper(
int mode);
235 void computeResetDbButtonClicked(
const std::string& db);
236 void populatePlannersList(
const std::vector<moveit_msgs::msg::PlannerInterfaceDescription>& desc);
237 void populatePlannerDescription(
const moveit_msgs::msg::PlannerInterfaceDescription& desc);
240 void computePlanButtonClicked();
241 void computeExecuteButtonClicked();
242 void computePlanAndExecuteButtonClicked();
243 void computePlanAndExecuteButtonClickedDisplayHelper();
244 void computeStopButtonClicked();
245 void onFinishedExecution(
bool success);
246 void populateConstraintsList();
247 void populateConstraintsList(
const std::vector<std::string>& constr);
248 void configureForPlanning();
249 void configureWorkspace();
251 void fillStateSelectionOptions();
252 void fillPlanningGroupOptions();
253 void startStateTextChangedExec(
const std::string& start_state);
254 void goalStateTextChangedExec(
const std::string& goal_state);
257 void updateCollisionObjectPose(
bool update_marker_position);
258 void createSceneInteractiveMarker();
259 void renameCollisionObject(QListWidgetItem* item);
260 void attachDetachCollisionObject(QListWidgetItem* item);
261 void populateCollisionObjectsList();
262 void computeImportGeometryFromText(
const std::string& path);
263 void computeExportGeometryAsText(
const std::string& path);
264 visualization_msgs::msg::InteractiveMarker
268 void computeSaveSceneButtonClicked();
269 void computeSaveQueryButtonClicked(
const std::string& scene,
const std::string& query_name);
270 void computeLoadSceneButtonClicked();
271 void computeLoadQueryButtonClicked();
272 void populatePlanningSceneTreeView();
273 void computeDeleteSceneButtonClicked();
274 void computeDeleteQueryButtonClicked();
275 void computeDeleteQueryButtonClickedHelper(QTreeWidgetItem* s);
276 void checkPlanningSceneTreeEnabledButtons();
280 void populateRobotStatesList();
283 void processDetectedObjects();
284 void updateDetectedObjectsList(
const std::vector<std::string>& object_ids);
285 void publishTables();
286 void updateSupportSurfacesList();
288 std::map<std::string, std::string> pick_object_name_;
289 std::string place_object_name_;
290 std::vector<geometry_msgs::msg::PoseStamped> place_poses_;
293 void triggerObjectDetection();
295 std::string support_surface_name_;
297 std::string selected_object_name_;
298 std::string selected_support_surface_name_;
300 rclcpp_action::Client<object_recognition_msgs::action::ObjectRecognition>::SharedPtr object_recognition_client_;
301 void listenDetectedObjects(
const object_recognition_msgs::msg::RecognizedObjectArray::ConstSharedPtr& msg);
302 rclcpp::Subscription<object_recognition_msgs::msg::RecognizedObjectArray>::SharedPtr object_recognition_subscriber_;
304 rclcpp::Subscription<std_msgs::msg::Empty>::SharedPtr plan_subscriber_;
305 rclcpp::Subscription<std_msgs::msg::Empty>::SharedPtr execute_subscriber_;
306 rclcpp::Subscription<std_msgs::msg::Empty>::SharedPtr stop_subscriber_;
307 rclcpp::Subscription<std_msgs::msg::Empty>::SharedPtr update_start_state_subscriber_;
308 rclcpp::Subscription<std_msgs::msg::Empty>::SharedPtr update_goal_state_subscriber_;
309 rclcpp::Subscription<moveit_msgs::msg::RobotState>::SharedPtr update_custom_start_state_subscriber_;
310 rclcpp::Subscription<moveit_msgs::msg::RobotState>::SharedPtr update_custom_goal_state_subscriber_;
313 void changePlanningGroupHelper();
314 shapes::ShapePtr loadMeshResource(
const std::string& url);
315 void loadStoredStates(
const std::string& pattern);
317 void remotePlanCallback(
const std_msgs::msg::Empty::ConstSharedPtr& msg);
318 void remoteExecuteCallback(
const std_msgs::msg::Empty::ConstSharedPtr& msg);
319 void remoteStopCallback(
const std_msgs::msg::Empty::ConstSharedPtr& msg);
320 void remoteUpdateStartStateCallback(
const std_msgs::msg::Empty::ConstSharedPtr& msg);
321 void remoteUpdateGoalStateCallback(
const std_msgs::msg::Empty::ConstSharedPtr& msg);
322 void remoteUpdateCustomStartStateCallback(
const moveit_msgs::msg::RobotState::ConstSharedPtr& msg);
323 void remoteUpdateCustomGoalStateCallback(
const moveit_msgs::msg::RobotState::ConstSharedPtr& msg);
326 void setItemSelectionInList(
const std::string& item_name,
bool selection, QListWidget* list);
328 rclcpp::Node::SharedPtr node_;
329 rclcpp::Logger logger_;
330 rclcpp::Publisher<moveit_msgs::msg::PlanningScene>::SharedPtr planning_scene_publisher_;
331 rclcpp::Publisher<moveit_msgs::msg::PlanningSceneWorld>::SharedPtr planning_scene_world_publisher_;
335 EigenSTL::vector_Isometry3d scaled_object_shape_poses_;
337 std::vector<std::pair<std::string, bool> > known_collision_objects_;
338 long unsigned int known_collision_objects_version_;
340 rclcpp::Client<std_srvs::srv::Empty>::SharedPtr clear_octomap_service_client_;
World::ObjectConstPtr ObjectConstPtr
Representation of a robot's state. This includes position, velocity, acceleration and effort.
moveit_warehouse::PlanningSceneStoragePtr planning_scene_storage_
void initFromMoveGroupNS()
static const int ITEM_TYPE_SCENE
std::shared_ptr< rviz_default_plugins::displays::InteractiveMarker > scene_marker_
rviz_common::DisplayContext * context_
std::pair< std::string, moveit_msgs::msg::RobotState > RobotStatePair
Ui::MotionPlanningUI * ui_
RobotStateMap robot_states_
~MotionPlanningFrame() override
void updateExternalCommunication()
void changePlanningGroup()
static const int ITEM_TYPE_QUERY
moveit::planning_interface::MoveGroupInterface::PlanPtr current_plan_
void updateSceneMarkers(double wall_dt, double ros_dt)
MotionPlanningFrameJointsWidget * joints_tab_
std::vector< moveit_msgs::msg::PlannerInterfaceDescription > planner_descriptions_
moveit_warehouse::ConstraintsStoragePtr constraints_storage_
std::string default_planning_pipeline_
moveit::planning_interface::MoveGroupInterfacePtr move_group_
std::map< std::string, moveit_msgs::msg::RobotState > RobotStateMap
void constructPlanningRequest(moveit_msgs::msg::MotionPlanRequest &mreq)
void sceneUpdate(planning_scene_monitor::PlanningSceneMonitor::SceneUpdateType update_type)
MotionPlanningDisplay * planning_display_
MotionPlanningFrame(const MotionPlanningFrame &)=delete
moveit_warehouse::RobotStateStoragePtr robot_state_storage_
std::map< std::string, Eigen::Isometry3d, std::less< std::string >, Eigen::aligned_allocator< std::pair< const std::string, Eigen::Isometry3d > > > FixedTransformsMap
Map frame names to the transformation matrix that can transform objects from the frame name to the pl...
const std::string OBJECT_RECOGNITION_ACTION
MOVEIT_CLASS_FORWARD(PlanningSceneStorage)
moveit_msgs::msg::MotionPlanRequest MotionPlanRequest