Remapping rqt published topics
I am developing an rqt GUI plugin to set some values in another node, but the rqt plugins seem to always place a namespace in front of my desired published topic name.
For example, my rqt plugin is called "rqt_blueview," and I declare a published topic in the rqt plugin like this...
this->max_range_pub_ = getNodeHandle().advertise<std_msgs::Float32>("sonar_max_range", 1);
However, the actual topic is published with the following topic name:
/rqt_blueview/sonar_max_range
I want to publish to /sonar_max_range
I tried to remap the topic, but I can't seem to get it to work. I tried the following in a launch file:
<remap from="/rqt_blueview/sonar_max_range" to="sonar_max_range" />
<node pkg="rqt_blueview" name="rqt_blueview" type="rqt_blueview" />
and
<remap from="rqt_blueview/sonar_max_range" to="sonar_max_range" />
<node pkg="rqt_blueview" name="rqt_blueview" type="rqt_blueview" />
I tried placing the remap tag inside the <node></node> tags as well, but with no results. I think this has something to do with how the rqt plugin is loaded into the rqt higher-level Qt window.
I was able to remap the subscribed topic /sonar_max_range
to /rqt_blueview/sonar_max_range
on the normal C++ ROS node subscribed side of the topic, but this naming convention doesn't seem natural to me.
Is there a best practice for naming topics when using rqt plugins? I won't want a launch file remapping the rqt GUI plugins since the idea is to open rqt and then "add" the other rqt plugins to the main window.
Thanks.
A rqt C++ plugin is not a ROS node but a ROS nodelet. Simply because roscpp does not support to run more then a single node per process. A nodelet always runs in a namespace ( http://wiki.ros.org/nodelet ) but should still be remappable.