Gazebo Sensors

API Reference

9.0.0
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/utils/SuppressWarning.hh>
28
29#include <gz/msgs/image.pb.h>
30
31// TODO(louise) Remove these pragmas once gz-rendering is disabling the
32// warnings
33#ifdef _WIN32
34#pragma warning(push)
35#pragma warning(disable: 4251)
36#endif
37#include <gz/rendering/ThermalCamera.hh>
38#ifdef _WIN32
39#pragma warning(pop)
40#endif
41
42#include "gz/sensors/thermal_camera/Export.hh"
44#include "gz/sensors/Export.hh"
45#include "gz/sensors/Sensor.hh"
46
47namespace gz
48{
49 namespace sensors
50 {
51 // Inline bracket to help doxygen filtering.
52 inline namespace GZ_SENSORS_VERSION_NAMESPACE {
53 // forward declarations
54 class ThermalCameraSensorPrivate;
55
63 class GZ_SENSORS_THERMAL_CAMERA_VISIBLE ThermalCameraSensor
64 : public CameraSensor
65 {
68
70 public: virtual ~ThermalCameraSensor();
71
75 public: virtual bool Load(const sdf::Sensor &_sdf) override;
76
80 public: virtual bool Load(sdf::ElementPtr _sdf) override;
81
84 public: virtual bool Init() override;
85
89 public: virtual bool Update(
90 const std::chrono::steady_clock::duration &_now) override;
91
94 public: virtual rendering::ThermalCameraPtr ThermalCamera() const;
95
102 public: void OnNewThermalFrame(const uint16_t *_scan,
103 unsigned int _width, unsigned int _height,
104 unsigned int _channels,
105 const std::string &_format);
106
115 public: common::ConnectionPtr ConnectImageCallback(
116 std::function<void(const msgs::Image &)> _callback);
117
120 public: virtual void SetScene(
121 gz::rendering::ScenePtr _scene) override;
122
125 public: virtual unsigned int ImageWidth() const override;
126
129 public: virtual unsigned int ImageHeight() const override;
130
133 public: virtual void SetAmbientTemperature(float _ambient);
134
138 public: virtual void SetAmbientTemperatureRange(float _range);
139
142 public: virtual void SetMinTemperature(float _min);
143
146 public: virtual void SetMaxTemperature(float _max);
147
153 public: virtual void SetLinearResolution(float _resolution);
154
155 // Documentation inherited.
156 public: virtual bool HasConnections() const override;
157
160 private: bool CreateCamera();
161
165 private: void OnSceneChange(gz::rendering::ScenePtr /*_scene*/)
166 { }
167
168 GZ_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING
172 GZ_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING
173 };
174 }
175 }
176}
177
178#endif