YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
FrameTransformSet_nwc_ros2_ParamsParser.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2023-2023 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: LGPL-2.1-or-later
4 */
5
6
7// Generated by yarpDeviceParamParserGenerator (1.0)
8// This is an automatically generated file. Please do not edit it.
9// It will be re-generated if the cmake flag ALLOW_DEVICE_PARAM_PARSER_GERNERATION is ON.
10
11// Generated on: Mon Aug 26 14:52:35 2024
12
13
15#include <yarp/os/LogStream.h>
16#include <yarp/os/Value.h>
17
18namespace {
19 YARP_LOG_COMPONENT(FrameTransformSet_nwc_ros2ParamsCOMPONENT, "yarp.device.FrameTransformSet_nwc_ros2")
20}
21
22
26
27
29{
30 std::vector<std::string> params;
31 params.push_back("GENERAL::refresh_interval");
32 params.push_back("GENERAL::period");
33 params.push_back("GENERAL::asynch_pub");
34 params.push_back("ROS2::ft_node");
35 params.push_back("ROS2::ft_topic");
36 params.push_back("ROS2::ft_topic_static");
37 return params;
38}
39
40
42{
43 //Check for --help option
44 if (config.check("help"))
45 {
46 yCInfo(FrameTransformSet_nwc_ros2ParamsCOMPONENT) << getDocumentationOfDeviceParams();
47 }
48
49 std::string config_string = config.toString();
50 yarp::os::Property prop_check(config_string.c_str());
51 //Parser of parameter GENERAL::refresh_interval
52 {
53 yarp::os::Bottle sectionp;
54 sectionp = config.findGroup("GENERAL");
55 if (sectionp.check("refresh_interval"))
56 {
57 m_GENERAL_refresh_interval = sectionp.find("refresh_interval").asFloat64();
58 yCInfo(FrameTransformSet_nwc_ros2ParamsCOMPONENT) << "Parameter 'GENERAL::refresh_interval' using value:" << m_GENERAL_refresh_interval;
59 }
60 else
61 {
62 yCInfo(FrameTransformSet_nwc_ros2ParamsCOMPONENT) << "Parameter 'GENERAL::refresh_interval' using DEFAULT value:" << m_GENERAL_refresh_interval;
63 }
64 prop_check.unput("GENERAL::refresh_interval");
65 }
66
67 //Parser of parameter GENERAL::period
68 {
69 yarp::os::Bottle sectionp;
70 sectionp = config.findGroup("GENERAL");
71 if (sectionp.check("period"))
72 {
73 m_GENERAL_period = sectionp.find("period").asFloat64();
74 yCInfo(FrameTransformSet_nwc_ros2ParamsCOMPONENT) << "Parameter 'GENERAL::period' using value:" << m_GENERAL_period;
75 }
76 else
77 {
78 yCInfo(FrameTransformSet_nwc_ros2ParamsCOMPONENT) << "Parameter 'GENERAL::period' using DEFAULT value:" << m_GENERAL_period;
79 }
80 prop_check.unput("GENERAL::period");
81 }
82
83 //Parser of parameter GENERAL::asynch_pub
84 {
85 yarp::os::Bottle sectionp;
86 sectionp = config.findGroup("GENERAL");
87 if (sectionp.check("asynch_pub"))
88 {
89 m_GENERAL_asynch_pub = sectionp.find("asynch_pub").asInt64();
90 yCInfo(FrameTransformSet_nwc_ros2ParamsCOMPONENT) << "Parameter 'GENERAL::asynch_pub' using value:" << m_GENERAL_asynch_pub;
91 }
92 else
93 {
94 yCInfo(FrameTransformSet_nwc_ros2ParamsCOMPONENT) << "Parameter 'GENERAL::asynch_pub' using DEFAULT value:" << m_GENERAL_asynch_pub;
95 }
96 prop_check.unput("GENERAL::asynch_pub");
97 }
98
99 //Parser of parameter ROS2::ft_node
100 {
101 yarp::os::Bottle sectionp;
102 sectionp = config.findGroup("ROS2");
103 if (sectionp.check("ft_node"))
104 {
105 m_ROS2_ft_node = sectionp.find("ft_node").asString();
106 yCInfo(FrameTransformSet_nwc_ros2ParamsCOMPONENT) << "Parameter 'ROS2::ft_node' using value:" << m_ROS2_ft_node;
107 }
108 else
109 {
110 yCInfo(FrameTransformSet_nwc_ros2ParamsCOMPONENT) << "Parameter 'ROS2::ft_node' using DEFAULT value:" << m_ROS2_ft_node;
111 }
112 prop_check.unput("ROS2::ft_node");
113 }
114
115 //Parser of parameter ROS2::ft_topic
116 {
117 yarp::os::Bottle sectionp;
118 sectionp = config.findGroup("ROS2");
119 if (sectionp.check("ft_topic"))
120 {
121 m_ROS2_ft_topic = sectionp.find("ft_topic").asString();
122 yCInfo(FrameTransformSet_nwc_ros2ParamsCOMPONENT) << "Parameter 'ROS2::ft_topic' using value:" << m_ROS2_ft_topic;
123 }
124 else
125 {
126 yCInfo(FrameTransformSet_nwc_ros2ParamsCOMPONENT) << "Parameter 'ROS2::ft_topic' using DEFAULT value:" << m_ROS2_ft_topic;
127 }
128 prop_check.unput("ROS2::ft_topic");
129 }
130
131 //Parser of parameter ROS2::ft_topic_static
132 {
133 yarp::os::Bottle sectionp;
134 sectionp = config.findGroup("ROS2");
135 if (sectionp.check("ft_topic_static"))
136 {
137 m_ROS2_ft_topic_static = sectionp.find("ft_topic_static").asString();
138 yCInfo(FrameTransformSet_nwc_ros2ParamsCOMPONENT) << "Parameter 'ROS2::ft_topic_static' using value:" << m_ROS2_ft_topic_static;
139 }
140 else
141 {
142 yCInfo(FrameTransformSet_nwc_ros2ParamsCOMPONENT) << "Parameter 'ROS2::ft_topic_static' using DEFAULT value:" << m_ROS2_ft_topic_static;
143 }
144 prop_check.unput("ROS2::ft_topic_static");
145 }
146
147 /*
148 //This code check if the user set some parameter which are not check by the parser
149 //If the parser is set in strict mode, this will generate an error
150 if (prop_check.size() > 0)
151 {
152 bool extra_params_found = false;
153 for (auto it=prop_check.begin(); it!=prop_check.end(); it++)
154 {
155 if (m_parser_is_strict)
156 {
157 yCError(FrameTransformSet_nwc_ros2ParamsCOMPONENT) << "User asking for parameter: "<<it->name <<" which is unknown to this parser!";
158 extra_params_found = true;
159 }
160 else
161 {
162 yCWarning(FrameTransformSet_nwc_ros2ParamsCOMPONENT) << "User asking for parameter: "<< it->name <<" which is unknown to this parser!";
163 }
164 }
165
166 if (m_parser_is_strict && extra_params_found)
167 {
168 return false;
169 }
170 }
171 */
172 return true;
173}
174
175
177{
178 std::string doc;
179 doc = doc + std::string("\n=============================================\n");
180 doc = doc + std::string("This is the help for device: FrameTransformSet_nwc_ros2\n");
181 doc = doc + std::string("\n");
182 doc = doc + std::string("This is the list of the parameters accepted by the device:\n");
183 doc = doc + std::string("'GENERAL::refresh_interval': The time interval outside which timed ft will be deleted\n");
184 doc = doc + std::string("'GENERAL::period': The PeriodicThread period in seconds\n");
185 doc = doc + std::string("'GENERAL::asynch_pub': If 1, the fts will be published not only every \"period\" seconds but also when set functions are called\n");
186 doc = doc + std::string("'ROS2::ft_node': The name of the ROS2 node\n");
187 doc = doc + std::string("'ROS2::ft_topic': The name of the ROS2 topic from which fts will be received\n");
188 doc = doc + std::string("'ROS2::ft_topic_static': The name of the ROS2 topic from which static fts will be received\n");
189 doc = doc + std::string("\n");
190 doc = doc + std::string("Here are some examples of invocation command with yarpdev, with all params:\n");
191 doc = doc + " yarpdev --device frameTransformSet_nwc_ros2 --GENERAL::refresh_interval 0.1 --GENERAL::period 0.01 --GENERAL::asynch_pub 1 --ROS2::ft_node tfNodeSet --ROS2::ft_topic /tf --ROS2::ft_topic_static /tf_static\n";
192 doc = doc + std::string("Using only mandatory params:\n");
193 doc = doc + " yarpdev --device frameTransformSet_nwc_ros2\n";
194 doc = doc + std::string("=============================================\n\n"); return doc;
195}
std::vector< std::string > getListOfParams() const override
Return a list of all params used by the device.
bool parseParams(const yarp::os::Searchable &config) override
Parse the DeviceDriver parameters.
std::string getDocumentationOfDeviceParams() const override
Get the documentation of the DeviceDriver's parameters.
A simple collection of objects that can be described and transmitted in a portable way.
Definition Bottle.h:64
bool check(const std::string &key) const override
Check if there exists a property of the given name.
Definition Bottle.cpp:277
Value & find(const std::string &key) const override
Gets a value corresponding to a given keyword.
Definition Bottle.cpp:287
A class for storing options and configuration information.
Definition Property.h:33
void unput(const std::string &key)
Remove the association from the given key to a value, if present.
A base class for nested structures that can be searched.
Definition Searchable.h:31
virtual bool check(const std::string &key) const =0
Check if there exists a property of the given name.
virtual std::string toString() const =0
Return a standard text representation of the content of the object.
virtual Bottle & findGroup(const std::string &key) const =0
Gets a list corresponding to a given keyword.
virtual yarp::conf::float64_t asFloat64() const
Get 64-bit floating point value.
Definition Value.cpp:222
virtual std::int64_t asInt64() const
Get 64-bit integer value.
Definition Value.cpp:210
virtual std::string asString() const
Get string value.
Definition Value.cpp:234
#define yCInfo(component,...)
#define YARP_LOG_COMPONENT(name,...)