update
This commit is contained in:
@@ -651,7 +651,8 @@ namespace robot
|
||||
std::string key = it->first.as<std::string>();
|
||||
const YAML::Node &value = it->second;
|
||||
std::string full_key = prefix.empty() ? key : prefix + "/" + key;
|
||||
|
||||
if(full_key.find("MKTAlgorithmDiffPredictiveTrajectory") == std::string::npos)
|
||||
continue;
|
||||
if (value.IsMap())
|
||||
{
|
||||
std::cout << "[NodeHandle] " << indent << full_key << ":" << std::endl;
|
||||
@@ -1727,6 +1728,87 @@ namespace robot
|
||||
return true;
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
bool yamlToXmlRpc(const YAML::Node &y, robot_xmlrpcpp::XmlRpcValue &out)
|
||||
{
|
||||
if (!y.IsDefined())
|
||||
return false;
|
||||
if (y.IsScalar())
|
||||
{
|
||||
try
|
||||
{
|
||||
std::string s = y.as<std::string>();
|
||||
std::string lower = s;
|
||||
std::transform(lower.begin(), lower.end(), lower.begin(), ::tolower);
|
||||
if (lower == "true" || lower == "1" || lower == "yes" || lower == "on")
|
||||
{
|
||||
out = robot_xmlrpcpp::XmlRpcValue(true);
|
||||
return true;
|
||||
}
|
||||
if (lower == "false" || lower == "0" || lower == "no" || lower == "off")
|
||||
{
|
||||
out = robot_xmlrpcpp::XmlRpcValue(false);
|
||||
return true;
|
||||
}
|
||||
try
|
||||
{
|
||||
int i = y.as<int>();
|
||||
out = robot_xmlrpcpp::XmlRpcValue(i);
|
||||
return true;
|
||||
}
|
||||
catch (...) {}
|
||||
try
|
||||
{
|
||||
double d = y.as<double>();
|
||||
out = robot_xmlrpcpp::XmlRpcValue(d);
|
||||
return true;
|
||||
}
|
||||
catch (...) {}
|
||||
out = robot_xmlrpcpp::XmlRpcValue(s);
|
||||
return true;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (y.IsSequence())
|
||||
{
|
||||
out = robot_xmlrpcpp::XmlRpcValue();
|
||||
out.setSize(static_cast<int>(y.size()));
|
||||
for (size_t i = 0; i < y.size(); ++i)
|
||||
{
|
||||
robot_xmlrpcpp::XmlRpcValue item;
|
||||
if (yamlToXmlRpc(y[i], item))
|
||||
out[static_cast<int>(i)] = item;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (y.IsMap())
|
||||
{
|
||||
out = robot_xmlrpcpp::XmlRpcValue();
|
||||
for (YAML::const_iterator it = y.begin(); it != y.end(); ++it)
|
||||
{
|
||||
std::string k = it->first.as<std::string>();
|
||||
robot_xmlrpcpp::XmlRpcValue item;
|
||||
if (yamlToXmlRpc(it->second, item))
|
||||
out[k] = item;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool NodeHandle::getParam(const std::string &key, robot_xmlrpcpp::XmlRpcValue &v) const
|
||||
{
|
||||
YAML::Node value = getNestedValue(key);
|
||||
if (!value.IsDefined())
|
||||
return false;
|
||||
return yamlToXmlRpc(value, v);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T NodeHandle::param(const std::string ¶m_name) const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user