[ros-users] Quick question about namespaces

Mike Purvis mpurvis at clearpathrobotics.com
Wed Jan 26 18:45:51 UTC 2011


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osuosl.org/pipermail/ros-users/attachments/20110126/ae7a8c7e/attachment-0002.html>


More information about the ros-users mailing list