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 #ifndef FPS_MOTION_VIEW_CONTROLLER
00031 #define FPS_MOTION_VIEW_CONTROLLER
00032 
00033 #include <OgreVector3.h>
00034 #include <OgreQuaternion.h>
00035 
00036 #include "rviz/frame_position_tracking_view_controller.h"
00037 
00038 using namespace rviz;
00039 
00040 namespace rviz
00041 {
00042 class FloatProperty;
00043 class BoolProperty;
00044 class SceneNode;
00045 class Shape;
00046 class VectorProperty;
00047 
00049 class FPSMotionViewController : public FramePositionTrackingViewController
00050 {
00051 Q_OBJECT
00052 public:
00053   FPSMotionViewController();
00054   virtual ~FPSMotionViewController();
00055 
00056   virtual void onInitialize();
00057 
00058   void yaw( float angle );
00059   void pitch( float angle );
00060   void move( float x, float y, float z );
00061   void fly( float x, float y, float z );
00062   void changeZ(float z );
00063 
00064   virtual void handleMouseEvent(ViewportMouseEvent& evt);
00065 
00066   virtual void lookAt( const Ogre::Vector3& point );
00067 
00068   virtual void reset();
00069 
00075   virtual void mimic( ViewController* source_view );
00076 
00077   virtual void update(float dt, float ros_dt);
00078 
00079   void setCamera( Ogre::Camera* source_camera ) { setPropertiesFromCamera(source_camera );};
00080 
00081 protected:
00082   virtual void onTargetFrameChanged(const Ogre::Vector3& old_reference_position, const Ogre::Quaternion& old_reference_orientation);
00083 
00084   void setPropertiesFromCamera( Ogre::Camera* source_camera );
00085 
00086   void updateCamera();
00087   void updateCamera(Ogre::Vector3& position, Ogre::Quaternion& orientation);
00088   Ogre::Quaternion getOrientation(); 
00089 
00090   FloatProperty* yaw_property_;                         
00091   FloatProperty* pitch_property_;                       
00092   VectorProperty* position_property_;
00093   BoolProperty* fly_property_;
00094 };
00095 
00096 } 
00097 
00098 #endif // FPS_MOTION_VIEW_CONTROLLER