##

DepthCamera.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_DEPTHCAMERA_HH_
#define _GAZEBO_RENDERING_DEPTHCAMERA_HH_
#include <memory>
#include <string>
#include <sdf/sdf.hh>
#include "gazebo/common/CommonTypes.hh"
#include "gazebo/rendering/Camera.hh"
#include "gazebo/util/system.hh"
namespace Ogre
{
class Material;
class RenderTarget;
class Texture;
class Viewport;
}
namespace gazebo
{
namespace rendering
{
// Forward declare private data.
class DepthCameraPrivate;
class GZ_RENDERING_VISIBLE DepthCamera : public Camera
{
public: DepthCamera(const std::string &_namePrefix,
ScenePtr _scene, bool _autoRender = true);
public: virtual ~DepthCamera();
public: void Load(sdf::ElementPtr _sdf);
public: void Load();
public: void Init();
public: void Fini();
public: void CreateDepthTexture(const std::string &_textureName);
public: virtual void PostRender();
public: virtual const float *DepthData() const;
public: virtual void SetDepthTarget(Ogre::RenderTarget *_target);
public: event::ConnectionPtr ConnectNewDepthFrame(
std::function<void (const float *, unsigned int, unsigned int,
unsigned int, const std::string &)> _subscriber);
public: event::ConnectionPtr ConnectNewRGBPointCloud(
std::function<void (const float *, unsigned int, unsigned int,
unsigned int, const std::string &)> _subscriber);
private: virtual void RenderImpl();
private: void UpdateRenderTarget(Ogre::RenderTarget *_target,
Ogre::Material *_material,
const std::string &_matName);
protected: Ogre::Texture *depthTexture;
protected: Ogre::RenderTarget *depthTarget;
protected: Ogre::Viewport *depthViewport;
private: std::unique_ptr<DepthCameraPrivate> dataPtr;
};
}
}
#endif
gazebo::rendering::DepthCamera::SetDepthTarget
virtual void SetDepthTarget(Ogre::RenderTarget *_target)
Set the render target, which renders the depth data.
Ogre
Definition: JointMaker.hh:39
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
gazebo::rendering::DepthCamera::ConnectNewRGBPointCloud
event::ConnectionPtr ConnectNewRGBPointCloud(std::function< void(const float *, unsigned int, unsigned int, unsigned int, const std::string &)> _subscriber)
Connect a to the new rgb point cloud signal.
system.hh
Camera.hh
CommonTypes.hh
gazebo::rendering::DepthCamera::CreateDepthTexture
void CreateDepthTexture(const std::string &_textureName)
Create a texture which will hold the depth data.
gazebo::rendering::DepthCamera::Load
void Load()
Load the camera with default parmeters.
gazebo::rendering::DepthCamera::depthTexture
Ogre::Texture * depthTexture
Pointer to the depth texture.
Definition: DepthCamera.hh:117
gazebo::rendering::DepthCamera
Depth camera used to render depth data into an image buffer.
Definition: DepthCamera.hh:51
gazebo::rendering::ScenePtr
boost::shared_ptr< Scene > ScenePtr
Definition: RenderTypes.hh:82
rendering
rendering
Definition: RenderEngine.hh:31
gazebo::rendering::DepthCamera::depthTarget
Ogre::RenderTarget * depthTarget
Pointer to the depth target.
Definition: DepthCamera.hh:120
gazebo::rendering::DepthCamera::PostRender
virtual void PostRender()
Render the camera.
gazebo::rendering::DepthCamera::DepthData
virtual const float * DepthData() const
All things needed to get back z buffer for depth data.
gazebo::event::ConnectionPtr
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:134
gazebo::msgs::Init
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
gazebo::rendering::DepthCamera::Fini
void Fini()
Finalize the camera.
gazebo::rendering::DepthCamera::DepthCamera
DepthCamera(const std::string &_namePrefix, ScenePtr _scene, bool _autoRender=true)
Constructor.
gazebo::rendering::DepthCamera::depthViewport
Ogre::Viewport * depthViewport
Pointer to the depth viewport.
Definition: DepthCamera.hh:123
gazebo::rendering::DepthCamera::ConnectNewDepthFrame
event::ConnectionPtr ConnectNewDepthFrame(std::function< void(const float *, unsigned int, unsigned int, unsigned int, const std::string &)> _subscriber)
Connect a to the new depth image signal.
gazebo::rendering::Camera
Basic camera sensor.
Definition: Camera.hh:84
gazebo::rendering::DepthCamera::Init
void Init()
Initialize the camera.
gazebo::rendering::DepthCamera::~DepthCamera
virtual ~DepthCamera()
Destructor.