Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef MOVEIT_MOTION_PLANNING_RVIZ_PLUGIN_MOTION_PLANNING_FRAME_
00033 #define MOVEIT_MOTION_PLANNING_RVIZ_PLUGIN_MOTION_PLANNING_FRAME_
00034
00035 #include <QWidget>
00036 #include <QTreeWidgetItem>
00037 #include <QListWidgetItem>
00038
00039 #ifndef Q_MOC_RUN
00040 #include <moveit/move_group_interface/move_group.h>
00041 #include <moveit/planning_scene_monitor/planning_scene_monitor.h>
00042 #include <moveit/robot_interaction/robot_interaction.h>
00043 #include <interactive_markers/interactive_marker_server.h>
00044 #include <rviz/default_plugin/interactive_markers/interactive_marker.h>
00045 #endif
00046
00047 #include <moveit_msgs/MotionPlanRequest.h>
00048 #include <map>
00049 #include <string>
00050
00051 namespace rviz
00052 {
00053 class DisplayContext;
00054 }
00055
00056 namespace Ui
00057 {
00058 class MotionPlanningUI;
00059 }
00060
00061 namespace moveit_warehouse
00062 {
00063 class PlanningSceneStorage;
00064 class ConstraintsStorage;
00065 class RobotStateStorage;
00066 }
00067
00068 namespace moveit_rviz_plugin
00069 {
00070 class MotionPlanningDisplay;
00071
00072 class MotionPlanningFrame : public QWidget
00073 {
00074 friend class MotionPlanningDisplay;
00075 Q_OBJECT
00076
00077 public:
00078 MotionPlanningFrame(MotionPlanningDisplay *pdisplay, rviz::DisplayContext *context, QWidget *parent = 0);
00079 ~MotionPlanningFrame();
00080
00081 void changePlanningGroup();
00082 void enable();
00083 void disable();
00084 void sceneUpdate(planning_scene_monitor::PlanningSceneMonitor::SceneUpdateType update_type);
00085
00086 protected:
00087 static const int ITEM_TYPE_SCENE = 1;
00088 static const int ITEM_TYPE_QUERY = 2;
00089
00090 void constructPlanningRequest(moveit_msgs::MotionPlanRequest &mreq);
00091
00092 void updateSceneMarkers(float wall_dt, float ros_dt);
00093
00094 MotionPlanningDisplay *planning_display_;
00095 rviz::DisplayContext* context_;
00096 Ui::MotionPlanningUI *ui_;
00097
00098 boost::shared_ptr<moveit::planning_interface::MoveGroup> move_group_;
00099
00100 boost::shared_ptr<moveit::planning_interface::MoveGroup::Plan> current_plan_;
00101 boost::shared_ptr<moveit_warehouse::PlanningSceneStorage> planning_scene_storage_;
00102 boost::shared_ptr<moveit_warehouse::ConstraintsStorage> constraints_storage_;
00103 boost::shared_ptr<moveit_warehouse::RobotStateStorage> robot_state_storage_;
00104
00105 boost::shared_ptr<rviz::InteractiveMarker> scene_marker_;
00106
00107 typedef std::map<std::string, moveit_msgs::RobotState> RobotStateMap;
00108 typedef std::pair<std::string, moveit_msgs::RobotState> RobotStatePair;
00109 RobotStateMap robot_states_;
00110
00111 private Q_SLOTS:
00112
00113
00114 void databaseConnectButtonClicked();
00115 void publishSceneButtonClicked();
00116 void planningAlgorithmIndexChanged(int index);
00117 void resetDbButtonClicked();
00118 void approximateIKChanged(int state);
00119
00120
00121 void planButtonClicked();
00122 void executeButtonClicked();
00123 void planAndExecuteButtonClicked();
00124 void allowReplanningToggled(bool checked);
00125 void allowLookingToggled(bool checked);
00126 void pathConstraintsIndexChanged(int index);
00127 void useStartStateButtonClicked();
00128 void useGoalStateButtonClicked();
00129
00130
00131 void importFileButtonClicked();
00132 void importUrlButtonClicked();
00133 void clearSceneButtonClicked();
00134 void sceneScaleChanged(int value);
00135 void sceneScaleStartChange();
00136 void sceneScaleEndChange();
00137 void removeObjectButtonClicked();
00138 void selectedCollisionObjectChanged();
00139 void objectPoseValueChanged(double value);
00140 void collisionObjectChanged(QListWidgetItem *item);
00141 void imProcessFeedback(visualization_msgs::InteractiveMarkerFeedback &feedback);
00142 void copySelectedCollisionObject();
00143 void exportAsTextButtonClicked();
00144 void importFromTextButtonClicked();
00145
00146
00147 void saveSceneButtonClicked();
00148 void planningSceneItemClicked();
00149 void saveQueryButtonClicked();
00150 void deleteSceneButtonClicked();
00151 void deleteQueryButtonClicked();
00152 void loadSceneButtonClicked();
00153 void loadQueryButtonClicked();
00154 void warehouseItemNameChanged(QTreeWidgetItem *item, int column);
00155
00156
00157 void loadStateButtonClicked();
00158 void saveStartStateButtonClicked();
00159 void saveGoalStateButtonClicked();
00160 void removeStateButtonClicked();
00161 void clearStatesButtonClicked();
00162 void setAsStartStateButtonClicked();
00163 void setAsGoalStateButtonClicked();
00164
00165
00166 void tabChanged(int index);
00167
00168 private:
00169
00170
00171 void computeDatabaseConnectButtonClicked();
00172 void computeDatabaseConnectButtonClickedHelper(int mode);
00173 void computeResetDbButtonClicked(const std::string &db);
00174 void populatePlannersList(const moveit_msgs::PlannerInterfaceDescription &desc);
00175
00176
00177 void computePlanButtonClicked();
00178 void computeExecuteButtonClicked();
00179 void computePlanAndExecuteButtonClicked();
00180 void computePlanAndExecuteButtonClickedDisplayHelper();
00181 void populateConstraintsList();
00182 void populateConstraintsList(const std::vector<std::string> &constr);
00183 void configureForPlanning();
00184 void configureWorkspace();
00185 void updateQueryStateHelper(robot_state::RobotState &state, const std::string &v);
00186 void fillStateSelectionOptions();
00187
00188
00189 void addObject(const collision_detection::WorldPtr &world, const std::string &id,
00190 const shapes::ShapeConstPtr &shape, const Eigen::Affine3d &pose);
00191 void updateCollisionObjectPose(bool update_marker_position);
00192 void createSceneInteractiveMarker();
00193 void renameCollisionObject(QListWidgetItem *item);
00194 void attachDetachCollisionObject(QListWidgetItem *item);
00195 void populateCollisionObjectsList();
00196 void computeImportFromText(const std::string &path);
00197 void computeExportAsText(const std::string &path);
00198
00199
00200 void computeSaveSceneButtonClicked();
00201 void computeSaveQueryButtonClicked(const std::string &scene, const std::string &query_name);
00202 void computeLoadSceneButtonClicked();
00203 void computeLoadQueryButtonClicked();
00204 void populatePlanningSceneTreeView();
00205 void computeDeleteSceneButtonClicked();
00206 void computeDeleteQueryButtonClicked();
00207 void computeDeleteQueryButtonClickedHelper(QTreeWidgetItem *s);
00208 void checkPlanningSceneTreeEnabledButtons();
00209
00210
00211
00212 void saveRobotStateButtonClicked(const robot_state::RobotState &state);
00213 void populateRobotStatesList();
00214
00215
00216 void changePlanningGroupHelper();
00217 void importResource(const std::string &path);
00218
00219
00220
00221 void setItemSelectionInList(const std::string &item_name, bool selection, QListWidget *list);
00222
00223 ros::NodeHandle nh_;
00224 ros::Publisher planning_scene_publisher_;
00225 ros::Publisher planning_scene_world_publisher_;
00226
00227 collision_detection::CollisionWorld::ObjectConstPtr scaled_object_;
00228
00229 std::vector< std::pair<std::string, bool> > known_collision_objects_;
00230 long unsigned int known_collision_objects_version_;
00231 bool first_time_;
00232
00233 };
00234
00235 }
00236
00237 #endif