This fix runs all private name remaps through another round of remapping after the anonymous node name is finished. The first remapping round is done with incomplete node name, which resulted in inability to remap private names for anonymous nodes without __name:= arg.
The new behavior corresponds to what rospy is doing.
The impact on existing code should be close to zero. Anything launched from a launch file will not be affected. The only affected usages are manual rosrun commands (and if somebody does some crazy things around ros::init()).
I did not find a good way to remove the wrong remappings, so they remain there. I.e. g_remappings will contain both /node/topic->newtopic and /node_12321321/topic->newtopic. This isn't correct, but it could actually serve as a backwards compatibility feature for the case if someone was working around #2324 by explicitly remapping the incomplete name.
Real-world tools affected by #2324 can be found e.g. here: http://docs.ros.org/en/latest/api/cras_topic_tools/html/classcras_1_1ThrottleMessagesNodelet.html#details . It is an improved version of topic_tools throttle which, if no topic args are given through CLI, subscribes to ~input topic. When running as rosrun cras_topic_tools throttle ~input:=/remapped, the remap does not happen without this PR. Appending __name:=foo makes the remap happy, which is confusing.
Fixes #2324.
This fix runs all private name remaps through another round of remapping after the anonymous node name is finished. The first remapping round is done with incomplete node name, which resulted in inability to remap private names for anonymous nodes without
__name:=
arg.The new behavior corresponds to what rospy is doing.
The impact on existing code should be close to zero. Anything launched from a launch file will not be affected. The only affected usages are manual
rosrun
commands (and if somebody does some crazy things aroundros::init()
).I did not find a good way to remove the wrong remappings, so they remain there. I.e.
g_remappings
will contain both/node/topic->newtopic
and/node_12321321/topic->newtopic
. This isn't correct, but it could actually serve as a backwards compatibility feature for the case if someone was working around #2324 by explicitly remapping the incomplete name.Real-world tools affected by #2324 can be found e.g. here: http://docs.ros.org/en/latest/api/cras_topic_tools/html/classcras_1_1ThrottleMessagesNodelet.html#details . It is an improved version of
topic_tools throttle
which, if no topic args are given through CLI, subscribes to~input
topic. When running asrosrun cras_topic_tools throttle ~input:=/remapped
, the remap does not happen without this PR. Appending__name:=foo
makes the remap happy, which is confusing.