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 RVIZ_FPS_VIEW_CONTROLLER_H
00031 #define RVIZ_FPS_VIEW_CONTROLLER_H
00032
00033 #include "rviz/view_controller.h"
00034
00035 #include <OGRE/OgreVector3.h>
00036 #include <OGRE/OgreQuaternion.h>
00037
00038 namespace ogre_tools
00039 {
00040 class Shape;
00041 class SceneNode;
00042 }
00043
00044 namespace rviz
00045 {
00046
00051 class FPSViewController : public ViewController
00052 {
00053 public:
00054 FPSViewController(VisualizationManager* manager, const std::string& name, Ogre::SceneNode* target_scene_node);
00055 virtual ~FPSViewController();
00056
00057
00058 void yaw( float angle );
00059 void pitch( float angle );
00060 void move( float x, float y, float z );
00061
00062 virtual void handleMouseEvent(ViewportMouseEvent& evt);
00063 virtual void fromString(const std::string& str);
00064 virtual std::string toString();
00065
00066 virtual void lookAt( const Ogre::Vector3& point );
00067
00068 static std::string getClassNameStatic() { return "rviz::FPSViewController"; }
00069 virtual std::string getClassName() { return getClassNameStatic(); }
00070
00071
00072 protected:
00073 virtual void onActivate();
00074 virtual void onDeactivate();
00075 virtual void onUpdate(float dt, float ros_dt);
00076 virtual void onTargetFrameChanged(const Ogre::Vector3& old_reference_position, const Ogre::Quaternion& old_reference_orientation);
00077
00078 void setOrientation(const Ogre::Quaternion& orientation);
00079
00083 void normalizePitch();
00087 void normalizeYaw();
00088
00089 void updateCamera();
00090
00091 float yaw_;
00092 float pitch_;
00093 };
00094
00095 }
00096
00097 #endif // RVIZ_VIEW_CONTROLLER_H