CameraSensor.h
Go to the documentation of this file.
1 /*+-------------------------------------------------------------------------+
2  | MultiVehicle simulator (libmvsim) |
3  | |
4  | Copyright (C) 2014-2023 Jose Luis Blanco Claraco |
5  | Copyright (C) 2017 Borys Tymchenko (Odessa Polytechnic University) |
6  | Distributed under 3-clause BSD License |
7  | See COPYING |
8  +-------------------------------------------------------------------------+ */
9 
10 #pragma once
11 
12 #include <mrpt/obs/CObservationImage.h>
13 #include <mrpt/opengl/CFBORender.h>
15 
16 #include <mutex>
17 
18 namespace mvsim
19 {
22 class CameraSensor : public SensorBase
23 {
25 
26  public:
28  virtual ~CameraSensor();
29 
30  // See docs in base class
31  virtual void loadConfigFrom(const rapidxml::xml_node<char>* root) override;
32 
33  virtual void simul_pre_timestep(const TSimulContext& context) override;
34  virtual void simul_post_timestep(const TSimulContext& context) override;
35 
36  void simulateOn3DScene(mrpt::opengl::COpenGLScene& gl_scene) override;
37 
38  void freeOpenGLResources() override;
39 
40  protected:
41  virtual void internalGuiUpdate(
42  const mrpt::optional_ref<mrpt::opengl::COpenGLScene>& viz,
43  const mrpt::optional_ref<mrpt::opengl::COpenGLScene>& physical,
44  bool childrenOnly) override;
45 
46  // Store here all sensor intrinsic parameters. This obj will be copied as a
47  // "pattern" to fill it with actual scan data.
48  mrpt::obs::CObservationImage sensor_params_;
49 
50  std::mutex last_obs_cs_;
52  mrpt::obs::CObservationImage::Ptr last_obs_;
53  mrpt::obs::CObservationImage::Ptr last_obs2gui_;
54 
55  std::shared_ptr<mrpt::opengl::CFBORender> fbo_renderer_rgb_;
56 
59  bool gui_uptodate_ = false;
60 
61  std::optional<TSimulContext> has_to_render_;
62  std::mutex has_to_render_mtx_;
63 
64  float rgbClipMin_ = 1e-2, rgbClipMax_ = 1e+4;
65 
66  mrpt::opengl::CSetOfObjects::Ptr gl_sensor_origin_,
68  mrpt::opengl::CSetOfObjects::Ptr gl_sensor_fov_, gl_sensor_frustum_;
69 };
70 } // namespace mvsim
mrpt::obs::CObservationImage sensor_params_
Definition: CameraSensor.h:48
std::shared_ptr< mrpt::opengl::CFBORender > fbo_renderer_rgb_
Definition: CameraSensor.h:55
mrpt::obs::CObservationImage::Ptr last_obs_
Definition: CameraSensor.h:52
mrpt::opengl::CSetOfObjects::Ptr gl_sensor_origin_corner_
Definition: CameraSensor.h:66
std::optional< TSimulContext > has_to_render_
Definition: CameraSensor.h:61
virtual void internalGuiUpdate(const mrpt::optional_ref< mrpt::opengl::COpenGLScene > &viz, const mrpt::optional_ref< mrpt::opengl::COpenGLScene > &physical, bool childrenOnly) override
virtual void simul_post_timestep(const TSimulContext &context) override
mrpt::opengl::CSetOfObjects::Ptr gl_sensor_fov_
Definition: CameraSensor.h:68
virtual void simul_pre_timestep(const TSimulContext &context) override
void simulateOn3DScene(mrpt::opengl::COpenGLScene &gl_scene) override
std::mutex last_obs_cs_
Definition: CameraSensor.h:50
mrpt::obs::CObservationImage::Ptr last_obs2gui_
Definition: CameraSensor.h:53
CameraSensor(Simulable &parent, const rapidxml::xml_node< char > *root)
mrpt::opengl::CSetOfObjects::Ptr gl_sensor_origin_
Definition: CameraSensor.h:66
virtual void loadConfigFrom(const rapidxml::xml_node< char > *root) override
#define DECLARES_REGISTER_SENSOR(CLASS_NAME)
Definition: SensorBase.h:118
void freeOpenGLResources() override
std::mutex has_to_render_mtx_
Definition: CameraSensor.h:62
mrpt::opengl::CSetOfObjects::Ptr gl_sensor_frustum_
Definition: CameraSensor.h:68


mvsim
Author(s):
autogenerated on Tue Jul 4 2023 03:08:19