Gazebo Sensors

API Reference

9.0.0~pre2
WideAngleCameraSensor.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2021 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_WIDEANGLECAMERASENSOR_HH_
18#define GZ_SENSORS_WIDEANGLECAMERASENSOR_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/WideAngleCamera.hh>
38#ifdef _WIN32
39#pragma warning(pop)
40#endif
41
42#include "gz/sensors/wide_angle_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 WideAngleCameraSensorPrivate;
55
63 class GZ_SENSORS_WIDE_ANGLE_CAMERA_VISIBLE WideAngleCameraSensor
64 : public CameraSensor
65 {
68
70 public: virtual ~WideAngleCameraSensor();
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::WideAngleCameraPtr WideAngleCamera() const;
95
102 public: void OnNewWideAngleFrame(const unsigned char *_data,
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
131 // Documentation inherited.
132 public: rendering::CameraPtr RenderingCamera() const override;
133
134 // Documentation inherited.
135 public: virtual bool HasConnections() const override;
136
139 private: bool CreateCamera();
140
141 GZ_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING
145 GZ_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING
146 };
147 }
148 }
149}
150
151#endif