CARLA
Loading...
Searching...
No Matches
BasicPublisher.cpp
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
8
9#include "carla/Logging.h"
12
13namespace carla {
14namespace ros2 {
15
16namespace {
17constexpr const char *kBasicPublisherTopic = "rt/basic_publisher_example";
18} // namespace
19
23
25 : BasePublisher(kBasicPublisherTopic, ""),
26 _impl(std::make_shared<PublisherImpl<BasicPublisherMsgTraits>>()) {}
27
29
31 return _impl->Init(kBasicPublisherTopic);
32}
33
35 return _impl->Publish();
36}
37
38void BasicPublisher::SetData(const std::string &msg) {
39 _impl->GetMessage()->data = msg;
40}
41
42} // namespace ros2
43} // namespace carla
virtual bool Publish()=0
std::shared_ptr< PublisherImpl< BasicPublisherMsgTraits > > _impl
void SetData(const std::string &msg)
This file contains definitions of common data structures used in traffic manager.