[ros-users] Quick question about namespaces

Ken Conley kwc at willowgarage.com
Thu Jan 27 17:20:55 UTC 2011


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 <kwc at willowgarage.com> wrote:
> Hi Mike,
>
> rospy doesn't have this ability yet.
>
>  - Ken
>
> On Wed, Jan 26, 2011 at 10:45 AM, Mike Purvis
> <mpurvis at clearpathrobotics.com> 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
>> ros-users at code.ros.org
>> https://code.ros.org/mailman/listinfo/ros-users
>>
>>
>



More information about the ros-users mailing list