CARLA
CarlaDVSCameraPublisher.h
Go to the documentation of this file.
1 // Copyright (c) 2022 Computer Vision Center (CVC) at the Universitat Autonoma de Barcelona (UAB).
2 // This work is licensed under the terms of the MIT license.
3 // For a copy, see <https://opensource.org/licenses/MIT>.
4 
5 #pragma once
6 #define _GLIBCXX_USE_CXX11_ABI 0
7 
8 #include <memory>
9 #include <vector>
10 
11 #include "CarlaPublisher.h"
12 
13 namespace carla {
14 namespace ros2 {
15 
16  struct CarlaDVSCameraPublisherImpl;
17  struct CarlaCameraInfoPublisherImpl;
18  struct CarlaPointCloudPublisherImpl;
19 
21  public:
22  CarlaDVSCameraPublisher(const char* ros_name = "", const char* parent = "");
28 
29  bool Init();
30  void InitInfoData(uint32_t x_offset, uint32_t y_offset, uint32_t height, uint32_t width, float fov, bool do_rectify);
31  bool Publish();
32 
33  bool HasBeenInitialized() const;
34  void SetImageData(int32_t seconds, uint32_t nanoseconds, size_t elements, size_t height, size_t width, const uint8_t* data);
35  void SetCameraInfoData(int32_t seconds, uint32_t nanoseconds);
36  void SetPointCloudData(size_t height, size_t width, size_t elements, const uint8_t* data);
37  const char* type() const override { return "dvs camera"; }
38 
39  private:
40  private:
41  bool InitImage();
42  bool InitInfo();
43  bool InitPointCloud();
44 
45  void SetInfoRegionOfInterest( uint32_t x_offset, uint32_t y_offset, uint32_t height, uint32_t width, bool do_rectify);
46  void SetData(int32_t seconds, uint32_t nanoseconds, size_t height, size_t width, std::vector<uint8_t>&& data);
47  void SetPointCloudData(size_t height, size_t width, std::vector<uint8_t>&& data);
48  bool PublishImage();
49  bool PublishInfo();
50  bool PublishPointCloud();
51 
52  private:
53  std::shared_ptr<CarlaDVSCameraPublisherImpl> _impl;
54  std::shared_ptr<CarlaCameraInfoPublisherImpl> _info;
55  std::shared_ptr<CarlaPointCloudPublisherImpl> _point_cloud;
56  };
57 }
58 }
void SetInfoRegionOfInterest(uint32_t x_offset, uint32_t y_offset, uint32_t height, uint32_t width, bool do_rectify)
CarlaDVSCameraPublisher(const char *ros_name="", const char *parent="")
void SetPointCloudData(size_t height, size_t width, size_t elements, const uint8_t *data)
void SetImageData(int32_t seconds, uint32_t nanoseconds, size_t elements, size_t height, size_t width, const uint8_t *data)
This file contains definitions of common data structures used in traffic manager. ...
Definition: Carla.cpp:133
void SetData(int32_t seconds, uint32_t nanoseconds, size_t height, size_t width, std::vector< uint8_t > &&data)
CarlaDVSCameraPublisher & operator=(const CarlaDVSCameraPublisher &)
std::shared_ptr< CarlaPointCloudPublisherImpl > _point_cloud
void SetCameraInfoData(int32_t seconds, uint32_t nanoseconds)
const std::string & parent() const
std::shared_ptr< CarlaCameraInfoPublisherImpl > _info
void InitInfoData(uint32_t x_offset, uint32_t y_offset, uint32_t height, uint32_t width, float fov, bool do_rectify)
std::shared_ptr< CarlaDVSCameraPublisherImpl > _impl