How do I modify the name of topic in launch file?
Hello, I'm using ROS melodic on Ubuntu 18.04.
I'd like to spawn 4 mobile robots and make them move randomly on gazebo simulation.
I practiced with one robot and also set a node just publishing the topic kinds of geometry_msgs/Twist
of cmd_vel
.
However, it didn't move at all, because I also had attached the namespace of /robot_0/
to all the topic wrt the spawned robot.
(so the name of cmd_vel
changed from name of cmd_vel
to /**robot_0**/name of cmd_vel
.
To discriminate 4 different kinds of cmd_vel
topics, I just set like below:
<group ns="robot_0">
<param name="tf_prefix" value="robot_0" />
<include file="$(find turtlebot_gazebo)/launch/includes/$(arg base)_object.launch.xml">
<!-- <arg name="init_pose" value="-x 0.5 -y 0.5 -z 0" /> -->
<arg name="init_pose" value="-x 5.5 -y 5.5 -z 0" />
<arg name="base" value="$(arg base)"/>
<arg name="stacks" value="$(arg stacks)"/>
<arg name="3d_sensor" value="$(arg 3d_sensor)"/>
<arg name="robot_name" value="robot_0" />
<arg name="color" value="red" />
<include>
</group>
But in the case of I made the lines wrt namespace be comment line like this,
<!-- <group ns="robot_0"> -->
<param name="tf_prefix" value="robot_0" />
<include file="$(find turtlebot_gazebo)/launch/includes/$(arg base)_object.launch.xml">
<!-- <arg name="init_pose" value="-x 0.5 -y 0.5 -z 0" /> -->
<arg name="init_pose" value="-x 5.5 -y 5.5 -z 0" />
<arg name="base" value="$(arg base)"/>
<arg name="stacks" value="$(arg stacks)"/>
<arg name="3d_sensor" value="$(arg 3d_sensor)"/>
<arg name="robot_name" value="robot_0" />
<arg name="color" value="red" />
</include>
<!-- </group> -->
It moved.
But I couldn't get the topic discriminated against following the namespace which means I couldn't distinguish which cmd_vel
topic is from which robot.
What I want to do is, 1. To make the robot move. 2. To discriminate the topics following the 4 spawned robots.
If anyone can answer or give me advice, would you please give me help?
Thanks in advance. :)