Autoware.Auto
camera_list_wrapper.hpp
Go to the documentation of this file.
1 // Copyright 2020 Apex.AI, Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //    http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef SPINNAKER_CAMERA_DRIVER__CAMERA_LIST_WRAPPER_HPP_
16 #define SPINNAKER_CAMERA_DRIVER__CAMERA_LIST_WRAPPER_HPP_
17 
18 #ifndef DOXYGEN_SKIP
19 #include <spinnaker/Spinnaker.h>
20 #endif
21 
22 #include <sensor_msgs/msg/image.hpp>
25 
26 #include <cstdint>
27 #include <memory>
28 #include <string>
29 #include <vector>
30 #include <functional>
31 
32 namespace autoware
33 {
36 namespace drivers
37 {
39 namespace camera
40 {
42 namespace spinnaker
43 {
44 
49 class SPINNAKER_CAMERA_PUBLIC CameraListWrapper
50 {
51 public:
53  explicit CameraListWrapper(
54  Spinnaker::CameraList camera_list,
55  const CameraSettings & camera_settings);
56 
58  explicit CameraListWrapper(
59  Spinnaker::CameraList camera_list,
60  const std::vector<CameraSettings> & camera_settings);
61 
63  virtual ~CameraListWrapper();
64 
65  // Satisfy the rule of all or nothing: we need a custom destructor,
66  // so we need to define all constructors.
67  // We don't expect this class to be coppied over, so all of these are deleted.
68  CameraListWrapper(const CameraListWrapper &) = delete;
69  CameraListWrapper & operator=(const CameraListWrapper &) = delete;
70 
71  // It's still ok to move the camera list.
73  CameraListWrapper & operator=(CameraListWrapper &&) = default;
74 
76  void start_capturing();
77 
79  void stop_capturing();
80 
82  std::unique_ptr<sensor_msgs::msg::Image> retreive_image_from_camera(
83  const std::uint32_t camera_index) const;
84 
86  inline std::size_t get_number_of_cameras() const {return m_cameras.size();}
87 
89  void set_image_callback(CameraWrapper::ImageCallbackFunction callback);
90 
91 private:
93  Spinnaker::CameraList m_camera_list{};
95  std::vector<CameraWrapper> m_cameras{};
96 };
97 
98 } // namespace spinnaker
99 } // namespace camera
100 } // namespace drivers
101 } // namespace autoware
102 
103 #endif // SPINNAKER_CAMERA_DRIVER__CAMERA_LIST_WRAPPER_HPP_
autoware::drivers::camera::spinnaker::CameraListWrapper::get_number_of_cameras
std::size_t get_number_of_cameras() const
Get number of cameras.
Definition: camera_list_wrapper.hpp:86
autoware::drivers::camera::spinnaker::CameraSettings
Encapsulate settings that make sense to pass to a camera.
Definition: camera_settings.hpp:35
autoware
This file defines the lanelet2_map_provider_node class.
Definition: quick_sort.hpp:24
visibility_control.hpp
autoware::drivers::camera::spinnaker::CameraWrapper::ImageCallbackFunction
std::function< void(std::uint32_t, std::unique_ptr< sensor_msgs::msg::Image >)> ImageCallbackFunction
A typedef for the callback function used to return an image message to the user.
Definition: camera_wrapper.hpp:49
camera_wrapper.hpp
autoware::drivers::camera::spinnaker::CameraListWrapper
Definition: camera_list_wrapper.hpp:49