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
00033
00034
00035
00036
00037
00038
00039
00040
00041 #ifndef PR2_MOVEIT_TUTORIALS_INTERACTIVITY_SRC_IMARKER_H_
00042 #define PR2_MOVEIT_TUTORIALS_INTERACTIVITY_SRC_IMARKER_H_
00043
00044 #include <interactive_markers/interactive_marker_server.h>
00045 #include <Eigen/Geometry>
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057 class IMarker
00058 {
00059 public:
00060
00061 enum Dof { BOTH, POS, ORIENT };
00062
00064 IMarker(interactive_markers::InteractiveMarkerServer& server,
00065 const std::string& name,
00066 const std::string& frame_id = "/base_footprint",
00067 boost::function<void (const visualization_msgs::InteractiveMarkerFeedbackConstPtr &)> callback = printFeedback,
00068 Dof dof = BOTH) :
00069 imarker_()
00070 {
00071 initialize(server, name, Eigen::Vector3d(0,0,0), Eigen::Quaterniond(1,0,0,0), frame_id, callback, dof);
00072 }
00073
00075 IMarker(interactive_markers::InteractiveMarkerServer& server,
00076 const std::string& name,
00077 const Eigen::Affine3d& pose,
00078 const std::string& frame_id = "/base_footprint",
00079 boost::function<void (const visualization_msgs::InteractiveMarkerFeedbackConstPtr &)> callback = printFeedback,
00080 Dof dof = BOTH) :
00081 imarker_()
00082 {
00083 Eigen::Quaterniond q(pose.linear());
00084 Eigen::Vector3d p = pose.translation();
00085
00086 initialize(server, name, p, q, frame_id, callback, dof);
00087 }
00088
00090 IMarker(interactive_markers::InteractiveMarkerServer& server,
00091 const std::string& name,
00092 const Eigen::Vector3d& position,
00093 const Eigen::Quaterniond& orientation,
00094 const std::string& frame_id = "/base_footprint",
00095 boost::function<void (const visualization_msgs::InteractiveMarkerFeedbackConstPtr &)> callback = printFeedback,
00096 Dof dof = BOTH) :
00097 imarker_()
00098 {
00099 initialize(server, name, position, orientation, frame_id, callback, dof);
00100 }
00101
00103 IMarker(interactive_markers::InteractiveMarkerServer& server,
00104 const std::string& name,
00105 const Eigen::Vector3d& position,
00106 const std::string& frame_id = "/base_footprint",
00107 boost::function<void (const visualization_msgs::InteractiveMarkerFeedbackConstPtr &)> callback = printFeedback,
00108 Dof dof = BOTH) :
00109 imarker_()
00110 {
00111 initialize(server, name, position, Eigen::Quaterniond(1,0,0,0), frame_id, callback, dof);
00112 }
00113
00115 void move(const Eigen::Affine3d& pose);
00116
00118 static void printFeedback(const visualization_msgs::InteractiveMarkerFeedbackConstPtr &);
00119
00120 private:
00121
00122
00123 void initialize(
00124 interactive_markers::InteractiveMarkerServer& server,
00125 const std::string& name,
00126 const Eigen::Vector3d& position,
00127 const Eigen::Quaterniond& orientation,
00128 const std::string& frame_id,
00129 boost::function<void (const visualization_msgs::InteractiveMarkerFeedbackConstPtr &)> callback,
00130 Dof dof);
00131
00132 enum Axis { X, Y, Z };
00133 visualization_msgs::Marker makeAxisCyl( Axis axis );
00134 visualization_msgs::Marker makeBall();
00135 void makeBallControl();
00136 void makeAxisControl();
00137
00138 visualization_msgs::InteractiveMarker imarker_;
00139 interactive_markers::InteractiveMarkerServer* server_;
00140 };
00141
00142 #endif // PR2_MOVEIT_TUTORIALS_INTERACTIVITY_SRC_IMARKER_H_