Carma-platform v4.2.0
CARMA Platform is built on robot operating system (ROS) and utilizes open source software (OSS) that enables Cooperative Driving Automation (CDA) features to allow Automated Driving Systems to interact and cooperate with infrastructure and other vehicles through communication.
log.hpp
Go to the documentation of this file.
1/*------------------------------------------------------------------------------
2* Copyright (C) 2020-2022 LEIDOS.
3*
4* Licensed under the Apache License, Version 2.0 (the "License"); you may not
5* use this file except in compliance with the License. You may obtain a copy of
6* the License at
7*
8* http://www.apache.org/licenses/LICENSE-2.0
9*
10* Unless required by applicable law or agreed to in writing, software
11* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13* License for the specific language governing permissions and limitations under
14* the License.
15------------------------------------------------------------------------------*/
16
17#include <sstream>
19
20namespace basic_autonomy
21{
22 static const std::string BASIC_AUTONOMY_LOGGER = "basic_autonomy";
23
24 namespace log
25 {
29 std::string basicPointToStream(lanelet::BasicPoint2d point);
30
35
39 template <class T>
40 void printDebugPerLine(const std::vector<T>& values, std::function<std::string(T)> func)
41 {
42 for (const auto& value : values)
43 {
44 RCLCPP_DEBUG_STREAM(rclcpp::get_logger(BASIC_AUTONOMY_LOGGER), func(value));
45 }
46 }
47
51 template <class T>
52 void printDebugPerLine(const std::vector<T>& values, std::string (*free_func)(T))
53 {
54 auto function = static_cast<std::function<std::string(T)>>(free_func);
55 printDebugPerLine(values, function);
56 }
57
61 void printDoublesPerLineWithPrefix(const std::string& prefix, const std::vector<double>& values);
62
63 } // namespace log
64} // namespace basic_autonomy
void printDoublesPerLineWithPrefix(const std::string &prefix, const std::vector< double > &values)
Print a RCLCPP_DEBUG_STREAM for each value in values where the printed value is << prefix << value.
Definition: log.cpp:45
std::string basicPointToStream(lanelet::BasicPoint2d point)
Helper function to convert a lanelet::BasicPoint2d to a string.
Definition: log.cpp:26
std::string pointSpeedPairToStream(waypoint_generation::PointSpeedPair point)
Helper function to convert a PointSpeedPair to a string.
Definition: log.cpp:35
void printDebugPerLine(const std::vector< T > &values, std::function< std::string(T)> func)
Print a RCLCPP_DEBUG_STREAM for each value in values where the printed value is a string returned by ...
Definition: log.hpp:40
static const std::string BASIC_AUTONOMY_LOGGER
Definition: log.hpp:22