UserCamera.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2015 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 #ifndef _GAZEBO_USERCAMERA_HH_
18 #define _GAZEBO_USERCAMERA_HH_
19 
20 #include <string>
21 #include <vector>
22 
26 #include "gazebo/util/system.hh"
27 
28 namespace gazebo
29 {
30  class UserCameraPrivate;
31 
32  namespace rendering
33  {
36 
40  {
44  public: UserCamera(const std::string &_name, ScenePtr _scene);
45 
47  public: virtual ~UserCamera();
48 
51  public: void Load(sdf::ElementPtr _sdf);
52 
54  public: void Load();
55 
57  public: void Init();
58 
60  public: virtual void Update();
61 
63  public: virtual void PostRender();
64 
66  public: void Fini();
67 
70  public: virtual void SetWorldPose(const math::Pose &_pose);
71 
74  public: void HandleMouseEvent(const common::MouseEvent &_evt);
75 
78  public: void HandleKeyPressEvent(const std::string &_key);
79 
82  public: void HandleKeyReleaseEvent(const std::string &_key);
83 
86  public: void SetViewController(const std::string &_type);
87 
91  public: void SetViewController(const std::string &_type,
92  const math::Vector3 &_pos);
93 
96  public: std::string GetViewControllerTypeString();
97 
101  public: void Resize(unsigned int _w, unsigned int _h);
102 
108  public: void SetViewportDimensions(float _x, float _y,
109  float _w, float _h);
110 
113  public: float GetAvgFPS() const;
114 
117  public: unsigned int GetTriangleCount() const;
118 
121  public: void MoveToVisual(VisualPtr _visual);
122 
123  // Doxygen automatically pulls in the correct documentation.
124  public: virtual bool MoveToPosition(const math::Pose &_pose,
125  double _time);
126 
129  public: void MoveToVisual(const std::string &_visualName);
130 
135  public: virtual void SetRenderTarget(Ogre::RenderTarget *_target);
136 
142  public: void EnableViewController(bool _value) const;
143 
149  public: VisualPtr GetVisual(const math::Vector2i &_mousePos,
150  std::string &_mod);
151 
154  public: VisualPtr GetVisual(const math::Vector2i &_mousePos) const;
155 
158  public: void SetFocalPoint(const math::Vector3 &_pt);
159 
160  // Documentation inherited
161  public: virtual unsigned int GetImageWidth() const;
162 
163  // Documentation inherited
164  public: virtual unsigned int GetImageHeight() const;
165 
168  public: bool IsCameraSetInWorldFile();
169 
172  public: void SetUseSDFPose(bool _value);
173 
178  public: void SetJoyTwistControl(bool _value);
179 
184  public: void SetJoyPoseControl(bool _value);
185 
197  protected: virtual bool AttachToVisualImpl(VisualPtr _visual,
198  bool _inheritOrientation, double _minDist = 0,
199  double _maxDist = 0);
200 
201  // Documentation inherited.
202  protected: virtual void AnimationComplete();
203 
209  protected: virtual bool TrackVisualImpl(VisualPtr _visual);
210 
211 
213  private: void ToggleShowVisual();
214 
218  private: void ShowVisual(bool _show);
219 
222  private: void OnMoveToVisualComplete();
223 
228  private: void OnJoyTwist(ConstJoystickPtr &_msg);
229 
234  private: void OnJoyPose(ConstPosePtr &_msg);
235 
238  private: UserCameraPrivate *dataPtr;
239  };
241  }
242 }
243 #endif
Basic camera sensor.
Definition: Camera.hh:78
Generic description of a mouse event.
Definition: MouseEvent.hh:32
Encapsulates a position and rotation in three space.
Definition: Pose.hh:40
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:43
Private data for the UserCamera class.
Definition: UserCameraPrivate.hh:26
Generic integer x, y vector.
Definition: Vector2i.hh:39
A camera used for user visualization of a scene.
Definition: UserCamera.hh:39
boost::shared_ptr< Scene > ScenePtr
Definition: RenderTypes.hh:74
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
boost::shared_ptr< Visual > VisualPtr
Definition: RenderTypes.hh:102
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:48