[ros-users] Quick question about namespaces

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: [ros-users] Quick question about namespaces
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