[ros-users] strange namespace behavior when setting the ROS_NAMESPACE environment variable

Tully Foote tfoote at willowgarage.com
Thu Jul 21 09:01:06 UTC 2011


Hi Markus,

This is a good question.  If you could ask it on http://answers.ros.org it's
easier for the community to respond and find it in the future.

Thanks,
Tully

On Thu, Jul 21, 2011 at 1:27 AM, Achtelik Markus <
markus.achtelik at mavt.ethz.ch> wrote:

> Hi all,
>
> I tried to post this via nabble.com but somehow it didn't get through ...
> 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. rosversion ros says 1.4.8 .
>
> 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;
> }
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users
>



-- 
Tully Foote
Systems Engineer
Willow Garage, Inc.
tfoote at willowgarage.com
(650) 475-2827
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ros.org/pipermail/ros-users/attachments/20110721/ee39dc77/attachment-0002.html>


More information about the ros-users mailing list