CARLA
Toggle main menu visibility
Loading...
Searching...
No Matches
LibCarla
source
carla
ros2
publishers
CarlaClockPublisher.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/BasePublisher.h
"
10
11
#include <cstdint>
12
#include <memory>
13
14
namespace
carla
{
15
namespace
ros2
{
16
17
template
<
typename
Traits>
class
PublisherImpl
;
18
struct
CarlaClockMsgTraits
;
19
20
// Global ROS 2 clock publisher: writes rosgraph_msgs::msg::Clock to the
21
// well-known "rt/clock" topic. Single-instance — ROS2::Enable() constructs
22
// it once and SetTimestamp() drives every tick.
23
class
CarlaClockPublisher
:
public
BasePublisher
{
24
public
:
25
CarlaClockPublisher
();
26
~CarlaClockPublisher
()
override
;
27
28
CarlaClockPublisher
(
const
CarlaClockPublisher
&) =
delete
;
29
CarlaClockPublisher
&
operator=
(
const
CarlaClockPublisher
&) =
delete
;
30
CarlaClockPublisher
(
CarlaClockPublisher
&&) noexcept = default;
31
CarlaClockPublisher
&operator=(
CarlaClockPublisher
&&) noexcept = default;
32
33
bool
Publish
() override;
34
bool
Write
(
std
::int32_t seconds,
std
::uint32_t nanoseconds);
35
36
/// False when the writer could not be created, i.e. the middleware
37
/// failed to start (no participant or session).
38
bool
IsReady
()
const
{
return
_ready
; }
39
40
private
:
41
std::shared_ptr<PublisherImpl<CarlaClockMsgTraits>>
_impl
;
42
bool
_ready
=
false
;
43
};
44
45
}
// namespace ros2
46
}
// namespace carla
BasePublisher.h
carla::ros2::BasePublisher::BasePublisher
BasePublisher()=default
carla::ros2::CarlaClockPublisher::Publish
bool Publish() override
Definition
CarlaClockPublisher.cpp:31
carla::ros2::CarlaClockPublisher::CarlaClockPublisher
CarlaClockPublisher()
Definition
CarlaClockPublisher.cpp:20
carla::ros2::CarlaClockPublisher::CarlaClockPublisher
CarlaClockPublisher(const CarlaClockPublisher &)=delete
carla::ros2::CarlaClockPublisher::_impl
std::shared_ptr< PublisherImpl< CarlaClockMsgTraits > > _impl
Definition
CarlaClockPublisher.h:41
carla::ros2::CarlaClockPublisher::IsReady
bool IsReady() const
False when the writer could not be created, i.e.
Definition
CarlaClockPublisher.h:38
carla::ros2::CarlaClockPublisher::_ready
bool _ready
Definition
CarlaClockPublisher.h:42
carla::ros2::CarlaClockPublisher::operator=
CarlaClockPublisher & operator=(const CarlaClockPublisher &)=delete
carla::ros2::CarlaClockPublisher::Write
bool Write(std::int32_t seconds, std::uint32_t nanoseconds)
Definition
CarlaClockPublisher.cpp:35
carla::ros2::CarlaClockPublisher::CarlaClockPublisher
CarlaClockPublisher(CarlaClockPublisher &&) noexcept=default
carla::ros2::CarlaClockPublisher::~CarlaClockPublisher
~CarlaClockPublisher() override
carla::ros2::PublisherImpl
Definition
PublisherImpl.h:28
carla::ros2
Definition
AutowareSteeringCompensation.h:15
carla
This file contains definitions of common data structures used in traffic manager.
Definition
SignComponent.h:21
std
Definition
CarlaRecorderCollision.h:31
carla::ros2::CarlaClockMsgTraits
Definition
CarlaClockPublisher.cpp:16
Generated by
1.18.0