How to remap topic's name?
Hi! I'm using ROS kinetic on Ubuntu 16.04.
My 2D Lidar sensor Hokuyo requires urg_node to publish laser-scanned topic (its name is "/scan")
And I want to remap the name of this topic from "/scan" to "laser".
In detail, what I want to get is sensor_msgs/LaserSacn topic, whose name is "laser", and I also wish this laser topic should be in namespace of "/spencer/perception_internal/people_detection/laser_front" .
I heard that <remap> command should change it. But unfortunately, I run urg_node by rosrun, not roslaunch which means I can't modify it in launch file.
In this case, should I modify it in source node file(urg_node.cpp)?
And, once I change the topic's name to "/spencer/perception_internal/people_detection/laser_front/laser ", it this laser-scanned topic could be in namespace of "/spencer/perception_internal/people_detection/ laser_front" ? (The namespace "/spencer/perception_internal/people_detection/laser_front" comes from other package.)
why not create a launch file for the node? Its only few lines and makes remapping and passing parameters way easier and cleaner.
Here is an example of a launch file for the
urg_node
that you can use. Then all you need is to add the remap:Of course you can make this way cleaner by using an arguments and launch the node within a namespace
Thank you for your quick answer. Then, by doing according to your advice, would the laser-scanned topic from urg_node be in namespace of /spencer/perception_internal/people_detection/laser_front? Anyway, thanks for your really really quick feedback. :)
You can check the answer bellow, it contains an example launch file