Gazebo Sensors

API Reference

6.9.0
gz/sensors/ThermalCameraSensor.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 #ifndef GZ_SENSORS_THERMALCAMERASENSOR_HH_
18 #define GZ_SENSORS_THERMALCAMERASENSOR_HH_
19 
20 #include <memory>
21 #include <cstdint>
22 #include <string>
23 
24 #include <sdf/sdf.hh>
25 
26 #include <gz/common/Event.hh>
27 #include <gz/common/SuppressWarning.hh>
28 
29 #ifdef _WIN32
30 #pragma warning(push)
31 #pragma warning(disable: 4005)
32 #pragma warning(disable: 4251)
33 #endif
34 #include <ignition/msgs.hh>
35 #ifdef _WIN32
36 #pragma warning(pop)
37 #endif
38 
39 // TODO(louise) Remove these pragmas once ign-rendering is disabling the
40 // warnings
41 #ifdef _WIN32
42 #pragma warning(push)
43 #pragma warning(disable: 4251)
44 #endif
45 #include <gz/rendering/ThermalCamera.hh>
46 #ifdef _WIN32
47 #pragma warning(pop)
48 #endif
49 
50 #include "gz/sensors/thermal_camera/Export.hh"
52 #include "gz/sensors/Export.hh"
53 #include "gz/sensors/Sensor.hh"
54 
55 namespace ignition
56 {
57  namespace sensors
58  {
59  // Inline bracket to help doxygen filtering.
60  inline namespace IGNITION_SENSORS_VERSION_NAMESPACE {
61  // forward declarations
62  class ThermalCameraSensorPrivate;
63 
71  class IGNITION_SENSORS_THERMAL_CAMERA_VISIBLE ThermalCameraSensor
72  : public CameraSensor
73  {
76 
78  public: virtual ~ThermalCameraSensor();
79 
83  public: virtual bool Load(const sdf::Sensor &_sdf) override;
84 
88  public: virtual bool Load(sdf::ElementPtr _sdf) override;
89 
92  public: virtual bool Init() override;
93 
97  public: virtual bool Update(
98  const std::chrono::steady_clock::duration &_now) override;
99 
103  public: virtual rendering::ThermalCameraPtr ThermalCamera();
104 
111  public: void OnNewThermalFrame(const uint16_t *_scan,
112  unsigned int _width, unsigned int _height,
113  unsigned int _channels,
114  const std::string &_format);
115 
124  public: common::ConnectionPtr ConnectImageCallback(
125  std::function<void(const msgs::Image &)> _callback);
126 
129  public: virtual void SetScene(
130  gz::rendering::ScenePtr _scene) override;
131 
134  public: virtual unsigned int ImageWidth() const override;
135 
138  public: virtual unsigned int ImageHeight() const override;
139 
142  public: virtual void SetAmbientTemperature(float _ambient);
143 
147  public: virtual void SetAmbientTemperatureRange(float _range);
148 
151  public: virtual void SetMinTemperature(float _min);
152 
155  public: virtual void SetMaxTemperature(float _max);
156 
162  public: virtual void SetLinearResolution(float _resolution);
163 
167  public: bool HasConnections() const;
168 
171  private: bool CreateCamera();
172 
176  private: void OnSceneChange(gz::rendering::ScenePtr /*_scene*/)
177  { }
178 
179  IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING
183  IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING
184  };
185  }
186  }
187 }
188 
189 #endif
Camera Sensor Class.
Definition: gz/sensors/CameraSensor.hh:72
Thermal camera sensor class.
Definition: gz/sensors/ThermalCameraSensor.hh:73
virtual void SetScene(gz::rendering::ScenePtr _scene) override
Set the rendering scene.
common::ConnectionPtr ConnectImageCallback(std::function< void(const msgs::Image &)> _callback)
Set a callback to be called when image frame data is generated.
virtual void SetAmbientTemperature(float _ambient)
Set the ambient temperature of the environment.
virtual bool Load(sdf::ElementPtr _sdf) override
Load the sensor with SDF parameters.
virtual bool Load(const sdf::Sensor &_sdf) override
Load the sensor based on data from an sdf::Sensor object.
virtual ~ThermalCameraSensor()
destructor
virtual unsigned int ImageHeight() const override
Get image height.
virtual void SetLinearResolution(float _resolution)
Set the temperature linear resolution. The thermal image data returned will be temperature in kelvin ...
virtual rendering::ThermalCameraPtr ThermalCamera()
Force the sensor to generate data.
virtual bool Update(const std::chrono::steady_clock::duration &_now) override
Force the sensor to generate data.
virtual void SetAmbientTemperatureRange(float _range)
Set the range of ambient temperature.
virtual void SetMaxTemperature(float _max)
Set the maximum temperature the sensor can detect.
void OnNewThermalFrame(const uint16_t *_scan, unsigned int _width, unsigned int _height, unsigned int _channels, const std::string &_format)
Thermal data callback used to get the data from the sensor.
virtual bool Init() override
Initialize values in the sensor.
bool HasConnections() const
Check if there are any subscribers.
virtual void SetMinTemperature(float _min)
Set the minimum temperature the sensor can detect.
virtual unsigned int ImageWidth() const override
Get image width.
Definition: gz/sensors/AirPressureSensor.hh:32