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 #ifndef POINT_HEAD_VIEW_CONTROLLER_H_
00031 #define POINT_HEAD_VIEW_CONTROLLER_H_
00032
00033 #include <ros/ros.h>
00034
00035 #include <pr2_controllers_msgs/PointHeadAction.h>
00036
00037 #include <actionlib/client/simple_action_client.h>
00038
00039 #include <rviz/view_controller.h>
00040 #include <rviz/image/ros_image_texture.h>
00041 #include <rviz/viewport_mouse_event.h>
00042
00043 #include <OGRE/OgreCamera.h>
00044
00045 #define DEBUG_DISPLAY
00046
00047 namespace pr2_interactive_manipulation
00048 {
00049
00050
00051
00052
00053
00054 class PointHeadViewController : public rviz::ViewController
00055 {
00056 public:
00057 PointHeadViewController( rviz::ROSImageTexture &texture, rviz::VisualizationManager* manager, const std::string& name);
00058 virtual ~PointHeadViewController();
00059
00060 virtual void handleMouseEvent(rviz::ViewportMouseEvent& evt);
00061
00062
00063 virtual void fromString(const std::string& str) {};
00064 virtual std::string toString() { return ""; }
00065
00066 virtual void lookAt( const Ogre::Vector3& point );
00067 virtual std::string getClassName() { return "pr2_interactive_manipulation::PointHeadViewController"; }
00068
00069 const std::string& getTopic() { return topic_; }
00070 void setTopic(const std::string& topic);
00071
00072 protected:
00073 virtual void onActivate() {};
00074 virtual void onDeactivate() {};
00075 virtual void onReferenceFrameChanged(const Ogre::Vector3& old_reference_position, const Ogre::Quaternion& old_reference_orientation) {};
00076
00077 #ifdef DEBUG_DISPLAY
00078 ros::Publisher marker_pub_;
00079 #endif
00080
00081 rviz::ROSImageTexture &texture_;
00082
00083 typedef actionlib::SimpleActionClient<pr2_controllers_msgs::PointHeadAction> PointHeadActionClient;
00084 PointHeadActionClient *point_head_action_client_;
00085
00086 std::string topic_;
00087 };
00088
00089 }
00090
00091 #endif