reload rosparams once

asked 2019-03-04 07:24:15 -0600

Markus gravatar image

Hey there,

I would like to send an empty topic message and thereby update my node handle parameters.

So normaly I initialize my params once at the beginning (e.g. in my main function)

ros::init(argc, argv, "dd");
ros::NodeHandle nh("~");
string rgb_topic, rgb_info_topic, dictionary_name;
nh.param("camera", rgb_topic, string("/kinect2/hd/image_color_rect"));
nh.param("camera_info", rgb_info_topic, string("/kinect2/hd/camera_info"));

Now during runtime I would like to change them via:

void update_params_cb(const std_msgs::Empty &msg)
{
    // update the parameters:
    //nh.getParam("/blur_window_size", blur_window_size); (I do not have nh here!!)
}

Problem

I do not have a node handle here and I do not know how to come around that. Does anyone know how I can initialize a nodehandle or use a pointer etc.?

PS: I would like to not use dynami_reconfigure

edit retag flag offensive close merge delete