Re: [ros-users] strange namespace behavior when setting the …

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
Delete this message
Reply to this message
Author: User discussions
Date:  
To: User discussions
Subject: Re: [ros-users] strange namespace behavior when setting the ROS_NAMESPACE environment variable
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 <
> 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
> 
> https://code.ros.org/mailman/listinfo/ros-users

>




--
Tully Foote
Systems Engineer
Willow Garage, Inc.

(650) 475-2827