Commit b3bc8bde authored by Olivier Stasse's avatar Olivier Stasse Committed by olivier stasse
Browse files

[tools] Add set_parameter and get_parameter to parameter_server

parent b92a7dcf
......@@ -82,12 +82,20 @@ public:
void setForceNameToForceId(const std::string &forceName,
const double &forceId);
/// Commands related to FootUtil
/// \name Commands related to FootUtil
/// @{
void setRightFootSoleXYZ(const dynamicgraph::Vector &);
void setRightFootForceSensorXYZ(const dynamicgraph::Vector &);
void setFootFrameName(const std::string &, const std::string &);
void setImuJointName(const std::string &);
void displayRobotUtil();
/// @}
/// \name Commands related to the model
/// @{
void setParameter(const std::string &ParameterName,
const std::string &ParameterValue);
std::string getParameter(const std::string &ParameterName);
/// @}
/// Set the mapping between urdf and sot.
void setJoints(const dynamicgraph::Vector &);
......
......@@ -121,6 +121,21 @@ ParameterServer::ParameterServer(const std::string &name)
makeCommandVoid0(
*this, &ParameterServer::displayRobotUtil,
docCommandVoid0("Display the current robot util data set.")));
addCommand("setParameter",
makeCommandVoid2(
*this, &ParameterServer::setParameter,
docCommandVoid2("Set a parameter named ParameterName to value "
"ParameterValue (string format).",
"(string) ParameterName",
"(string) ParameterValue")));
addCommand("getParameter", makeCommandReturnType1(
*this, &ParameterServer::getParameter,
docCommandReturnType1<std::string>(
"Return the parameter value for parameter"
" named ParameterName.",
"(string) ParameterName")));
}
void ParameterServer::init(const double &dt, const std::string &urdfFile,
......@@ -291,6 +306,30 @@ bool ParameterServer::isJointInRange(unsigned int id, double q) {
return true;
}
void ParameterServer::setParameter(const std::string &ParameterName,
const std::string &ParameterValue) {
if (!m_initSucceeded) {
SEND_WARNING_STREAM_MSG("Cannot set parameter " + ParameterName + " to " +
ParameterValue + " before initialization!");
return;
}
m_robot_util->set_parameter(ParameterName, ParameterValue);
}
std::string ParameterServer::getParameter(const std::string &ParameterName) {
std::string ParameterValue("");
if (!m_initSucceeded) {
SEND_WARNING_STREAM_MSG("Cannot get parameter " + ParameterName +
" before initialization!");
return ParameterValue;
}
ParameterValue = m_robot_util->get_parameter(ParameterName);
return ParameterValue;
}
/* ------------------------------------------------------------------- */
/* --- ENTITY -------------------------------------------------------- */
/* ------------------------------------------------------------------- */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment