Ignition Sensors

API Reference

6.0.1
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 IGNITION_SENSORS_SEGMENTATIONCAMERASENSOR_HH_
19 #define IGNITION_SENSORS_SEGMENTATIONCAMERASENSOR_HH_
20 
21 #include <memory>
22 #include <string>
23 
24 #include <ignition/common/Event.hh>
25 #include <ignition/common/PluginMacros.hh>
26 #include <ignition/common/SuppressWarning.hh>
27 #include <ignition/common/Time.hh>
28 #include <ignition/msgs.hh>
29 #include <ignition/transport/Node.hh>
30 #include <ignition/transport/Publisher.hh>
31 #include <sdf/sdf.hh>
32 
34 #include "ignition/sensors/Export.hh"
36 
37 #include "ignition/sensors/segmentation_camera/Export.hh"
38 
39 namespace ignition
40 {
41  namespace sensors
42  {
43  // Inline bracket to help doxygen filtering.
44  inline namespace IGNITION_SENSORS_VERSION_NAMESPACE {
45  // forward declarations
46  class SegmentationCameraSensorPrivate;
47 
55  class IGNITION_SENSORS_SEGMENTATION_CAMERA_VISIBLE
57  {
59  public: SegmentationCameraSensor();
60 
62  public: virtual ~SegmentationCameraSensor();
63 
67  public: virtual bool Load(const sdf::Sensor &_sdf) override;
68 
72  public: virtual bool Load(sdf::ElementPtr _sdf) override;
73 
76  public: virtual bool Init() override;
77 
81  public: virtual bool Update(
82  const std::chrono::steady_clock::duration &_now) override;
83 
86  public: rendering::SegmentationCameraPtr SegmentationCamera() const;
87 
94  public: void OnNewSegmentationFrame(const uint8_t * _data,
95  unsigned int _width, unsigned int _height, unsigned int _channels,
96  const std::string &_format);
97 
106  public: ignition::common::ConnectionPtr ConnectImageCallback(
107  std::function<void(const ignition::msgs::Image &)> _callback);
108 
111  public: virtual void SetScene(
112  ignition::rendering::ScenePtr _scene) override;
113 
116  public: virtual unsigned int ImageWidth() const override;
117 
120  public: virtual unsigned int ImageHeight() const override;
121 
124  private: bool CreateCamera();
125 
126  IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING
130  IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING
131  };
132  }
133  }
134 }
135 
136 #endif
Camera Sensor Class.
Definition: CameraSensor.hh:71
Segmentation camera sensor class.
Definition: SegmentationCameraSensor.hh:55
STL class.
Definition: AirPressureSensor.hh:31