Namespace and Remapping
Hello all, I have been reading the documentation and running test examples on namespaces and remaps but I still cannot achieve what I am trying to do. My attempts have also spawned new questions which I could not find answers to.
First Problem: My node publishes topics in the following manner:
/mynode/[robot_name]/sim/twist /mynode/[robot_name]/sim/odom /mynode/[robot_name]/sim/base_scan
I would like to remap the sim/* commands to other commands:
/mynode/[robot_name]/sim/twist -> /[robot_name]/cmd_vel /mynode/[robot_name]/sim/odom -> /[robot_name]/odom /mynode/[robot_name]/sim/base_scan -> /[robot_name]/base_scan
Note, that [robot_name] is dynamic, based on an input file. (Just like stage's robot_0, robot_1, robot_2, etc).
Removing the node name was simple, but the sim/* -> new_name did not work. In the launch file:
<remap from="/mynode" to ="/" /> --- This works <remap from="sim/twist" to ="cmd_vel" /> --- These don't <remap from="sim/odom" to ="odom" /> --- These don't <remap from="sim/base_scan" to ="base_scan" /> --- These don't
Could anyone offer any suggestions on a fix?
Second Problem: When I remap "/mynode" to "/", parameters I pass into my node aren't found anymore. NodeHandle.searchParam does not find them, but they still exist. For example:
namespace of node = "/" (this is because of the remap above) parameters = "/mynode/PARAM1" , "/mynode/PARAM2" (parameters are not remapped!!)
As stated, searchParams does not find them, but getParam("/mynode/Param1") works (and of course getParam("Param1") fails since the node's namespace changed. Does anyone have any thoughts? Thank you for your time!