Re: [ros-users] Quick question about namespaces

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: User discussions
Date:  
To: User discussions
Subject: Re: [ros-users] Quick question about namespaces
I should add, rospy exposes the name library in a more raw way:

http://www.ros.org/wiki/rospy/Overview/Names%20and%20Node%20Information

You can use it to construct this behavior, but it is not as elegant as
NodeHandles.

- Ken

On Thu, Jan 27, 2011 at 9:19 AM, Ken Conley <> wrote:
> Hi Mike,
>
> rospy doesn't have this ability yet.
>
>  - Ken
>
> On Wed, Jan 26, 2011 at 10:45 AM, Mike Purvis
> <> wrote:
>> Hey all,
>> Comparing rospy and roscpp, it looks like roscpp provides for the ability to
>> set a default namespace using the NodeHandle constructor, as done in mux:
>>
>>   // Put our API into the "mux" namespace, which the user should usually
>> remap
>>   ros::NodeHandle mux_nh("mux");
>>   // Latched publisher for selected input topic name
>>   g_pub_selected = mux_nh.advertise<std_msgs::String>(string("selected"), 1,
>> true);
>>   // Backward compatibility
>>   ros::ServiceServer ss = n.advertiseService(g_output_topic +
>> string("_select"), sel_srv_cb_dep);
>>   // New service
>>   ros::ServiceServer ss_select = mux_nh.advertiseService(string("select"),
>> sel_srv_cb);
>>   (etc)
>>
>> Is there a way to achieve this in rospy? Would you just do it using the argv
>> parameter to init_node, or is there some better way?
>> Thanks,
>> Mike
>> _______________________________________________
>> ros-users mailing list
>>
>> https://code.ros.org/mailman/listinfo/ros-users
>>
>>
>