include
cras_topic_tools
change_header.h
Go to the documentation of this file.
1
#pragma once
2
3
// SPDX-License-Identifier: BSD-3-Clause
4
// SPDX-FileCopyrightText: Czech Technical University in Prague
5
13
#include <memory>
14
#include <string>
15
#include <utility>
16
17
#include <
ros/duration.h
>
18
#include <
ros/message_event.h
>
19
#include <
ros/publisher.h
>
20
#include <
ros/time.h
>
21
#include <topic_tools/shape_shifter.h>
22
23
#include <
cras_cpp_common/nodelet_utils.hpp
>
24
#include <
cras_cpp_common/optional.hpp
>
25
26
#include <
cras_topic_tools/generic_lazy_pubsub.hpp
>
27
28
namespace
cras
29
{
30
84
class
ChangeHeaderNodelet
:
public
::cras::Nodelet
85
{
86
protected
:
88
::std::unique_ptr<::cras::GenericLazyPubSub>
pubSub
;
89
90
void
onInit
()
override
;
91
97
virtual
void
processMessage
(
98
const ::ros::MessageEvent<const ::topic_tools::ShapeShifter>& event, ::
ros::Publisher
& pub);
99
101
::cras::optional<::std::string>
newFrameId
;
102
104
::cras::optional<::std::string>
newFrameIdPrefix
;
105
107
::cras::optional<::std::string>
newFrameIdSuffix
;
108
110
::cras::optional<::std::pair<::std::string, ::std::string>>
newFrameIdReplace
;
111
113
::cras::optional<::std::pair<::std::string, ::std::string>>
newFrameIdReplaceStart
;
114
116
::cras::optional<::std::pair<::std::string, ::std::string>>
newFrameIdReplaceEnd
;
117
119
::cras::optional<::ros::Time>
newStampAbs
;
120
122
::cras::optional<::ros::Duration>
newStampRel
;
123
125
bool
newStampRosTime
{
false
};
126
128
bool
newStampWallTime
{
false
};
129
131
::cras::optional<bool>
hasHeader
{::cras::nullopt};
132
};
133
134
}
optional.hpp
ros::Publisher
cras
cras::ChangeHeaderNodelet::newFrameIdReplace
::cras::optional<::std::pair<::std::string, ::std::string > > newFrameIdReplace
Replace all occurrences of first string with the second one in frame_id.
Definition:
change_header.h:110
time.h
cras::ChangeHeaderNodelet::newFrameIdSuffix
::cras::optional<::std::string > newFrameIdSuffix
Suffix frame_id with this value.
Definition:
change_header.h:107
publisher.h
cras::ChangeHeaderNodelet::hasHeader
::cras::optional< bool > hasHeader
Whether the subscribed topic has a header field. This is filled on receipt of the first message.
Definition:
change_header.h:131
cras::ChangeHeaderNodelet::newStampRosTime
bool newStampRosTime
Change stamp to current ROS time.
Definition:
change_header.h:125
generic_lazy_pubsub.hpp
Lazy subscriber that subscribes only when a paired publisher has subscribers. Version for unknown mes...
duration.h
cras::ChangeHeaderNodelet::newStampAbs
::cras::optional<::ros::Time > newStampAbs
Replace stamp with the given value.
Definition:
change_header.h:119
cras::ChangeHeaderNodelet::newFrameIdReplaceStart
::cras::optional<::std::pair<::std::string, ::std::string > > newFrameIdReplaceStart
If frame_id starts with the first string, replace it with the second one.
Definition:
change_header.h:113
cras::ChangeHeaderNodelet::processMessage
virtual void processMessage(const ::ros::MessageEvent< const ::topic_tools::ShapeShifter > &event, ::ros::Publisher &pub)
Change the header of the incoming message and publish the result.
Definition:
change_header.cpp:110
cras::ChangeHeaderNodelet::newFrameId
::cras::optional<::std::string > newFrameId
Replace the whole frame_id with this value.
Definition:
change_header.h:101
cras::ChangeHeaderNodelet::newStampWallTime
bool newStampWallTime
Change stamp to current wall time.
Definition:
change_header.h:128
cras::ChangeHeaderNodelet::pubSub
::std::unique_ptr<::cras::GenericLazyPubSub > pubSub
The lazy pair of subscriber and publisher.
Definition:
change_header.h:88
cras::ChangeHeaderNodelet::newFrameIdReplaceEnd
::cras::optional<::std::pair<::std::string, ::std::string > > newFrameIdReplaceEnd
If frame_id ends with the first string, replace it with the second one.
Definition:
change_header.h:116
cras::Nodelet
message_event.h
cras::ChangeHeaderNodelet::newStampRel
::cras::optional<::ros::Duration > newStampRel
Add this value to stamp. In case of under/overflow, TIME_MIN or TIME_MAX are set.
Definition:
change_header.h:122
cras::ChangeHeaderNodelet::newFrameIdPrefix
::cras::optional<::std::string > newFrameIdPrefix
Prefix frame_id with this value.
Definition:
change_header.h:104
cras::ChangeHeaderNodelet::onInit
void onInit() override
Definition:
change_header.cpp:32
nodelet_utils.hpp
cras::ChangeHeaderNodelet
Nodelet for relaying messages and changing their header.
Definition:
change_header.h:84
cras_topic_tools
Author(s): Martin Pecka
autogenerated on Tue Nov 26 2024 03:49:18