CARLA
Loading...
Searching...
No Matches
LibCarla
source
carla
ros2
publishers
CarlaOpticalFlowCameraPublisher.h
Go to the documentation of this file.
1
// Copyright (c) 2026 Computer Vision Center (CVC) at the Universitat Autonoma
2
// de Barcelona (UAB).
3
//
4
// This work is licensed under the terms of the MIT license.
5
// For a copy, see <https://opensource.org/licenses/MIT>.
6
7
#pragma once
8
9
#include "
carla/ros2/publishers/CarlaCameraPublisher.h
"
10
11
#include <cstdint>
12
#include <string>
13
#include <utility>
14
#include <vector>
15
16
namespace
carla
{
17
namespace
ros2 {
18
19
// Non-alias subclass: the UE optical flow sensor produces a height*width buffer
20
// of (vx, vy) float pairs (8 bytes per pixel) which CARLA encodes on the wire
21
// as a 4-channel BGRA uint8 image via the HSV colour wheel. The conversion is
22
// the same one that ue5-dev shipped before this refactor; it now lives in
23
// OpticalFlowEncoding.h so the math is unit-testable without FastDDS, and the
24
// publisher only has to call ComputeImage(...) to plug it into the unified
25
// base.
26
class
CarlaOpticalFlowCameraPublisher
:
public
CarlaCameraPublisher
{
27
public
:
28
CarlaOpticalFlowCameraPublisher
(std::string base_topic_name, std::string frame_id)
29
:
CarlaCameraPublisher
(
std
::move(base_topic_name),
std
::move(frame_id)) {}
30
31
protected
:
32
[[nodiscard]] uint8_t
GetChannels
()
const override
{
return
4; }
33
[[nodiscard]] std::string
GetEncoding
()
const override
{
return
"bgra8"
; }
34
[[nodiscard]] std::vector<uint8_t>
ComputeImage
(
35
uint32_t height, uint32_t width,
const
uint8_t *data)
const override
;
36
};
37
38
}
// namespace ros2
39
}
// namespace carla
CarlaCameraPublisher.h
carla::ros2::CarlaCameraPublisher
Definition
CarlaCameraPublisher.h:28
carla::ros2::CarlaOpticalFlowCameraPublisher
Definition
CarlaOpticalFlowCameraPublisher.h:26
carla::ros2::CarlaOpticalFlowCameraPublisher::CarlaOpticalFlowCameraPublisher
CarlaOpticalFlowCameraPublisher(std::string base_topic_name, std::string frame_id)
Definition
CarlaOpticalFlowCameraPublisher.h:28
carla::ros2::CarlaOpticalFlowCameraPublisher::ComputeImage
std::vector< uint8_t > ComputeImage(uint32_t height, uint32_t width, const uint8_t *data) const override
Definition
CarlaOpticalFlowCameraPublisher.cpp:14
carla::ros2::CarlaOpticalFlowCameraPublisher::GetEncoding
std::string GetEncoding() const override
Definition
CarlaOpticalFlowCameraPublisher.h:33
carla::ros2::CarlaOpticalFlowCameraPublisher::GetChannels
uint8_t GetChannels() const override
Definition
CarlaOpticalFlowCameraPublisher.h:32
carla
This file contains definitions of common data structures used in traffic manager.
Definition
SignComponent.h:21
std
Definition
CarlaRecorderCollision.h:31
Generated by
1.9.8