##

GpuLaser.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_GPULASER_HH_
#define _GAZEBO_RENDERING_GPULASER_HH_
#include <memory>
#include <string>
#include <sdf/sdf.hh>
#include "gazebo/rendering/ogre_gazebo.h"
#include "gazebo/rendering/Camera.hh"
#include "gazebo/rendering/GpuLaserDataIterator.hh"
#include "gazebo/rendering/RenderTypes.hh"
#include "gazebo/util/system.hh"
namespace Ogre
{
class Material;
class Renderable;
class Pass;
class AutoParamDataSource;
class Matrix4;
class MovableObject;
}
namespace gazebo
{
namespace common
{
class Mesh;
}
namespace rendering
{
// Forward declare private data.
class GpuLaserPrivate;
class GZ_RENDERING_VISIBLE GpuLaser
: public Camera, public Ogre::RenderObjectListener
{
public: GpuLaser(const std::string &_namePrefix,
ScenePtr _scene, const bool _autoRender = true);
public: virtual ~GpuLaser();
// Documentation inherited
public: virtual void Load(sdf::ElementPtr _sdf);
// Documentation inherited
public: virtual void Load();
// Documentation inherited
public: virtual void Init();
// Documentation inherited
public: virtual void Fini();
public: void CreateLaserTexture(const std::string &_textureName);
// Documentation inherited
public: virtual void PostRender();
public: const float *LaserData() const GAZEBO_DEPRECATED(9.0);
public: typedef GpuLaserDataIterator<GpuLaser> DataIter;
public: DataIter LaserDataBegin() const;
public: DataIter LaserDataEnd() const;
public: event::ConnectionPtr ConnectNewLaserFrame(
std::function<void (const float *_frame, unsigned int _width,
unsigned int _height, unsigned int _depth,
const std::string &_format)> _subscriber);
public: void SetRangeCount(const unsigned int _w,
const unsigned int _h = 1);
public: virtual void notifyRenderSingleObject(Ogre::Renderable *_rend,
const Ogre::Pass *_p, const Ogre::AutoParamDataSource *_s,
const Ogre::LightList *_ll, bool _supp);
public: double HorzHalfAngle() const;
public: double VertHalfAngle() const;
public: void SetHorzHalfAngle(const double _angle);
public: void SetVertHalfAngle(const double _angle);
public: void SetIsHorizontal(const bool _horizontal);
public: bool IsHorizontal() const;
public: double HorzFOV() const;
public: double CosHorzFOV() const;
public: void SetCosHorzFOV(const double _chfov);
public: double VertFOV() const;
public: double CosVertFOV() const;
public: void SetCosVertFOV(const double _cvfov);
public: double NearClip() const;
public: double FarClip() const;
public: void SetNearClip(const double _near);
public: void SetFarClip(const double _far);
public: void SetHorzFOV(const double _hfov);
public: void SetVertFOV(const double _vfov);
public: unsigned int CameraCount() const;
public: void SetCameraCount(const unsigned int _cameraCount);
public: double RayCountRatio() const;
public: void SetRayCountRatio(const double _rayCountRatio);
// Documentation inherited.
private: virtual void RenderImpl();
private: void UpdateRenderTarget(Ogre::RenderTarget *_target,
Ogre::Material *_material,
Ogre::Camera *_cam,
const bool _updateTex = false);
private: void CreateOrthoCam();
private: void CreateMesh();
private: void CreateCanvas();
private: Ogre::Matrix4 BuildScaledOrthoMatrix(const float _left,
const float _right, const float _bottom, const float _top,
const float _near, const float _far);
private: virtual void Set1stPassTarget(Ogre::RenderTarget *_target,
const unsigned int _index);
private: virtual void Set2ndPassTarget(Ogre::RenderTarget *_target);
protected: double horzHalfAngle;
protected: double vertHalfAngle;
protected: double rayCountRatio;
protected: double hfov;
protected: double vfov;
protected: double chfov;
protected: double cvfov;
protected: double nearClip;
protected: double farClip;
protected: bool isHorizontal;
protected: unsigned int cameraCount;
private: std::unique_ptr<GpuLaserPrivate> dataPtr;
};
}
}
#endif
gazebo::rendering::GpuLaser::vfov
double vfov
Vertical field-of-view.
Definition: GpuLaser.hh:272
Ogre
Definition: JointMaker.hh:39
gazebo::rendering::GpuLaser::SetVertFOV
void SetVertFOV(const double _vfov)
Set the vertical fov.
gazebo::rendering::GpuLaser::Load
virtual void Load()
Load the camera with default parameters.
gazebo::rendering::GpuLaser::horzHalfAngle
double horzHalfAngle
Horizontal half angle.
Definition: GpuLaser.hh:260
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
gazebo::rendering::GpuLaser::~GpuLaser
virtual ~GpuLaser()
Destructor.
gazebo::rendering::GpuLaser::CosVertFOV
double CosVertFOV() const
Get Cos Vert field-of-view.
gazebo::rendering::GpuLaser::SetCosVertFOV
void SetCosVertFOV(const double _cvfov)
Set the Cos Horz FOV.
gazebo::rendering::GpuLaser::SetIsHorizontal
void SetIsHorizontal(const bool _horizontal)
Set sensor horizontal or vertical.
gazebo::rendering::GpuLaser::SetHorzFOV
void SetHorzFOV(const double _hfov)
Set the horizontal fov.
common
common
Definition: FuelModelDatabase.hh:37
gazebo::rendering::GpuLaser::NearClip
double NearClip() const
Get near clip.
gazebo::rendering::GpuLaser::SetRangeCount
void SetRangeCount(const unsigned int _w, const unsigned int _h=1)
Set the number of samples in the width and height for the first pass texture.
gazebo::rendering::GpuLaser::hfov
double hfov
Horizontal field-of-view.
Definition: GpuLaser.hh:269
system.hh
Camera.hh
gazebo::rendering::GpuLaser::IsHorizontal
bool IsHorizontal() const
Gets if sensor is horizontal.
gazebo::rendering::GpuLaser::notifyRenderSingleObject
virtual void notifyRenderSingleObject(Ogre::Renderable *_rend, const Ogre::Pass *_p, const Ogre::AutoParamDataSource *_s, const Ogre::LightList *_ll, bool _supp)
gazebo::rendering::GpuLaser::SetNearClip
void SetNearClip(const double _near)
Set the near clip distance.
gazebo::rendering::GpuLaser::CreateLaserTexture
void CreateLaserTexture(const std::string &_textureName)
Create the texture which is used to render laser data.
gazebo::rendering::GpuLaser::GpuLaser
GpuLaser(const std::string &_namePrefix, ScenePtr _scene, const bool _autoRender=true)
Constructor.
gazebo::rendering::GpuLaser::chfov
double chfov
Cos horizontal field-of-view.
Definition: GpuLaser.hh:275
gazebo::rendering::GpuLaser::ConnectNewLaserFrame
event::ConnectionPtr ConnectNewLaserFrame(std::function< void(const float *_frame, unsigned int _width, unsigned int _height, unsigned int _depth, const std::string &_format)> _subscriber)
Connect to a laser frame signal.
gazebo::rendering::ScenePtr
boost::shared_ptr< Scene > ScenePtr
Definition: RenderTypes.hh:82
gazebo::rendering::GpuLaser::CameraCount
unsigned int CameraCount() const
Get the number of cameras required.
RenderTypes.hh
gazebo::rendering::GpuLaser::vertHalfAngle
double vertHalfAngle
Vertical half angle.
Definition: GpuLaser.hh:263
rendering
rendering
Definition: RenderEngine.hh:31
gazebo::rendering::GpuLaser::VertFOV
double VertFOV() const
Get the vertical field-of-view.
gazebo::rendering::GpuLaser::HorzFOV
double HorzFOV() const
Get the horizontal field of view of the laser sensor.
gazebo::rendering::GpuLaser::DataIter
GpuLaserDataIterator< GpuLaser > DataIter
Constant iterator to access laser data.
Definition: GpuLaser.hh:96
gazebo::rendering::GpuLaser::VertHalfAngle
double VertHalfAngle() const
Get (vertical_max_angle + vertical_min_angle) * 0.5.
gazebo::rendering::GpuLaser::SetVertHalfAngle
void SetVertHalfAngle(const double _angle)
Set the vertical half angle.
gazebo::rendering::GpuLaser::Fini
virtual void Fini()
Finalize the camera.
gazebo::rendering::GpuLaser::PostRender
virtual void PostRender()
Post render.
gazebo::event::ConnectionPtr
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:134
gazebo::rendering::GpuLaser::LaserData
const float * LaserData() const GAZEBO_DEPRECATED(9.0)
All things needed to get back z buffer for laser data.
ogre_gazebo.h
gazebo::msgs::Init
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
gazebo::rendering::GpuLaser::SetHorzHalfAngle
void SetHorzHalfAngle(const double _angle)
Set the horizontal half angle.
gazebo::rendering::GpuLaser::nearClip
double nearClip
Near clip plane.
Definition: GpuLaser.hh:281
gazebo::rendering::GpuLaser::SetRayCountRatio
void SetRayCountRatio(const double _rayCountRatio)
Sets the ray count ratio (equivalent to aspect ratio)
gazebo::rendering::GpuLaser::isHorizontal
bool isHorizontal
True if the sensor is horizontal only.
Definition: GpuLaser.hh:287
gazebo::rendering::GpuLaser::rayCountRatio
double rayCountRatio
Ray count ratio.
Definition: GpuLaser.hh:266
gazebo::rendering::GpuLaser::RayCountRatio
double RayCountRatio() const
Get the ray count ratio (equivalent to aspect ratio)
GAZEBO_DEPRECATED
#define GAZEBO_DEPRECATED(version)
Definition: system.hh:328
gazebo::rendering::GpuLaser::HorzHalfAngle
double HorzHalfAngle() const
Get (horizontal_max_angle + horizontal_min_angle) * 0.5.
gazebo::rendering::GpuLaser::SetCosHorzFOV
void SetCosHorzFOV(const double _chfov)
Set the Cos Horz FOV.
GpuLaserDataIterator.hh
gazebo::rendering::GpuLaser::Init
virtual void Init()
Initialize the camera.
gazebo::rendering::GpuLaser::LaserDataEnd
DataIter LaserDataEnd() const
Return an iterator to one past the end of the laser data.
gazebo::rendering::GpuLaser::CosHorzFOV
double CosHorzFOV() const
Get Cos Horz field-of-view.
gazebo::rendering::GpuLaser::farClip
double farClip
Far clip plane.
Definition: GpuLaser.hh:284
gazebo::rendering::Camera
Basic camera sensor.
Definition: Camera.hh:84
gazebo::rendering::GpuLaser::LaserDataBegin
DataIter LaserDataBegin() const
Return an iterator to the begining of the laser data.
gazebo::rendering::GpuLaser::cvfov
double cvfov
Cos vertical field-of-view.
Definition: GpuLaser.hh:278
gazebo::rendering::GpuLaserDataIterator
const Bidirectional iterator for laser data
Definition: GpuLaserDataIterator.hh:53
gazebo::rendering::GpuLaser::FarClip
double FarClip() const
Get far clip.
gazebo::rendering::GpuLaser::SetCameraCount
void SetCameraCount(const unsigned int _cameraCount)
Set the number of cameras required.
gazebo::rendering::GpuLaser::cameraCount
unsigned int cameraCount
Number of cameras needed to generate the rays.
Definition: GpuLaser.hh:290
gazebo::rendering::GpuLaser
GPU based laser distance sensor.
Definition: GpuLaser.hh:58
gazebo::rendering::GpuLaser::SetFarClip
void SetFarClip(const double _far)
Set the far clip distance.