strange namespace behavior when setting the ROS_NAMESPACE environment variable
Hi all,
I have a node publishing a topic let's say "my_topic". Simply running this node, rostopic list tells me as expected:
/my_topic
/rosout
/rosout_agg
Now, when I want to push this node to a namespace by: export ROS_NAMESPACE=my_ns
rostopic list says:
/my_ns/my_ns/my_ns/my_topic
/rosout
/rosout_agg
Any idea where three times "my_ns" comes from? When I run the node from a launch file and set the "ns" attribute, everything is alright. I'm not doing anything fancy with namespaces etc. in the node, I put some example code below. It seems like this came with ros 1.4.8. It used to work with 1.4.6 which I had installed before.
Best, Markus
#include <ros/ros.h>
#include <std_msgs/String.h>
int main(int argc, char** argv)
{
ros::init(argc, argv, "ns_test");
ros::NodeHandle nh;
ros::Publisher pub = nh.advertise<std_msgs::String> ("my_topic", 1);
ros::Rate r(5);
while (ros::ok())
{
std_msgs::String msg;
msg.data = "my string message";
pub.publish(msg);
r.sleep();
}
return 0;
}