/home/runner/work/beluga/beluga/beluga_ros/include/beluga_ros/messages.hpp Source File

/home/runner/work/beluga/beluga/beluga_ros/include/beluga_ros/messages.hpp Source File#

Beluga ROS: /home/runner/work/beluga/beluga/beluga_ros/include/beluga_ros/messages.hpp Source File
Beluga ROS
messages.hpp
1 // Copyright 2023 Ekumen, Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef BELUGA_ROS_MESSAGES_HPP
16 #define BELUGA_ROS_MESSAGES_HPP
17 
18 #include <visualization_msgs/msg/marker_array.hpp>
19 
20 #include <rclcpp/time.hpp>
21 
22 namespace beluga_ros {
23 
25 
31 template <class Message>
32 Message& stamp_message(std::string_view frame_id, rclcpp::Time timestamp, Message& message) {
33  message.header.frame_id = frame_id;
34  message.header.stamp = timestamp;
35  return message;
36 }
37 
39 
44 inline visualization_msgs::msg::MarkerArray&
45 stamp_message(std::string_view frame_id, rclcpp::Time timestamp, visualization_msgs::msg::MarkerArray& message) {
46  for (auto& marker : message.markers) {
47  stamp_message(frame_id, timestamp, marker);
48  }
49  return message;
50 }
51 
52 } // namespace beluga_ros
53 
54 #endif // BELUGA_ROS_MESSAGES_HPP
The main Beluga ROS namespace.
Definition: amcl.hpp:47
Message & stamp_message(std::string_view frame_id, rclcpp::Time timestamp, Message &message)
Stamp a message with a frame ID and timestamp.
Definition: messages.hpp:32