MCPcopy Create free account
hub / github.com/LimHyungTae/patchwork / condParam

Method condParam

include/patchwork/patchwork.hpp:142–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140
141 template <typename T>
142 bool condParam(ros::NodeHandle *nh,
143 const std::string &param_name,
144 T &param_val,
145 const T &default_val,
146 const std::string &prefix = "/patchwork") const {
147 if (nh->hasParam(prefix + "/" + param_name)) {
148 if (nh->getParam(prefix + "/" + param_name, param_val)) {
149 ROS_INFO_STREAM("param '" << prefix << "/" << param_name << "' -> '" << param_val << "'");
150 return true;
151 }
152 } else if (nh->hasParam(ros::this_node::getName() + "/" + param_name)) {
153 if (nh->getParam(ros::this_node::getName() + "/" + param_name, param_val)) {
154 ROS_INFO_STREAM("param '" << ros::this_node::getName() << "/" << param_name << "' -> '"
155 << param_val << "'");
156 return true;
157 }
158 }
159 param_val = default_val;
160 ROS_INFO_STREAM("param '" << param_name << "' -> '" << param_val << "' (default)");
161 return false;
162 }
163
164 explicit PatchWork(ros::NodeHandle *nh) {
165 // Init ROS related

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected