Camera.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 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_RENDERING_CAMERA_HH_
18 #define GAZEBO_RENDERING_CAMERA_HH_
19 
20 #include <memory>
21 #include <functional>
22 
23 #include <boost/enable_shared_from_this.hpp>
24 #include <string>
25 #include <utility>
26 #include <list>
27 #include <vector>
28 #include <deque>
29 #include <sdf/sdf.hh>
30 #include <ignition/math/Angle.hh>
31 #include <ignition/math/Color.hh>
32 #include <ignition/math/Pose3.hh>
33 #include <ignition/math/Quaternion.hh>
34 #include <ignition/math/Vector2.hh>
35 #include <ignition/math/Vector3.hh>
36 
37 #include "gazebo/msgs/msgs.hh"
38 
39 #include "gazebo/transport/Node.hh"
41 
42 #include "gazebo/common/Event.hh"
43 #include "gazebo/common/PID.hh"
44 #include "gazebo/common/Time.hh"
45 
47 #include "gazebo/msgs/MessageTypes.hh"
49 #include "gazebo/util/system.hh"
50 
51 // Forward Declarations
52 namespace Ogre
53 {
54  class Texture;
55  class RenderTarget;
56  class Camera;
57  class Viewport;
58  class SceneNode;
59  class AnimationState;
60 }
61 
62 namespace gazebo
63 {
66  namespace rendering
67  {
68  class MouseEvent;
69  class ViewController;
70  class Scene;
71  class CameraPrivate;
72 
76 
81  class GZ_RENDERING_VISIBLE Camera :
82  public boost::enable_shared_from_this<Camera>
83  {
88  public: Camera(const std::string &_namePrefix, ScenePtr _scene,
89  bool _autoRender = true);
90 
92  public: virtual ~Camera();
93 
96  public: virtual void Load(sdf::ElementPtr _sdf);
97 
99  public: virtual void Load();
100 
102  public: virtual void Init();
103 
106  public: void SetRenderRate(const double _hz);
107 
110  public: double RenderRate() const;
111 
117  public: virtual void Render(const bool _force = false);
118 
122  public: virtual void PostRender();
123 
129  public: virtual void Update();
130 
134  public: virtual void Fini();
135 
138  public: bool Initialized() const;
139 
143  public: void SetWindowId(unsigned int _windowId);
144 
147  public: unsigned int WindowId() const;
148 
151  public: void SetScene(ScenePtr _scene);
152 
155  public: ignition::math::Vector3d WorldPosition() const;
156 
159  public: ignition::math::Quaterniond WorldRotation() const;
160 
163  public: virtual void SetWorldPose(const ignition::math::Pose3d &_pose);
164 
167  public: ignition::math::Pose3d WorldPose() const;
168 
171  public: void SetWorldPosition(const ignition::math::Vector3d &_pos);
172 
175  public: void SetWorldRotation(const ignition::math::Quaterniond &_quat);
176 
179  public: void Translate(const ignition::math::Vector3d &_direction);
180 
185  public: void Roll(const ignition::math::Angle &_angle,
186  ReferenceFrame _relativeTo = RF_LOCAL);
187 
192  public: void Pitch(const ignition::math::Angle &_angle,
193  ReferenceFrame _relativeTo = RF_LOCAL);
194 
199  public: void Yaw(const ignition::math::Angle &_angle,
200  ReferenceFrame _relativeTo = RF_WORLD);
201 
205  public: virtual void SetClipDist(const float _near, const float _far);
206 
209  public: void SetHFOV(const ignition::math::Angle &_angle);
210 
213  public: ignition::math::Angle HFOV() const;
214 
217  public: ignition::math::Angle VFOV() const;
218 
222  public: void SetImageSize(const unsigned int _w, const unsigned int _h);
223 
226  public: void SetImageWidth(const unsigned int _w);
227 
230  public: void SetImageHeight(const unsigned int _h);
231 
234  public: virtual unsigned int ImageWidth() const;
235 
238  public: unsigned int ImageMemorySize() const;
239 
242  public: unsigned int TextureWidth() const;
243 
246  public: virtual unsigned int ImageHeight() const;
247 
250  public: unsigned int ImageDepth() const;
251 
254  public: std::string ImageFormat() const;
255 
258  public: unsigned int TextureHeight() const;
259 
262  public: size_t ImageByteSize() const;
263 
269  public: static size_t ImageByteSize(const unsigned int _width,
270  const unsigned int _height,
271  const std::string &_format);
272 
278  public: double ZValue(const int _x, const int _y);
279 
282  public: double NearClip() const;
283 
286  public: double FarClip() const;
287 
290  public: void EnableSaveFrame(const bool _enable);
291 
294  public: bool CaptureData() const;
295 
298  public: void SetSaveFramePathname(const std::string &_pathname);
299 
303  public: bool SaveFrame(const std::string &_filename);
304 
307  public: Ogre::Camera *OgreCamera() const;
308 
311  public: Ogre::Viewport *OgreViewport() const;
312 
315  public: unsigned int ViewportWidth() const;
316 
319  public: unsigned int ViewportHeight() const;
320 
323  public: ignition::math::Vector3d Up() const;
324 
327  public: ignition::math::Vector3d Right() const;
328 
331  public: virtual float AvgFPS() const;
332 
335  public: virtual unsigned int TriangleCount() const;
336 
339  public: void SetAspectRatio(float _ratio);
340 
343  public: float AspectRatio() const;
344 
347  public: void SetSceneNode(Ogre::SceneNode *_node);
348 
351  public: Ogre::SceneNode *SceneNode() const;
352 
358  public: virtual const unsigned char *ImageData(const unsigned int i = 0)
359  const;
360 
363  public: std::string Name() const;
364 
367  public: std::string ScopedName() const;
368 
371  public: void SetName(const std::string &_name);
372 
374  public: void ToggleShowWireframe();
375 
378  public: void ShowWireframe(const bool _s);
379 
382  public: void SetCaptureData(const bool _value);
383 
385  public: void SetCaptureDataOnce();
386 
400  public: bool StartVideo(const std::string &_format,
401  const std::string &_filename = "");
402 
407  public: bool StopVideo();
408 
414  public: bool SaveVideo(const std::string &_filename);
415 
422  public: bool ResetVideo();
423 
426  public: void CreateRenderTexture(const std::string &_textureName);
427 
430  public: ScenePtr GetScene() const;
431 
438  public: bool WorldPointOnPlane(const int _x, const int _y,
439  const ignition::math::Planed &_plane,
440  ignition::math::Vector3d &_result);
441 
449  public: virtual void CameraToViewportRay(const int _screenx,
450  const int _screeny,
451  ignition::math::Vector3d &_origin,
452  ignition::math::Vector3d &_dir) const;
453 
456  public: virtual void SetRenderTarget(Ogre::RenderTarget *_target);
457 
466  public: void AttachToVisual(const std::string &_visualName,
467  const bool _inheritOrientation,
468  const double _minDist = 0.0, const double _maxDist = 0.0);
469 
478  public: void AttachToVisual(uint32_t _id,
479  const bool _inheritOrientation,
480  const double _minDist = 0.0, const double _maxDist = 0.0);
481 
484  public: void TrackVisual(const std::string &_visualName);
485 
488  public: Ogre::Texture *RenderTexture() const;
489 
492  public: ignition::math::Vector3d Direction() const;
493 
498  public: event::ConnectionPtr ConnectNewImageFrame(
499  std::function<void (const unsigned char *, unsigned int, unsigned int,
500  unsigned int, const std::string &)> _subscriber);
501 
510  public: static bool SaveFrame(const unsigned char *_image,
511  const unsigned int _width, const unsigned int _height,
512  const int _depth, const std::string &_format,
513  const std::string &_filename);
514 
517  public: common::Time LastRenderWallTime() const;
518 
523  public: bool IsVisible(VisualPtr _visual);
524 
529  public: bool IsVisible(const std::string &_visualName);
530 
532  public: bool IsAnimating() const;
533 
538  public: virtual bool MoveToPosition(const ignition::math::Pose3d &_pose,
539  const double _time);
540 
548  public: bool MoveToPositions(
549  const std::vector<ignition::math::Pose3d> &_pts,
550  const double _time,
551  std::function<void()> _onComplete = NULL);
552 
555  public: std::string ScreenshotPath() const;
556 
559  public: DistortionPtr LensDistortion() const;
560 
566  public: virtual bool SetProjectionType(const std::string &_type);
567 
571  public: std::string ProjectionType() const;
572 
577  public: virtual bool SetBackgroundColor(const common::Color &_color)
578  GAZEBO_DEPRECATED(9.0);
579 
583  public: virtual bool SetBackgroundColor(
584  const ignition::math::Color &_color);
585 
588  public: ignition::math::Matrix4d ProjectionMatrix() const;
589 
593  public: virtual ignition::math::Vector2i Project(
594  const ignition::math::Vector3d &_pt) const;
595 
598  public: VisualPtr TrackedVisual() const;
599 
603  public: bool TrackIsStatic() const;
604 
609  public: void SetTrackIsStatic(const bool _isStatic);
610 
615  public: bool TrackUseModelFrame() const;
616 
622  public: void SetTrackUseModelFrame(const bool _useModelFrame);
623 
627  public: ignition::math::Vector3d TrackPosition() const;
628 
632  public: void SetTrackPosition(const ignition::math::Vector3d &_pos);
633 
637  public: double TrackMinDistance() const;
638 
642  public: double TrackMaxDistance() const;
643 
648  public: void SetTrackMinDistance(const double _dist);
649 
654  public: void SetTrackMaxDistance(const double _dist);
655 
661  public: bool TrackInheritYaw() const;
662 
668  public: void SetTrackInheritYaw(const bool _inheritYaw);
669 
671  protected: virtual void RenderImpl();
672 
674  protected: void ReadPixelBuffer();
675 
679  protected: bool TrackVisualImpl(const std::string &_visualName);
680 
684  protected: virtual bool TrackVisualImpl(VisualPtr _visual);
685 
695  protected: virtual bool AttachToVisualImpl(const std::string &_name,
696  const bool _inheritOrientation,
697  const double _minDist = 0, const double _maxDist = 0);
698 
708  protected: virtual bool AttachToVisualImpl(uint32_t _id,
709  const bool _inheritOrientation,
710  const double _minDist = 0, const double _maxDist = 0);
711 
721  protected: virtual bool AttachToVisualImpl(VisualPtr _visual,
722  const bool _inheritOrientation,
723  const double _minDist = 0, const double _maxDist = 0);
724 
727  protected: std::string FrameFilename();
728 
731  protected: virtual void AnimationComplete();
732 
734  protected: virtual void UpdateFOV();
735 
737  protected: virtual void SetClipDist();
738 
745  protected: virtual void SetFixedYawAxis(const bool _useFixed,
746  const ignition::math::Vector3d &_fixedAxis =
747  ignition::math::Vector3d::UnitY);
748 
756  private: void ConvertRGBToBAYER(unsigned char *_dst,
757  const unsigned char *_src, const std::string &_format,
758  const int _width, const int _height);
759 
763  private: static int OgrePixelFormat(const std::string &_format);
764 
767  private: void OnCmdMsg(ConstCameraCmdPtr &_msg);
768 
770  private: void CreateCamera();
771 
773  protected: std::string name;
774 
776  protected: std::string scopedName;
777 
779  protected: std::string scopedUniqueName;
780 
782  protected: sdf::ElementPtr sdf;
783 
785  protected: unsigned int windowId;
786 
788  protected: unsigned int textureWidth;
789 
791  protected: unsigned int textureHeight;
792 
794  protected: Ogre::Camera *camera;
795 
797  protected: Ogre::Viewport *viewport;
798 
800  protected: Ogre::SceneNode *sceneNode;
801 
803  protected: unsigned char *saveFrameBuffer;
804 
806  protected: unsigned char *bayerFrameBuffer;
807 
809  protected: unsigned int saveCount;
810 
812  protected: std::string screenshotPath;
813 
815  protected: int imageFormat;
816 
818  protected: int imageWidth;
819 
821  protected: int imageHeight;
822 
824  protected: Ogre::RenderTarget *renderTarget;
825 
827  protected: Ogre::Texture *renderTexture;
828 
830  protected: bool captureData;
831 
833  protected: bool captureDataOnce;
834 
836  protected: bool newData;
837 
840 
842  protected: ScenePtr scene;
843 
845  protected: event::EventT<void(const unsigned char *,
846  unsigned int, unsigned int, unsigned int,
847  const std::string &)> newImageFrame;
848 
850  protected: std::vector<event::ConnectionPtr> connections;
851 
853  protected: std::list<msgs::Request> requests;
854 
856  protected: bool initialized;
857 
859  protected: Ogre::AnimationState *animState;
860 
863 
865  protected: std::function<void()> onAnimationComplete;
866 
869  private: std::unique_ptr<CameraPrivate> dataPtr;
870  };
872  }
873 }
874 #endif
bool WorldPointOnPlane(const int _x, const int _y, const ignition::math::Planed &_plane, ignition::math::Vector3d &_result)
Get point on a plane.
virtual ~Camera()
Destructor.
bool TrackUseModelFrame() const
Get whether this camera's position is relative to tracked models.
virtual float AvgFPS() const
Get the average FPS.
unsigned int WindowId() const
Get the ID of the window this camera is rendering into.
bool TrackVisualImpl(const std::string &_visualName)
Implementation of the Camera::TrackVisual call.
float AspectRatio() const
Get the apect ratio.
virtual void CameraToViewportRay(const int _screenx, const int _screeny, ignition::math::Vector3d &_origin, ignition::math::Vector3d &_dir) const
Get a world space ray as cast from the camera through the viewport.
Definition: JointMaker.hh:39
std::string ProjectionType() const
Return the projection type as a string.
std::string scopedUniqueName
Scene scoped name of the camera with a unique ID.
Definition: Camera.hh:779
VisualPtr TrackedVisual() const
Get the visual tracked by this camera.
bool IsVisible(VisualPtr _visual)
Return true if the visual is within the camera's view frustum.
void TrackVisual(const std::string &_visualName)
Set the camera to track a scene node.
Ogre::AnimationState * animState
Animation state, used to animate the camera.
Definition: Camera.hh:859
void ShowWireframe(const bool _s)
Set whether to view the world in wireframe.
virtual void PostRender()
Post render.
void AttachToVisual(const std::string &_visualName, const bool _inheritOrientation, const double _minDist=0.0, const double _maxDist=0.0)
Attach the camera to a scene node.
virtual void Init()
Initialize the camera.
void SetRenderRate(const double _hz)
Set the render Hz rate.
Forward declarations for the common classes.
Definition: Animation.hh:26
bool StopVideo()
Turn off video recording.
ReferenceFrame
Frame of reference.
Definition: RenderTypes.hh:244
void SetWindowId(unsigned int _windowId)
std::vector< event::ConnectionPtr > connections
The camera's event connections.
Definition: Camera.hh:850
A Time class, can be used to hold wall- or sim-time. stored as sec and nano-sec.
Definition: Time.hh:44
bool SaveVideo(const std::string &_filename)
Save the last encoded video to disk.
std::string Name() const
Get the camera's unscoped name.
#define NULL
Definition: CommonTypes.hh:31
void SetHFOV(const ignition::math::Angle &_angle)
Set the camera FOV (horizontal)
bool SaveFrame(const std::string &_filename)
Save the last frame to disk.
boost::shared_ptr< Distortion > DistortionPtr
Definition: RenderTypes.hh:198
World frame.
Definition: RenderTypes.hh:253
void SetWorldRotation(const ignition::math::Quaterniond &_quat)
Set the world orientation.
virtual void UpdateFOV()
Update the camera's field of view.
std::string ScopedName() const
Get the camera's scoped name (scene_name::camera_name)
void EnableSaveFrame(const bool _enable)
Enable or disable saving.
ScenePtr GetScene() const
Get the scene this camera is in.
Ogre::Viewport * viewport
Viewport the ogre camera uses.
Definition: Camera.hh:797
virtual unsigned int ImageWidth() const
Get the width of the image.
Ogre::Texture * renderTexture
Texture that receives results from rendering.
Definition: Camera.hh:827
void Pitch(const ignition::math::Angle &_angle, ReferenceFrame _relativeTo=RF_LOCAL)
Rotate the camera around the y-axis.
void Yaw(const ignition::math::Angle &_angle, ReferenceFrame _relativeTo=RF_WORLD)
Rotate the camera around the z-axis.
void SetImageSize(const unsigned int _w, const unsigned int _h)
Set the image size.
ignition::math::Vector3d Direction() const
Get the camera's direction vector.
sdf::ElementPtr sdf
Camera's SDF values.
Definition: Camera.hh:782
void CreateRenderTexture(const std::string &_textureName)
Set the render target.
common::Time LastRenderWallTime() const
Get the last time the camera was rendered.
virtual void RenderImpl()
Implementation of the render call.
void SetTrackPosition(const ignition::math::Vector3d &_pos)
Set the position of the camera when tracking a visual.
bool ResetVideo()
Reset video recording.
virtual void AnimationComplete()
Internal function used to indicate that an animation has completed.
void SetSceneNode(Ogre::SceneNode *_node)
Set the camera's scene node.
virtual bool SetBackgroundColor(const common::Color &_color) GAZEBO_DEPRECATED(9.0)
Set background color for viewport (if viewport is not null)
void SetCaptureDataOnce()
Capture data once and save to disk.
void SetTrackIsStatic(const bool _isStatic)
Set whether this camera is static when tracking a model.
size_t ImageByteSize() const
Get the image size in bytes.
unsigned int TextureWidth() const
Get the width of the off-screen render texture.
Ogre::Camera * camera
The OGRE camera.
Definition: Camera.hh:794
void SetSaveFramePathname(const std::string &_pathname)
Set the save frame pathname.
ignition::math::Matrix4d ProjectionMatrix() const
Return the projection matrix of this camera.
Local frame.
Definition: RenderTypes.hh:247
std::string ImageFormat() const
Get the string representation of the image format.
bool TrackIsStatic() const
Get whether this camera is static when tracking a model.
unsigned char * bayerFrameBuffer
Buffer for a bayer image frame.
Definition: Camera.hh:806
Ogre::RenderTarget * renderTarget
Target that renders frames.
Definition: Camera.hh:824
A class for event processing.
Definition: Event.hh:97
boost::shared_ptr< Scene > ScenePtr
Definition: RenderTypes.hh:82
bool initialized
True if initialized.
Definition: Camera.hh:856
void Roll(const ignition::math::Angle &_angle, ReferenceFrame _relativeTo=RF_LOCAL)
Rotate the camera around the x-axis.
Ogre::SceneNode * SceneNode() const
Get the camera's scene node.
virtual unsigned int ImageHeight() const
Get the height of the image.
bool captureData
True to capture frames into an image buffer.
Definition: Camera.hh:830
void SetName(const std::string &_name)
Set the camera's name.
bool TrackInheritYaw() const
Get whether this camera inherits the yaw rotation of the tracked model.
void SetImageWidth(const unsigned int _w)
Set the image height.
virtual bool AttachToVisualImpl(const std::string &_name, const bool _inheritOrientation, const double _minDist=0, const double _maxDist=0)
Attach the camera to a scene node.
ignition::math::Vector3d TrackPosition() const
Return the position of the camera when tracking a model.
unsigned int windowId
ID of the window that the camera is attached to.
Definition: Camera.hh:785
Ogre::Viewport * OgreViewport() const
Get a pointer to the Ogre::Viewport.
event::EventT< void(const unsigned char *, unsigned int, unsigned int, unsigned int, const std::string &)> newImageFrame
Event triggered when a new frame is generated.
Definition: Camera.hh:847
void SetTrackInheritYaw(const bool _inheritYaw)
Set whether this camera inherits the yaw rotation of the tracked model.
Ogre::Texture * RenderTexture() const
Get the render texture.
std::string scopedName
Scene scoped name of the camera.
Definition: Camera.hh:776
unsigned int ImageDepth() const
Get the depth of the image in bytes per pixel.
ignition::math::Angle HFOV() const
Get the camera FOV (horizontal)
ScenePtr scene
Pointer to the scene.
Definition: Camera.hh:842
bool MoveToPositions(const std::vector< ignition::math::Pose3d > &_pts, const double _time, std::function< void()> _onComplete=NULL)
Move the camera to a series of poses (this is an animated motion).
unsigned int saveCount
Number of saved frames.
Definition: Camera.hh:809
ignition::math::Vector3d Up() const
Get the viewport up vector.
int imageFormat
Format for saving images.
Definition: Camera.hh:815
unsigned int textureHeight
Height of the render texture.
Definition: Camera.hh:791
Ogre::SceneNode * sceneNode
Scene node that controls camera position and orientation.
Definition: Camera.hh:800
virtual void SetWorldPose(const ignition::math::Pose3d &_pose)
Set the global pose of the camera.
std::string screenshotPath
Path to saved screenshots.
Definition: Camera.hh:812
double FarClip() const
Get the far clip distance.
bool StartVideo(const std::string &_format, const std::string &_filename="")
Turn on video recording.
void SetTrackMaxDistance(const double _dist)
Set the maximum distance between the camera and tracked visual.
virtual unsigned int TriangleCount() const
Get the triangle count.
void Translate(const ignition::math::Vector3d &_direction)
Translate the camera.
double RenderRate() const
Get the render Hz rate.
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:134
std::function< void()> onAnimationComplete
User callback for when an animation completes.
Definition: Camera.hh:865
virtual const unsigned char * ImageData(const unsigned int i=0) const
Get a pointer to the image data.
double ZValue(const int _x, const int _y)
Get the Z-buffer value at the given image coordinate.
unsigned int TextureHeight() const
Get the height of the off-screen render texture.
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
virtual void SetRenderTarget(Ogre::RenderTarget *_target)
Set the camera's render target.
std::string ScreenshotPath() const
Get the path to saved screenshots.
double TrackMaxDistance() const
Return the maximum distance to the tracked visual.
std::list< msgs::Request > requests
List of requests.
Definition: Camera.hh:853
virtual void Update()
virtual void Render(const bool _force=false)
Render the camera.
bool newData
True if new data is available.
Definition: Camera.hh:836
Defines a color.
Definition: Color.hh:36
void ReadPixelBuffer()
Read image data from pixel buffer.
event::ConnectionPtr ConnectNewImageFrame(std::function< void(const unsigned char *, unsigned int, unsigned int, unsigned int, const std::string &)> _subscriber)
Connect to the new image signal.
virtual void SetClipDist()
Set the clip distance based on stored SDF values.
void SetAspectRatio(float _ratio)
Set the aspect ratio.
common::Time prevAnimTime
Previous time the camera animation was updated.
Definition: Camera.hh:862
bool CaptureData() const
Return the value of this->captureData.
void SetWorldPosition(const ignition::math::Vector3d &_pos)
Set the world position.
#define GAZEBO_DEPRECATED(version)
Definition: system.hh:328
ignition::math::Vector3d Right() const
Get the viewport right vector.
ignition::math::Vector3d WorldPosition() const
Get the camera position in the world.
common::Time lastRenderWallTime
Time the last frame was rendered.
Definition: Camera.hh:839
virtual void Load()
Load the camera with default parmeters.
virtual void Fini()
Finalize the camera.
double NearClip() const
Get the near clip distance.
void SetTrackMinDistance(const double _dist)
Set the minimum distance between the camera and tracked visual.
bool Initialized() const
Return true if the camera has been initialized.
bool IsAnimating() const
Return true if the camera is moving due to an animation.
std::shared_ptr< Visual > VisualPtr
Definition: RenderTypes.hh:114
std::string name
Name of the camera.
Definition: Camera.hh:773
void SetScene(ScenePtr _scene)
Set the scene this camera is viewing.
unsigned char * saveFrameBuffer
Buffer for a single image frame.
Definition: Camera.hh:803
Ogre::Camera * OgreCamera() const
Get a pointer to the ogre camera.
int imageWidth
Save image width.
Definition: Camera.hh:818
void ToggleShowWireframe()
Toggle whether to view the world in wireframe.
unsigned int ViewportHeight() const
Get the viewport height in pixels.
unsigned int textureWidth
Width of the render texture.
Definition: Camera.hh:788
bool captureDataOnce
True to capture a frame once and save to disk.
Definition: Camera.hh:833
ignition::math::Quaterniond WorldRotation() const
Get the camera's orientation in the world.
Camera(const std::string &_namePrefix, ScenePtr _scene, bool _autoRender=true)
Constructor.
DistortionPtr LensDistortion() const
Get the distortion model of this camera.
Basic camera sensor.
Definition: Camera.hh:81
unsigned int ViewportWidth() const
Get the viewport width in pixels.
virtual bool MoveToPosition(const ignition::math::Pose3d &_pose, const double _time)
Move the camera to a position (this is an animated motion).
virtual void SetFixedYawAxis(const bool _useFixed, const ignition::math::Vector3d &_fixedAxis=ignition::math::Vector3d::UnitY)
Tell the camera whether to yaw around its own local Y axis or a fixed axis of choice.
virtual bool SetProjectionType(const std::string &_type)
Set the type of projection used by the camera.
unsigned int ImageMemorySize() const
Get the memory size of this image.
int imageHeight
Save image height.
Definition: Camera.hh:821
ignition::math::Angle VFOV() const
Get the camera FOV (vertical)
void SetTrackUseModelFrame(const bool _useModelFrame)
Set whether this camera's position is relative to tracked models.
virtual ignition::math::Vector2i Project(const ignition::math::Vector3d &_pt) const
Project 3D world coordinates to 2D screen coordinates.
void SetCaptureData(const bool _value)
Set whether to capture data.
std::string FrameFilename()
Get the next frame filename based on SDF parameters.
void SetImageHeight(const unsigned int _h)
Set the image height.
ignition::math::Pose3d WorldPose() const
Get the world pose.
double TrackMinDistance() const
Return the minimum distance to the tracked visual.