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  {
46  public: UserCamera(const std::string &_name, ScenePtr _scene,
47  bool _stereoEnabled = false);
48 
50  public: virtual ~UserCamera();
51 
54  public: void Load(sdf::ElementPtr _sdf);
55 
56  // Documentation inherited
57  public: virtual void SetClipDist(float _near, float _far);
58 
60  public: void Load();
61 
63  public: void Init();
64 
66  public: virtual void Update();
67 
69  public: virtual void PostRender();
70 
72  public: void Fini();
73 
76  public: virtual void SetWorldPose(const math::Pose &_pose);
77 
81  public: void SetDefaultPose(const math::Pose &_pose);
82 
85  public: math::Pose DefaultPose() const;
86 
89  public: void HandleMouseEvent(const common::MouseEvent &_evt);
90 
93  public: void HandleKeyPressEvent(const std::string &_key);
94 
97  public: void HandleKeyReleaseEvent(const std::string &_key);
98 
101  public: void SetViewController(const std::string &_type);
102 
106  public: void SetViewController(const std::string &_type,
107  const math::Vector3 &_pos);
108 
111  public: std::string GetViewControllerTypeString();
112 
116  public: void Resize(unsigned int _w, unsigned int _h);
117 
123  public: void SetViewportDimensions(float _x, float _y,
124  float _w, float _h);
125 
128  public: void MoveToVisual(VisualPtr _visual);
129 
130  // Doxygen automatically pulls in the correct documentation.
131  public: virtual bool MoveToPosition(const math::Pose &_pose,
132  double _time);
133 
136  public: void MoveToVisual(const std::string &_visualName);
137 
142  public: virtual void SetRenderTarget(Ogre::RenderTarget *_target);
143 
149  public: void EnableViewController(bool _value) const;
150 
156  public: VisualPtr GetVisual(const math::Vector2i &_mousePos,
157  std::string &_mod);
158 
161  public: VisualPtr GetVisual(const math::Vector2i &_mousePos) const;
162 
165  public: void SetFocalPoint(const math::Vector3 &_pt);
166 
167  // Documentation inherited
168  public: virtual unsigned int GetImageWidth() const;
169 
170  // Documentation inherited
171  public: virtual unsigned int GetImageHeight() const;
172 
175  public: bool IsCameraSetInWorldFile();
176 
179  public: void SetUseSDFPose(bool _value);
180 
185  public: void SetJoyTwistControl(bool _value);
186 
191  public: void SetJoyPoseControl(bool _value);
192 
195  public: bool StereoEnabled() const;
196 
204  public: void EnableStereo(bool _enable);
205 
206  // Documentation inherited.
207  public: virtual bool SetProjectionType(const std::string &_type);
208 
220  protected: virtual bool AttachToVisualImpl(VisualPtr _visual,
221  bool _inheritOrientation, double _minDist = 0,
222  double _maxDist = 0);
223 
224  // Documentation inherited.
225  protected: virtual void AnimationComplete();
226 
232  protected: virtual bool TrackVisualImpl(VisualPtr _visual);
233 
234  // Documentation inherited.
235  protected: virtual void UpdateFOV();
236 
238  private: void ToggleShowVisual();
239 
243  private: void ShowVisual(bool _show);
244 
247  private: void OnMoveToVisualComplete();
248 
253  private: void OnJoyTwist(ConstJoystickPtr &_msg);
254 
259  private: void OnJoyPose(ConstPosePtr &_msg);
260 
263  private: UserCameraPrivate *dataPtr;
264  };
266  }
267 }
268 #endif
Basic camera sensor.
Definition: Camera.hh:78
Generic description of a mouse event.
Definition: MouseEvent.hh:35
Encapsulates a position and rotation in three space.
Definition: Pose.hh:37
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:39
Private data for the UserCamera class.
Definition: UserCameraPrivate.hh:28
Generic integer x, y vector.
Definition: Vector2i.hh:36
A camera used for user visualization of a scene.
Definition: UserCamera.hh:39
#define GZ_RENDERING_VISIBLE
Definition: system.hh:241
boost::shared_ptr< Scene > ScenePtr
Definition: RenderTypes.hh:79
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
boost::shared_ptr< Visual > VisualPtr
Definition: RenderTypes.hh:107