17 #ifndef _GAZEBO_RENDERING_GPULASER_HH_
18 #define _GAZEBO_RENDERING_GPULASER_HH_
42 class AutoParamDataSource;
64 :
public Camera,
public Ogre::RenderObjectListener
70 public:
GpuLaser(
const std::string &_namePrefix,
71 ScenePtr _scene,
bool _autoRender =
true);
77 public:
virtual void Load(sdf::ElementPtr _sdf);
80 public:
virtual void Load();
83 public:
virtual void Init();
86 public:
virtual void Fini();
90 public:
void CreateLaserTexture(
const std::string &_textureName);
93 public:
virtual void PostRender();
97 public:
const float *GetLaserData();
103 public:
template<
typename T>
105 {
return newLaserFrame.Connect(_subscriber); }
110 { newLaserFrame.Disconnect(_c); }
115 public:
void SetRangeCount(
unsigned int _w,
unsigned int _h = 1);
119 public:
virtual void notifyRenderSingleObject(Ogre::Renderable *_rend,
120 const Ogre::Pass *_p,
const Ogre::AutoParamDataSource *_s,
121 const Ogre::LightList *_ll,
bool _supp);
125 public:
double GetHorzHalfAngle()
const;
129 public:
double GetVertHalfAngle()
const;
133 public:
void SetHorzHalfAngle(
double _angle);
137 public:
void SetVertHalfAngle(
double _angle);
141 public:
void SetIsHorizontal(
bool _horizontal);
145 public:
bool IsHorizontal()
const;
149 public:
double GetHorzFOV()
const;
153 public:
double GetCosHorzFOV()
const;
157 public:
void SetCosHorzFOV(
double _chfov);
161 public:
double GetVertFOV()
const;
165 public:
double GetCosVertFOV()
const;
169 public:
void SetCosVertFOV(
double _cvfov);
173 public:
double GetNearClip()
const;
177 public:
double GetFarClip()
const;
181 public:
void SetNearClip(
double _near);
185 public:
void SetFarClip(
double _far);
189 public:
void SetHorzFOV(
double _hfov);
193 public:
void SetVertFOV(
double _vfov);
197 public:
double GetCameraCount()
const;
202 public:
void SetCameraCount(
double _cameraCount);
206 public:
double GetRayCountRatio()
const;
210 public:
void SetRayCountRatio(
double _rayCountRatio);
213 private:
virtual void RenderImpl();
220 private:
void UpdateRenderTarget(Ogre::RenderTarget *_target,
221 Ogre::Material *_material,
223 bool _updateTex =
false);
226 private:
void CreateOrthoCam();
229 private:
void CreateMesh();
232 private:
void CreateCanvas();
242 private: Ogre::Matrix4 BuildScaledOrthoMatrix(
float _left,
float _right,
243 float _bottom,
float _top,
float _near,
float _far);
248 private:
virtual void Set1stPassTarget(Ogre::RenderTarget *_target,
249 unsigned int _index);
253 private:
virtual void Set2ndPassTarget(Ogre::RenderTarget *_target);
294 private:
event::EventT<void(
const float *_frame,
unsigned int _width,
295 unsigned int _height,
unsigned int _depth,
296 const std::string &_format)> newLaserFrame;
299 private:
float *laserBuffer;
302 private:
float *laserScan;
305 private: Ogre::Material *matFirstPass;
308 private: Ogre::Material *matSecondPass;
311 private: Ogre::Texture *firstPassTextures[3];
314 private: Ogre::Texture *secondPassTexture;
317 private: Ogre::RenderTarget *firstPassTargets[3];
320 private: Ogre::RenderTarget *secondPassTarget;
323 private: Ogre::Viewport *firstPassViewports[3];
326 private: Ogre::Viewport *secondPassViewport;
329 private:
unsigned int textureCount;
332 private:
double cameraYaws[4];
335 private: Ogre::RenderTarget *currentTarget;
338 private: Ogre::Material *currentMat;
342 private: Ogre::Camera *orthoCam;
345 private: Ogre::SceneNode *pitchNodeOrtho;
352 private: Ogre::MovableObject *object;
358 private:
unsigned int w2nd;
361 private:
unsigned int h2nd;
364 private:
double lastRenderDuration;
368 private: std::vector<int> texIdx;
371 private:
static int texCount;
A 3D mesh.
Definition: Mesh.hh:44
void DisconnectNewLaserFrame(event::ConnectionPtr &_c)
Disconnect from a laser frame signal.
Definition: GpuLaser.hh:109
Basic camera sensor.
Definition: Camera.hh:78
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:147
GPU based laser distance sensor.
Definition: GpuLaser.hh:63
double rayCountRatio
Ray count ratio.
Definition: GpuLaser.hh:262
double vertHalfAngle
Vertical half angle.
Definition: GpuLaser.hh:259
unsigned int cameraCount
Number of cameras needed to generate the rays.
Definition: GpuLaser.hh:286
double farClip
Far clip plane.
Definition: GpuLaser.hh:280
double nearClip
Near clip plane.
Definition: GpuLaser.hh:277
#define GZ_RENDERING_VISIBLE
Definition: system.hh:241
double hfov
Horizontal field-of-view.
Definition: GpuLaser.hh:265
event::ConnectionPtr ConnectNewLaserFrame(T _subscriber)
Connect to a laser frame signal.
Definition: GpuLaser.hh:104
double horzHalfAngle
Horizontal half angle.
Definition: GpuLaser.hh:256
double cvfov
Cos vertical field-of-view.
Definition: GpuLaser.hh:274
double chfov
Cos horizontal field-of-view.
Definition: GpuLaser.hh:271
boost::shared_ptr< Scene > ScenePtr
Definition: RenderTypes.hh:79
bool isHorizontal
True if the sensor is horizontal only.
Definition: GpuLaser.hh:283
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
A class for event processing.
Definition: Event.hh:178
boost::shared_ptr< Visual > VisualPtr
Definition: RenderTypes.hh:107
double vfov
Vertical field-of-view.
Definition: GpuLaser.hh:268