OculusCamera.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014-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 
18 #ifndef _GAZEBO_OCULUS_CAMERA_HH_
19 #define _GAZEBO_OCULUS_CAMERA_HH_
20 
21 #include <string>
22 #include <vector>
23 
27 
28 namespace OVR
29 {
30  class HMDDevice;
31  class SensorFusion;
32  class DeviceManager;
33  class SensorDevice;
34 
35  namespace Util
36  {
37  class MagCalibration;
38  namespace Render
39  {
40  class StereoConfig;
41  }
42  }
43 }
44 
45 namespace Ogre
46 {
47  class CompositorInstance;
48 }
49 
50 namespace gazebo
51 {
52  namespace rendering
53  {
54  class OrbitViewController;
55  class FPSViewController;
56  class Visual;
57  class SelectionBuffer;
58 
61 
65  {
69  public: OculusCamera(const std::string &_name, ScenePtr _scene);
70 
72  public: virtual ~OculusCamera();
73 
76  public: void Load(sdf::ElementPtr _sdf);
77 
79  public: void Load();
80 
82  public: void Init();
83 
85  public: virtual void Update();
86 
88  public: virtual void PostRender();
89 
91  public: void Fini();
92 
96  public: void Resize(unsigned int _w, unsigned int _h);
97 
100  public: float GetAvgFPS() const;
101 
104  public: unsigned int GetTriangleCount() const;
105 
108  public: void MoveToVisual(VisualPtr _visual);
109 
110  // Doxygen automatically pulls in the correct documentation.
111  public: virtual bool MoveToPosition(const math::Pose &_pose,
112  double _time);
113 
116  public: void MoveToVisual(const std::string &_visualName);
117 
122  public: virtual void SetRenderTarget(Ogre::RenderTarget *_target);
123 
126  public: void AdjustAspect(double _v);
127 
128  // Documentation inherited
129  public: virtual unsigned int GetImageWidth() const;
130 
131  // Documentation inherited
132  public: virtual unsigned int GetImageHeight() const;
133 
135  public: void ResetSensor();
136 
139  public: bool Ready();
140 
152  protected: virtual bool AttachToVisualImpl(VisualPtr _visual,
153  bool _inheritOrientation, double _minDist = 0,
154  double _maxDist = 0);
155 
161  protected: virtual bool TrackVisualImpl(VisualPtr _visual);
162 
165  private: void OnControl(ConstWorldControlPtr &_data);
166 
168  private: void Oculus();
169 
171  protected: Ogre::Camera *rightCamera;
172 
174  protected: Ogre::Viewport *rightViewport;
175 
177  private: Ogre::CompositorInstance *compositors[2];
178 
181  private: OVR::DeviceManager *deviceManager;
182 
184  private: OVR::HMDDevice *hmd;
185 
187  private: OVR::Util::Render::StereoConfig *stereoConfig;
188 
190  private: OVR::SensorDevice *sensor;
191 
194  private: OVR::SensorFusion *sensorFusion;
195 
198  private: float centerOffset;
199 
201  private: transport::NodePtr node;
202 
204  private: transport::SubscriberPtr controlSub;
205 
207  private: bool ready;
208  };
210  }
211 }
212 #endif
Basic camera sensor.
Definition: Camera.hh:78
Ogre::Camera * rightCamera
Ogre camera for the right Oculus screen.
Definition: OculusCamera.hh:171
Encapsulates a position and rotation in three space.
Definition: Pose.hh:40
boost::shared_ptr< Subscriber > SubscriberPtr
Definition: TransportTypes.hh:53
A camera used for user visualization of a scene.
Definition: OculusCamera.hh:64
Ogre::Viewport * rightViewport
View poer for the right camera.
Definition: OculusCamera.hh:174
boost::shared_ptr< Node > NodePtr
Definition: TransportTypes.hh:57
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