My Project 1.0
Holistic Fusion: A Generic Framework for Multimodal Sensor Fusion
Loading...
Searching...
No Matches
read_ros_params.h
Go to the documentation of this file.
1/*
2Copyright 2023 by Julian Nubert & Simon Kerscher, Robotic Systems Lab, ETH Zurich.
3All rights reserved.
4This file is released under the "BSD-3-Clause License".
5Please see the LICENSE file that has been included as part of this package.
6 */
7
8#ifndef HOLISTIC_FUSION_ROS_READ_ROS_PARAMS_H
9#define HOLISTIC_FUSION_ROS_READ_ROS_PARAMS_H
10
11// Workspace
13
14namespace holistic_fusion {
15
16template <typename T>
17inline void printKey(const std::string& key, T value) {
18 std::cout << YELLOW_START << "HolisticFusionRos " << COLOR_END << key << " set to: " << value << std::endl;
19}
20
21template <>
22inline void printKey(const std::string& key, std::vector<double> vector) {
23 std::cout << YELLOW_START << "HolisticFusionRos " << COLOR_END << key << " set to: ";
24 for (const auto& element : vector) {
25 std::cout << element << ",";
26 }
27 std::cout << std::endl;
28}
29
30// Implementation of Templating
31template <typename T>
32T tryGetParam(const std::string& key, const ros::NodeHandle& privateNode) {
33 T value;
34 if (privateNode.getParam(key, value)) {
35 printKey(key, value);
36 return value;
37 } else if (privateNode.getParam("/" + key, value)) {
38 printKey("/" + key, value);
39 return value;
40 } else {
41 throw std::runtime_error("HolisticFusionRos - " + key + " not specified.");
42 }
43}
44
45} // namespace holistic_fusion
46
47#endif // HOLISTIC_FUSION_ROS_READ_ROS_PARAMS_H
#define COLOR_END
#define YELLOW_START
void printKey(const std::string &key, T value)
T tryGetParam(const std::string &key, const ros::NodeHandle &privateNode)