##

Camera.hh
Go to the documentation of this file.
/*
* Copyright (C) 2012 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GAZEBO_RENDERING_CAMERA_HH_
#define GAZEBO_RENDERING_CAMERA_HH_
#include <memory>
#include <functional>
#include <boost/enable_shared_from_this.hpp>
#include <string>
#include <utility>
#include <list>
#include <vector>
#include <deque>
#include <sdf/sdf.hh>
#include <ignition/math/Angle.hh>
#include <ignition/math/Color.hh>
#include <ignition/math/Matrix4.hh>
#include <ignition/math/Pose3.hh>
#include <ignition/math/Quaternion.hh>
#include <ignition/math/Vector2.hh>
#include <ignition/math/Vector3.hh>
#include "gazebo/msgs/msgs.hh"
#include "gazebo/transport/Node.hh"
#include "gazebo/transport/Subscriber.hh"
#include "gazebo/common/Event.hh"
#include "gazebo/common/PID.hh"
#include "gazebo/common/Time.hh"
#include "gazebo/rendering/Conversions.hh"
#include "gazebo/rendering/ogre_gazebo.h"
#include "gazebo/rendering/RenderTypes.hh"
#include "gazebo/msgs/MessageTypes.hh"
#include "gazebo/util/system.hh"
// Forward Declarations
namespace Ogre
{
class Texture;
class RenderTarget;
class Camera;
class Viewport;
class SceneNode;
class AnimationState;
}
namespace gazebo
{
namespace rendering
{
class MouseEvent;
class ViewController;
class Scene;
class CameraPrivate;
class GZ_RENDERING_VISIBLE Camera :
public boost::enable_shared_from_this<Camera>
{
public: Camera(const std::string &_namePrefix, ScenePtr _scene,
bool _autoRender = true);
public: virtual ~Camera();
public: virtual void Load(sdf::ElementPtr _sdf);
public: virtual void Load();
public: void UpdateCameraIntrinsics(
const double _cameraIntrinsicsFx, const double _cameraIntrinsicsFy,
const double _cameraIntrinsicsCx, const double _cameraIntrinsicsCy,
const double _cameraIntrinsicsS);
public: static ignition::math::Matrix4d BuildNDCMatrix(
const double _left, const double _right,
const double _bottom, const double _top,
const double _near, const double _far);
public: static ignition::math::Matrix4d BuildPerspectiveMatrix(
const double _intrinsicsFx, const double _intrinsicsFy,
const double _intrinsicsCx, const double _intrinsicsCy,
const double _intrinsicsS,
const double _clipNear, const double _clipFar);
public: static ignition::math::Matrix4d BuildProjectionMatrix(
const double _imageWidth, const double _imageHeight,
const double _intrinsicsFx, const double _intrinsicsFy,
const double _intrinsicsCx, const double _intrinsicsCy,
const double _intrinsicsS,
const double _clipNear, const double _clipFar);
public: virtual void Init();
public: void SetRenderRate(const double _hz);
public: double RenderRate() const;
public: virtual void Render(const bool _force = false);
public: virtual void PostRender();
public: virtual void Update();
public: virtual void Fini();
public: bool Initialized() const;
public: void SetWindowId(unsigned int _windowId);
public: unsigned int WindowId() const;
public: void SetScene(ScenePtr _scene);
public: ignition::math::Vector3d WorldPosition() const;
public: ignition::math::Quaterniond WorldRotation() const;
public: virtual void SetWorldPose(const ignition::math::Pose3d &_pose);
public: ignition::math::Pose3d WorldPose() const;
public: void SetWorldPosition(const ignition::math::Vector3d &_pos);
public: void SetWorldRotation(const ignition::math::Quaterniond &_quat);
public: void Translate(const ignition::math::Vector3d &_direction);
public: void Roll(const ignition::math::Angle &_angle,
ReferenceFrame _relativeTo = RF_LOCAL);
public: void Pitch(const ignition::math::Angle &_angle,
ReferenceFrame _relativeTo = RF_LOCAL);
public: void Yaw(const ignition::math::Angle &_angle,
ReferenceFrame _relativeTo = RF_WORLD);
public: virtual void SetClipDist(const float _near, const float _far);
public: void SetHFOV(const ignition::math::Angle &_angle);
public: ignition::math::Angle HFOV() const;
public: ignition::math::Angle VFOV() const;
public: void SetImageSize(const unsigned int _w, const unsigned int _h);
public: void SetImageWidth(const unsigned int _w);
public: void SetImageHeight(const unsigned int _h);
public: virtual unsigned int ImageWidth() const;
public: unsigned int ImageMemorySize() const;
public: unsigned int TextureWidth() const;
public: virtual unsigned int ImageHeight() const;
public: unsigned int ImageDepth() const;
public: std::string ImageFormat() const;
public: unsigned int TextureHeight() const;
public: size_t ImageByteSize() const;
public: static size_t ImageByteSize(const unsigned int _width,
const unsigned int _height,
const std::string &_format);
public: double ZValue(const int _x, const int _y);
public: double NearClip() const;
public: double FarClip() const;
public: void EnableSaveFrame(const bool _enable);
public: bool CaptureData() const;
public: void SetSaveFramePathname(const std::string &_pathname);
public: bool SaveFrame(const std::string &_filename);
public: Ogre::Camera *OgreCamera() const;
public: Ogre::Viewport *OgreViewport() const;
public: unsigned int ViewportWidth() const;
public: unsigned int ViewportHeight() const;
public: ignition::math::Vector3d Up() const;
public: ignition::math::Vector3d Right() const;
public: virtual float AvgFPS() const;
public: virtual unsigned int TriangleCount() const;
public: void SetAspectRatio(float _ratio);
public: float AspectRatio() const;
public: void SetSceneNode(Ogre::SceneNode *_node);
public: Ogre::SceneNode *SceneNode() const;
public: virtual const unsigned char *ImageData(const unsigned int i = 0)
const;
public: std::string Name() const;
public: std::string ScopedName() const;
public: void SetName(const std::string &_name);
public: void ToggleShowWireframe();
public: void ShowWireframe(const bool _s);
public: void SetCaptureData(const bool _value);
public: void SetCaptureDataOnce();
public: bool StartVideo(const std::string &_format,
const std::string &_filename = "");
public: bool StopVideo();
public: bool SaveVideo(const std::string &_filename);
public: bool ResetVideo();
public: void CreateRenderTexture(const std::string &_textureName);
public: ScenePtr GetScene() const;
public: bool WorldPointOnPlane(const int _x, const int _y,
const ignition::math::Planed &_plane,
ignition::math::Vector3d &_result);
public: virtual void CameraToViewportRay(const int _screenx,
const int _screeny,
ignition::math::Vector3d &_origin,
ignition::math::Vector3d &_dir) const;
public: virtual void SetRenderTarget(Ogre::RenderTarget *_target);
public: void AttachToVisual(const std::string &_visualName,
const bool _inheritOrientation,
const double _minDist = 0.0, const double _maxDist = 0.0);
public: void AttachToVisual(uint32_t _id,
const bool _inheritOrientation,
const double _minDist = 0.0, const double _maxDist = 0.0);
public: void TrackVisual(const std::string &_visualName);
public: Ogre::Texture *RenderTexture() const;
public: ignition::math::Vector3d Direction() const;
public: event::ConnectionPtr ConnectNewImageFrame(
std::function<void (const unsigned char *, unsigned int, unsigned int,
unsigned int, const std::string &)> _subscriber);
public: static bool SaveFrame(const unsigned char *_image,
const unsigned int _width, const unsigned int _height,
const int _depth, const std::string &_format,
const std::string &_filename);
public: common::Time LastRenderWallTime() const;
public: bool IsVisible(VisualPtr _visual);
public: bool IsVisible(const std::string &_visualName);
public: bool IsAnimating() const;
public: virtual bool MoveToPosition(const ignition::math::Pose3d &_pose,
const double _time);
public: bool MoveToPositions(
const std::vector<ignition::math::Pose3d> &_pts,
const double _time,
std::function<void()> _onComplete = NULL);
public: std::string ScreenshotPath() const;
public: DistortionPtr LensDistortion() const;
public: virtual bool SetProjectionType(const std::string &_type);
public: std::string ProjectionType() const;
public: virtual bool SetBackgroundColor(const common::Color &_color)
GAZEBO_DEPRECATED(9.0);
public: virtual bool SetBackgroundColor(
const ignition::math::Color &_color);
public: ignition::math::Matrix4d ProjectionMatrix() const;
public: virtual ignition::math::Vector2i Project(
const ignition::math::Vector3d &_pt) const;
public: VisualPtr TrackedVisual() const;
public: bool TrackIsStatic() const;
public: void SetTrackIsStatic(const bool _isStatic);
public: bool TrackUseModelFrame() const;
public: void SetTrackUseModelFrame(const bool _useModelFrame);
public: ignition::math::Vector3d TrackPosition() const;
public: void SetTrackPosition(const ignition::math::Vector3d &_pos);
public: double TrackMinDistance() const;
public: double TrackMaxDistance() const;
public: void SetTrackMinDistance(const double _dist);
public: void SetTrackMaxDistance(const double _dist);
public: bool TrackInheritYaw() const;
public: void SetTrackInheritYaw(const bool _inheritYaw);
protected: virtual void RenderImpl();
protected: void ReadPixelBuffer();
protected: bool TrackVisualImpl(const std::string &_visualName);
protected: virtual bool TrackVisualImpl(VisualPtr _visual);
protected: virtual bool AttachToVisualImpl(const std::string &_name,
const bool _inheritOrientation,
const double _minDist = 0, const double _maxDist = 0);
protected: virtual bool AttachToVisualImpl(uint32_t _id,
const bool _inheritOrientation,
const double _minDist = 0, const double _maxDist = 0);
protected: virtual bool AttachToVisualImpl(VisualPtr _visual,
const bool _inheritOrientation,
const double _minDist = 0, const double _maxDist = 0);
protected: std::string FrameFilename();
protected: virtual void AnimationComplete();
protected: virtual void UpdateFOV();
protected: virtual void SetClipDist();
protected: static double LimitFOV(const double _fov);
protected: virtual void SetFixedYawAxis(const bool _useFixed,
const ignition::math::Vector3d &_fixedAxis =
ignition::math::Vector3d::UnitY);
private: void LoadCameraIntrinsics();
private: void ConvertRGBToBAYER(unsigned char *_dst,
const unsigned char *_src, const std::string &_format,
const int _width, const int _height);
private: static int OgrePixelFormat(const std::string &_format);
private: void OnCmdMsg(ConstCameraCmdPtr &_msg);
private: void CreateCamera();
protected: std::string name;
protected: std::string scopedName;
protected: std::string scopedUniqueName;
protected: sdf::ElementPtr sdf;
protected: unsigned int windowId;
protected: unsigned int textureWidth;
protected: unsigned int textureHeight;
protected: Ogre::Camera *camera;
protected: Ogre::Viewport *viewport;
protected: Ogre::SceneNode *sceneNode;
protected: unsigned char *saveFrameBuffer;
protected: unsigned char *bayerFrameBuffer;
protected: unsigned int saveCount;
protected: std::string screenshotPath;
protected: int imageFormat;
protected: int imageWidth;
protected: int imageHeight;
protected: Ogre::RenderTarget *renderTarget;
protected: Ogre::Texture *renderTexture;
protected: bool captureData;
protected: bool captureDataOnce;
protected: bool newData;
protected: common::Time lastRenderWallTime;
protected: ScenePtr scene;
protected: event::EventT<void(const unsigned char *,
unsigned int, unsigned int, unsigned int,
const std::string &)> newImageFrame;
protected: std::vector<event::ConnectionPtr> connections;
protected: std::list<msgs::Request> requests;
protected: bool initialized;
protected: Ogre::AnimationState *animState;
protected: common::Time prevAnimTime;
protected: std::function<void()> onAnimationComplete;
private: std::unique_ptr<CameraPrivate> dataPtr;
};
}
}
#endif
gazebo::rendering::Camera::WorldPointOnPlane
bool WorldPointOnPlane(const int _x, const int _y, const ignition::math::Planed &_plane, ignition::math::Vector3d &_result)
Get point on a plane.
gazebo::rendering::Camera::~Camera
virtual ~Camera()
Destructor.
gazebo::rendering::Camera::TrackUseModelFrame
bool TrackUseModelFrame() const
Get whether this camera's position is relative to tracked models.
gazebo::rendering::Camera::AvgFPS
virtual float AvgFPS() const
Get the average FPS.
gazebo::rendering::Camera::WindowId
unsigned int WindowId() const
Get the ID of the window this camera is rendering into.
gazebo::rendering::Camera::TrackVisualImpl
bool TrackVisualImpl(const std::string &_visualName)
Implementation of the Camera::TrackVisual call.
gazebo::rendering::Camera::AspectRatio
float AspectRatio() const
Get the apect ratio.
Time.hh
gazebo::rendering::Camera::CameraToViewportRay
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.
Ogre
Definition: JointMaker.hh:39
gazebo::rendering::Camera::ProjectionType
std::string ProjectionType() const
Return the projection type as a string.
gazebo::rendering::Camera::scopedUniqueName
std::string scopedUniqueName
Scene scoped name of the camera with a unique ID.
Definition: Camera.hh:866
gazebo::rendering::Camera::TrackedVisual
VisualPtr TrackedVisual() const
Get the visual tracked by this camera.
gazebo::rendering::Camera::IsVisible
bool IsVisible(VisualPtr _visual)
Return true if the visual is within the camera's view frustum.
gazebo::rendering::Camera::TrackVisual
void TrackVisual(const std::string &_visualName)
Set the camera to track a scene node.
gazebo::rendering::Camera::animState
Ogre::AnimationState * animState
Animation state, used to animate the camera.
Definition: Camera.hh:946
gazebo::rendering::Camera::ShowWireframe
void ShowWireframe(const bool _s)
Set whether to view the world in wireframe.
gazebo::rendering::Camera::PostRender
virtual void PostRender()
Post render.
gazebo::rendering::Camera::AttachToVisual
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.
gazebo::rendering::Camera::Init
virtual void Init()
Initialize the camera.
gazebo::rendering::Camera::SetRenderRate
void SetRenderRate(const double _hz)
Set the render Hz rate.
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
gazebo::rendering::Camera::StopVideo
bool StopVideo()
Turn off video recording.
gazebo::rendering::ReferenceFrame
ReferenceFrame
Frame of reference.
Definition: RenderTypes.hh:244
gazebo::rendering::Camera::SetWindowId
void SetWindowId(unsigned int _windowId)
gazebo::rendering::Camera::connections
std::vector< event::ConnectionPtr > connections
The camera's event connections.
Definition: Camera.hh:937
gazebo::common::Time
A Time class, can be used to hold wall- or sim-time. stored as sec and nano-sec.
Definition: Time.hh:47
gazebo::rendering::Camera::SaveVideo
bool SaveVideo(const std::string &_filename)
Save the last encoded video to disk.
gazebo::rendering::Camera::Name
std::string Name() const
Get the camera's unscoped name.
NULL
#define NULL
Definition: CommonTypes.hh:31
gazebo::rendering::Camera::SetHFOV
void SetHFOV(const ignition::math::Angle &_angle)
Set the camera FOV (horizontal)
gazebo::rendering::Camera::SaveFrame
bool SaveFrame(const std::string &_filename)
Save the last frame to disk.
gazebo::rendering::DistortionPtr
boost::shared_ptr< Distortion > DistortionPtr
Definition: RenderTypes.hh:198
gazebo::rendering::RF_WORLD
World frame.
Definition: RenderTypes.hh:253
gazebo::rendering::Camera::SetWorldRotation
void SetWorldRotation(const ignition::math::Quaterniond &_quat)
Set the world orientation.
gazebo::rendering::Camera::UpdateFOV
virtual void UpdateFOV()
Update the camera's field of view.
gazebo::rendering::Camera::ScopedName
std::string ScopedName() const
Get the camera's scoped name (scene_name::camera_name)
gazebo::rendering::Camera::EnableSaveFrame
void EnableSaveFrame(const bool _enable)
Enable or disable saving.
gazebo::rendering::Camera::GetScene
ScenePtr GetScene() const
Get the scene this camera is in.
gazebo::rendering::Camera::viewport
Ogre::Viewport * viewport
Viewport the ogre camera uses.
Definition: Camera.hh:884
gazebo::rendering::Camera::ImageWidth
virtual unsigned int ImageWidth() const
Get the width of the image.
gazebo::rendering::Camera::renderTexture
Ogre::Texture * renderTexture
Texture that receives results from rendering.
Definition: Camera.hh:914
gazebo::rendering::Camera::Pitch
void Pitch(const ignition::math::Angle &_angle, ReferenceFrame _relativeTo=RF_LOCAL)
Rotate the camera around the y-axis.
system.hh
gazebo::rendering::Camera::Yaw
void Yaw(const ignition::math::Angle &_angle, ReferenceFrame _relativeTo=RF_WORLD)
Rotate the camera around the z-axis.
gazebo::rendering::Camera::SetImageSize
void SetImageSize(const unsigned int _w, const unsigned int _h)
Set the image size.
gazebo::rendering::Camera::Direction
ignition::math::Vector3d Direction() const
Get the camera's direction vector.
gazebo::rendering::Camera::LimitFOV
static double LimitFOV(const double _fov)
Limit field of view taking care of using a valid value for an OGRE camera.
gazebo::rendering::Camera::sdf
sdf::ElementPtr sdf
Camera's SDF values.
Definition: Camera.hh:869
gazebo::rendering::Camera::CreateRenderTexture
void CreateRenderTexture(const std::string &_textureName)
Set the render target.
msgs.hh
gazebo::rendering::Camera::LastRenderWallTime
common::Time LastRenderWallTime() const
Get the last time the camera was rendered.
gazebo::rendering::Camera::RenderImpl
virtual void RenderImpl()
Implementation of the render call.
gazebo::rendering::Camera::SetTrackPosition
void SetTrackPosition(const ignition::math::Vector3d &_pos)
Set the position of the camera when tracking a visual.
gazebo::rendering::Camera::ResetVideo
bool ResetVideo()
Reset video recording.
gazebo::rendering::Camera::AnimationComplete
virtual void AnimationComplete()
Internal function used to indicate that an animation has completed.
gazebo::rendering::Camera::SetSceneNode
void SetSceneNode(Ogre::SceneNode *_node)
Set the camera's scene node.
gazebo::rendering::Camera::SetBackgroundColor
virtual bool SetBackgroundColor(const common::Color &_color) GAZEBO_DEPRECATED(9.0)
Set background color for viewport (if viewport is not null)
gazebo::rendering::Camera::SetCaptureDataOnce
void SetCaptureDataOnce()
Capture data once and save to disk.
gazebo::rendering::Camera::SetTrackIsStatic
void SetTrackIsStatic(const bool _isStatic)
Set whether this camera is static when tracking a model.
gazebo::rendering::Camera::ImageByteSize
size_t ImageByteSize() const
Get the image size in bytes.
gazebo::rendering::Camera::TextureWidth
unsigned int TextureWidth() const
Get the width of the off-screen render texture.
gazebo::rendering::Camera::camera
Ogre::Camera * camera
The OGRE camera.
Definition: Camera.hh:881
gazebo::rendering::Camera::SetSaveFramePathname
void SetSaveFramePathname(const std::string &_pathname)
Set the save frame pathname.
gazebo::rendering::Camera::ProjectionMatrix
ignition::math::Matrix4d ProjectionMatrix() const
Return the projection matrix of this camera.
gazebo::rendering::RF_LOCAL
Local frame.
Definition: RenderTypes.hh:247
Node.hh
gazebo::rendering::Camera::ImageFormat
std::string ImageFormat() const
Get the string representation of the image format.
gazebo::rendering::Camera::TrackIsStatic
bool TrackIsStatic() const
Get whether this camera is static when tracking a model.
gazebo::rendering::Camera::bayerFrameBuffer
unsigned char * bayerFrameBuffer
Buffer for a bayer image frame.
Definition: Camera.hh:893
gazebo::rendering::Camera::renderTarget
Ogre::RenderTarget * renderTarget
Target that renders frames.
Definition: Camera.hh:911
gazebo::event::EventT
A class for event processing.
Definition: Event.hh:97
gazebo::rendering::Camera::BuildNDCMatrix
static ignition::math::Matrix4d BuildNDCMatrix(const double _left, const double _right, const double _bottom, const double _top, const double _near, const double _far)
Computes the OpenGL NDC matrix.
Conversions.hh
gazebo::rendering::ScenePtr
boost::shared_ptr< Scene > ScenePtr
Definition: RenderTypes.hh:82
gazebo::rendering::Camera::initialized
bool initialized
True if initialized.
Definition: Camera.hh:943
gazebo::rendering::Camera::Roll
void Roll(const ignition::math::Angle &_angle, ReferenceFrame _relativeTo=RF_LOCAL)
Rotate the camera around the x-axis.
gazebo::rendering::Camera::SceneNode
Ogre::SceneNode * SceneNode() const
Get the camera's scene node.
gazebo::rendering::Camera::ImageHeight
virtual unsigned int ImageHeight() const
Get the height of the image.
gazebo::rendering::Camera::captureData
bool captureData
True to capture frames into an image buffer.
Definition: Camera.hh:917
gazebo::rendering::Camera::SetName
void SetName(const std::string &_name)
Set the camera's name.
gazebo::rendering::Camera::TrackInheritYaw
bool TrackInheritYaw() const
Get whether this camera inherits the yaw rotation of the tracked model.
RenderTypes.hh
gazebo::rendering::Camera::SetImageWidth
void SetImageWidth(const unsigned int _w)
Set the image height.
gazebo::rendering::Camera::AttachToVisualImpl
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.
rendering
rendering
Definition: RenderEngine.hh:31
gazebo::rendering::Camera::TrackPosition
ignition::math::Vector3d TrackPosition() const
Return the position of the camera when tracking a model.
gazebo::rendering::Camera::windowId
unsigned int windowId
ID of the window that the camera is attached to.
Definition: Camera.hh:872
gazebo::rendering::Camera::OgreViewport
Ogre::Viewport * OgreViewport() const
Get a pointer to the Ogre::Viewport.
gazebo::rendering::Camera::newImageFrame
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:934
gazebo::rendering::Camera::SetTrackInheritYaw
void SetTrackInheritYaw(const bool _inheritYaw)
Set whether this camera inherits the yaw rotation of the tracked model.
gazebo::rendering::Camera::RenderTexture
Ogre::Texture * RenderTexture() const
Get the render texture.
gazebo::rendering::Camera::scopedName
std::string scopedName
Scene scoped name of the camera.
Definition: Camera.hh:863
gazebo::rendering::Camera::ImageDepth
unsigned int ImageDepth() const
Get the depth of the image in bytes per pixel.
gazebo::rendering::Camera::HFOV
ignition::math::Angle HFOV() const
Get the camera FOV (horizontal)
gazebo::rendering::Camera::scene
ScenePtr scene
Pointer to the scene.
Definition: Camera.hh:929
gazebo::rendering::Camera::MoveToPositions
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).
gazebo::rendering::Camera::saveCount
unsigned int saveCount
Number of saved frames.
Definition: Camera.hh:896
gazebo::rendering::Camera::Up
ignition::math::Vector3d Up() const
Get the viewport up vector.
gazebo::rendering::Camera::imageFormat
int imageFormat
Format for saving images.
Definition: Camera.hh:902
gazebo::rendering::Camera::textureHeight
unsigned int textureHeight
Height of the render texture.
Definition: Camera.hh:878
gazebo::rendering::Camera::sceneNode
Ogre::SceneNode * sceneNode
Scene node that controls camera position and orientation.
Definition: Camera.hh:887
gazebo::rendering::Camera::BuildPerspectiveMatrix
static ignition::math::Matrix4d BuildPerspectiveMatrix(const double _intrinsicsFx, const double _intrinsicsFy, const double _intrinsicsCx, const double _intrinsicsCy, const double _intrinsicsS, const double _clipNear, const double _clipFar)
Computes the OpenGL perspective matrix.
gazebo::rendering::Camera::SetWorldPose
virtual void SetWorldPose(const ignition::math::Pose3d &_pose)
Set the global pose of the camera.
gazebo::rendering::Camera::screenshotPath
std::string screenshotPath
Path to saved screenshots.
Definition: Camera.hh:899
gazebo::rendering::Camera::FarClip
double FarClip() const
Get the far clip distance.
gazebo::rendering::Camera::StartVideo
bool StartVideo(const std::string &_format, const std::string &_filename="")
Turn on video recording.
gazebo::rendering::Camera::SetTrackMaxDistance
void SetTrackMaxDistance(const double _dist)
Set the maximum distance between the camera and tracked visual.
gazebo::rendering::Camera::TriangleCount
virtual unsigned int TriangleCount() const
Get the triangle count.
gazebo::rendering::Camera::Translate
void Translate(const ignition::math::Vector3d &_direction)
Translate the camera.
gazebo::rendering::Camera::RenderRate
double RenderRate() const
Get the render Hz rate.
gazebo::event::ConnectionPtr
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:134
gazebo::rendering::Camera::onAnimationComplete
std::function< void()> onAnimationComplete
User callback for when an animation completes.
Definition: Camera.hh:952
gazebo::rendering::Camera::ImageData
virtual const unsigned char * ImageData(const unsigned int i=0) const
Get a pointer to the image data.
gazebo::rendering::Camera::ZValue
double ZValue(const int _x, const int _y)
Get the Z-buffer value at the given image coordinate.
ogre_gazebo.h
gazebo::rendering::Camera::TextureHeight
unsigned int TextureHeight() const
Get the height of the off-screen render texture.
gazebo::msgs::Init
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
gazebo::rendering::Camera::SetRenderTarget
virtual void SetRenderTarget(Ogre::RenderTarget *_target)
Set the camera's render target.
gazebo::rendering::Camera::ScreenshotPath
std::string ScreenshotPath() const
Get the path to saved screenshots.
gazebo::rendering::Camera::BuildProjectionMatrix
static ignition::math::Matrix4d BuildProjectionMatrix(const double _imageWidth, const double _imageHeight, const double _intrinsicsFx, const double _intrinsicsFy, const double _intrinsicsCx, const double _intrinsicsCy, const double _intrinsicsS, const double _clipNear, const double _clipFar)
Computes the OpenGL projection matrix by multiplying the OpenGL Normalized Device Coordinates matrix ...
gazebo::rendering::Camera::TrackMaxDistance
double TrackMaxDistance() const
Return the maximum distance to the tracked visual.
gazebo::rendering::Camera::requests
std::list< msgs::Request > requests
List of requests.
Definition: Camera.hh:940
gazebo::rendering::Camera::Update
virtual void Update()
gazebo::rendering::Camera::Render
virtual void Render(const bool _force=false)
Render the camera.
gazebo::rendering::Camera::newData
bool newData
True if new data is available.
Definition: Camera.hh:923
gazebo::common::Color
Defines a color.
Definition: Color.hh:36
gazebo::rendering::Camera::ReadPixelBuffer
void ReadPixelBuffer()
Read image data from pixel buffer.
gazebo::rendering::Camera::ConnectNewImageFrame
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.
gazebo::rendering::Camera::SetClipDist
virtual void SetClipDist()
Set the clip distance based on stored SDF values.
gazebo::rendering::Camera::SetAspectRatio
void SetAspectRatio(float _ratio)
Set the aspect ratio.
gazebo::rendering::Camera::prevAnimTime
common::Time prevAnimTime
Previous time the camera animation was updated.
Definition: Camera.hh:949
gazebo::rendering::Camera::CaptureData
bool CaptureData() const
Return the value of this->captureData.
gazebo::rendering::Camera::SetWorldPosition
void SetWorldPosition(const ignition::math::Vector3d &_pos)
Set the world position.
GAZEBO_DEPRECATED
#define GAZEBO_DEPRECATED(version)
Definition: system.hh:328
gazebo::rendering::Camera::Right
ignition::math::Vector3d Right() const
Get the viewport right vector.
gazebo::rendering::Camera::WorldPosition
ignition::math::Vector3d WorldPosition() const
Get the camera position in the world.
gazebo::rendering::Camera::lastRenderWallTime
common::Time lastRenderWallTime
Time the last frame was rendered.
Definition: Camera.hh:926
gazebo::rendering::Camera::Load
virtual void Load()
Load the camera with default parameters.
gazebo::rendering::Camera::UpdateCameraIntrinsics
void UpdateCameraIntrinsics(const double _cameraIntrinsicsFx, const double _cameraIntrinsicsFy, const double _cameraIntrinsicsCx, const double _cameraIntrinsicsCy, const double _cameraIntrinsicsS)
Updates the camera intrinsics.
gazebo::rendering::Camera::Fini
virtual void Fini()
Finalize the camera.
gazebo::rendering::Camera::NearClip
double NearClip() const
Get the near clip distance.
gazebo::rendering::Camera::SetTrackMinDistance
void SetTrackMinDistance(const double _dist)
Set the minimum distance between the camera and tracked visual.
Event.hh
gazebo::rendering::Camera::Initialized
bool Initialized() const
Return true if the camera has been initialized.
gazebo::rendering::Camera::IsAnimating
bool IsAnimating() const
Return true if the camera is moving due to an animation.
gazebo::rendering::VisualPtr
std::shared_ptr< Visual > VisualPtr
Definition: RenderTypes.hh:114
gazebo::rendering::Camera::name
std::string name
Name of the camera.
Definition: Camera.hh:860
gazebo::rendering::Camera::SetScene
void SetScene(ScenePtr _scene)
Set the scene this camera is viewing.
gazebo::rendering::Camera::saveFrameBuffer
unsigned char * saveFrameBuffer
Buffer for a single image frame.
Definition: Camera.hh:890
gazebo::rendering::Camera::OgreCamera
Ogre::Camera * OgreCamera() const
Get a pointer to the ogre camera.
gazebo::rendering::Camera::imageWidth
int imageWidth
Save image width.
Definition: Camera.hh:905
gazebo::rendering::Camera::ToggleShowWireframe
void ToggleShowWireframe()
Toggle whether to view the world in wireframe.
gazebo::rendering::Camera::ViewportHeight
unsigned int ViewportHeight() const
Get the viewport height in pixels.
gazebo::rendering::Camera::textureWidth
unsigned int textureWidth
Width of the render texture.
Definition: Camera.hh:875
gazebo::rendering::Camera::captureDataOnce
bool captureDataOnce
True to capture a frame once and save to disk.
Definition: Camera.hh:920
gazebo::rendering::Camera::WorldRotation
ignition::math::Quaterniond WorldRotation() const
Get the camera's orientation in the world.
gazebo::rendering::Camera::Camera
Camera(const std::string &_namePrefix, ScenePtr _scene, bool _autoRender=true)
Constructor.
gazebo::rendering::Camera::LensDistortion
DistortionPtr LensDistortion() const
Get the distortion model of this camera.
gazebo::rendering::Camera
Basic camera sensor.
Definition: Camera.hh:84
gazebo::rendering::Camera::ViewportWidth
unsigned int ViewportWidth() const
Get the viewport width in pixels.
PID.hh
gazebo::rendering::Camera::MoveToPosition
virtual bool MoveToPosition(const ignition::math::Pose3d &_pose, const double _time)
Move the camera to a position (this is an animated motion).
gazebo::rendering::Camera::SetFixedYawAxis
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.
gazebo::rendering::Camera::SetProjectionType
virtual bool SetProjectionType(const std::string &_type)
Set the type of projection used by the camera.
Subscriber.hh
gazebo::rendering::Camera::ImageMemorySize
unsigned int ImageMemorySize() const
Get the memory size of this image.
gazebo::rendering::Camera::imageHeight
int imageHeight
Save image height.
Definition: Camera.hh:908
gazebo::rendering::Camera::VFOV
ignition::math::Angle VFOV() const
Get the camera FOV (vertical)
gazebo::rendering::Camera::SetTrackUseModelFrame
void SetTrackUseModelFrame(const bool _useModelFrame)
Set whether this camera's position is relative to tracked models.
gazebo::rendering::Camera::Project
virtual ignition::math::Vector2i Project(const ignition::math::Vector3d &_pt) const
Project 3D world coordinates to 2D screen coordinates.
gazebo::rendering::Camera::SetCaptureData
void SetCaptureData(const bool _value)
Set whether to capture data.
gazebo::rendering::Camera::FrameFilename
std::string FrameFilename()
Get the next frame filename based on SDF parameters.
gazebo::rendering::Camera::SetImageHeight
void SetImageHeight(const unsigned int _h)
Set the image height.
gazebo::rendering::Camera::WorldPose
ignition::math::Pose3d WorldPose() const
Get the world pose.
gazebo::rendering::Camera::TrackMinDistance
double TrackMinDistance() const
Return the minimum distance to the tracked visual.