ros::NodeHandle nh;
ros::Publisher pub = nh.advertise<[msg_type]>([msgName], [msgCountLimit])
消息发布相关参数:消息类型 消息名 缓冲消息条数上限(队列缓冲机制,丢弃旧消息)
下面代码中的boost::bind用法 有些象 python中的匿名函数lambda
void callback(chapter2_tutorials::chapter2Config &config, uint32_t level) {
ROS_INFO("Reconfigure Request: %d %f %s %s %d",
config.int_param,
config.double_param,
config.str_param.c_str(),
config.bool_param?"True":"False",
config.size);
}
dynamic_reconfigure::Server<chapter2_tutorials::chapter2Config>::CallbackType f;
f = boost::bind(&callback, _1, _2);
server.setCallback(f);
from dynamic_reconfigure.parameter_generator_catkin import *
gen = ParameterGenerator() // 与 argparser模块有些类似
gen.add("int_param", int_t, 0, "An Integer parameter", 1, 0, 100)
gen.add(name, type, level, description, default, min, max)
• name: This is the name of the parameter
• type: This is the type of the value stored
//level 没理解这是做什么的 ?? 回调函数确是有传入这个参数,但是看代码是没有使用,也有可能是bind函数作用我理解错了
//需要传入参数动态配置回调函数中的掩码,
//在回调函数中会修改所有参数的掩码,表示参数已经进行修改;
• level: This is a bitmask that is passed to the callback
• description: This is a little description that describes the parameter
• default: This is the default value when the node starts
• min: This is the minimum value for the parameter
• max: This is the maximum value for the parameter
网友评论