本文整理汇总了C++中ros::NodeHandle::getParamCached方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeHandle::getParamCached方法的具体用法?C++ NodeHandle::getParamCached怎么用?C++ NodeHandle::getParamCached使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ros::NodeHandle
的用法示例。
在下文中一共展示了NodeHandle::getParamCached方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: simulateOneCycle
void simulateOneCycle()
{
tf::StampedTransform transform;
try{
listener.waitForTransform("map","EEframe", ros::Time(0), ros::Duration(1.0));
listener.lookupTransform( "map","EEframe", ros::Time(0), transform);
}
catch (tf::TransformException ex){
ROS_ERROR("%s",ex.what());
}
// This is correct, but does not work.
// state_ = transform;
KDL::Frame state_copy;
tf::transformTFToKDL(state_, state_copy);
nh_.getParamCached("/cds_controller_pr2/run_controller", run_controller_flag);
if (run_controller_flag == 1.0){ // Controller running -> Update next desired position
tf::transformKDLToTF(cds_.update(state_copy), state_);
} else {
state_ = transform;
}
broadcastTF();
}
示例2: updateParam
/** Update reconfigurable parameter (for strings). */
bool inline updateParam(const std::string &name, std::string &val)
{
bool changed = false;
std::string prev = val;
if (nh_.getParamCached(name, val) && (val != prev))
changed = true;
return changed;
}
示例3: getStringParam
inline std::string getStringParam(std::string name)
{
std::string value;
if (!root_nh_.getParamCached(name, value))
{
ROS_ERROR("Hand description: could not find parameter %s", name.c_str());
}
//ROS_INFO_STREAM("Hand description param " << name << " resolved to " << value);
return value;
}
示例4: getVectorParam
inline std::vector<std::string> getVectorParam(std::string name)
{
std::vector<std::string> values;
XmlRpc::XmlRpcValue list;
if (!root_nh_.getParamCached(name, list))
{
ROS_ERROR("Hand description: could not find parameter %s", name.c_str());
}
if (list.getType() != XmlRpc::XmlRpcValue::TypeArray)
{
ROS_ERROR("Hand description: bad parameter %s", name.c_str());
}
//ROS_INFO_STREAM("Hand description vector param " << name << " resolved to:");
for (int32_t i=0; i<list.size(); i++)
{
if (list[i].getType() != XmlRpc::XmlRpcValue::TypeString)
{
ROS_ERROR("Hand description: bad parameter %s", name.c_str());
}
values.push_back( static_cast<std::string>(list[i]) );
//ROS_INFO_STREAM(" " << values.back());
}
return values;
}
示例5: executeActionCB
void executeActionCB(const OrientToBaseGoalConstPtr& goal) {
BaseScanLinearRegression srv;
double min_angle = -M_PI/8.0, max_angle=M_PI/8.0, min_dist=0.02, max_dist=0.8;
nh_.getParamCached("/laser_linear_regression/min_angle", min_angle);
nh_.getParamCached("/laser_linear_regression/max_angle", max_angle);
nh_.getParamCached("/laser_linear_regression/min_dist", min_dist);
nh_.getParamCached("/laser_linear_regression/max_dist", max_dist);
srv.request.filter_minAngle = angles::from_degrees(min_angle);
srv.request.filter_maxAngle = angles::from_degrees(max_angle);
srv.request.filter_minDistance = min_dist;
srv.request.filter_maxDistance = max_dist;
std::cout << "min_dist " << min_dist << ", max_dist " << max_dist << std::endl;
//srv.request.filter_minAngle = -M_PI / 8.0;
//srv.request.filter_maxAngle = M_PI / 8.0;
//srv.request.filter_minDistance = 0.02;
//srv.request.filter_maxDistance = 0.80;
target_distance = goal->distance;
ros::Duration max_time(50.0);
ros::Time stamp = ros::Time::now();
OrientToBaseResult result;
bool oriented = false;
int iterator = 0;
while (ros::ok()) {
ROS_INFO("Call service Client");
if(client.call(srv)) {
ROS_INFO("Called service LaserScanLinearRegressionService");
//std::cout << "result: " << srv.response.center << ", " << srv.response.a << ", " << srv.response.b << std::endl;
geometry_msgs::Twist cmd = calculateVelocityCommand(srv.response.center, srv.response.a, srv.response.b,oriented,iterator);
cmd_pub.publish(cmd);
std::cout << "cmd x:" << cmd.linear.x << ", y: " << cmd.linear.y << ", z: " << cmd.angular.z << std::endl;
if ((fabs(cmd.angular.z) + fabs(cmd.linear.x) ) < 0.001) {
ROS_INFO("Point reached");
result.succeed = true;
as_.setSucceeded(result);
geometry_msgs::Twist zero_vel;
cmd_pub.publish(zero_vel);
break;
}
if (stamp + max_time < ros::Time::now()) {
result.succeed = false;
as_.setAborted(result);
geometry_msgs::Twist zero_vel;
cmd_pub.publish(zero_vel);
break;
}
} else {
ROS_ERROR("Failed to call service LaserScanLinearRegressionService");
if (stamp + max_time < ros::Time::now()) {
result.succeed = false;
as_.setAborted(result);
break;
}
}
}
}