I am following the tutorial of Setting up a robot simulation in Webots (Basic) which is in ROS2 humble documentation. Here I have a .wbt world file, .urdf file according to the tutorial. I have added another robot in the world file and change controller node for each robot specified in the launch file. In the tutorial they have mentioned "if you had more robots in the simulation, you would have to run one instance of this node per robot". This is the part of my launch file where I created the nodes:
my_robot_driver_1 = WebotsController(
robot_name='my_robot_1',
parameters=[
{'robot_description': robot_description_path},
]
)
my_robot_driver_2 = WebotsController(
robot_name='my_robot_2',
parameters=[
{'robot_description': robot_description_path},
]
)
After successfully running the code webots starts with 2 robots and the topic list is:
/cmd_vel
/my_robot_1/ds0
/my_robot_1/ds1
/my_robot_2/ds0
/my_robot_2/ds1
/parameter_events
/remove_urdf_robot
/rosout
Here there is 1 /cmd_vel
but i need different /cmd_vel
for each robot like (expected topic list):
/my_robot_1/cmd_vel
/my_robot_1/ds0
/my_robot_1/ds1
/my_robot_2/cmd_vel
/my_robot_2/ds0
/my_robot_2/ds1
/parameter_events
/remove_urdf_robot
/rosout
In the world file, "controller" field of each robot is exactly the same as in the tutorial controller "<extern>"
.
How to solve this problem? Thank you.