Gazebo Sensors

API Reference

9.0.0
SegmentationCameraSensor.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
18#ifndef GZ_SENSORS_SEGMENTATIONCAMERASENSOR_HH_
19#define GZ_SENSORS_SEGMENTATIONCAMERASENSOR_HH_
20
21#include <memory>
22#include <string>
23
24#include <gz/msgs/image.pb.h>
25
26#include <gz/common/Event.hh>
27#include <gz/utils/SuppressWarning.hh>
28#include <gz/transport/Node.hh>
29#include <gz/transport/Publisher.hh>
30#include <sdf/sdf.hh>
31
33#include "gz/sensors/Export.hh"
34#include "gz/sensors/Sensor.hh"
35
36#include "gz/sensors/segmentation_camera/Export.hh"
37
38namespace gz
39{
40 namespace sensors
41 {
42 // Inline bracket to help doxygen filtering.
43 inline namespace GZ_SENSORS_VERSION_NAMESPACE {
44 // forward declarations
45 class SegmentationCameraSensorPrivate;
46
54 class GZ_SENSORS_SEGMENTATION_CAMERA_VISIBLE
56 {
59
61 public: virtual ~SegmentationCameraSensor();
62
66 public: virtual bool Load(const sdf::Sensor &_sdf) override;
67
71 public: virtual bool Load(sdf::ElementPtr _sdf) override;
72
75 public: virtual bool Init() override;
76
80 public: virtual bool Update(
81 const std::chrono::steady_clock::duration &_now) override;
82
85 public: rendering::SegmentationCameraPtr SegmentationCamera() const;
86
93 public: void OnNewSegmentationFrame(const uint8_t * _data,
94 unsigned int _width, unsigned int _height, unsigned int _channels,
95 const std::string &_format);
96
105 public: gz::common::ConnectionPtr ConnectImageCallback(
106 std::function<void(const gz::msgs::Image &)> _callback);
107
110 public: virtual void SetScene(
111 gz::rendering::ScenePtr _scene) override;
112
115 public: virtual unsigned int ImageWidth() const override;
116
119 public: virtual unsigned int ImageHeight() const override;
120
121 // Documentation inherited.
122 public: virtual bool HasConnections() const override;
123
126 private: bool CreateCamera();
127
128 GZ_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING
132 GZ_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING
133 };
134 }
135 }
136}
137
138#endif