Hello, I am trying to make a simple application of 2 robots moving around in the webots simulator using ROS2. I am using the logic described in the tutorials https://docs.ros.org/en/foxy/Tutorials/Advanced/Simulators/Webots.html which dictates the following:
A description for each robot in the .wbt world file
A URDF file for each robot with the connected devices and the plugin to the robot driver
An obstacle avoider node for each robot
And a controller node for each robot specified in the launch file.
I think that this last part is the source of the problem. This is the part of the launch file where I call the controller:
ros2_supervisor_robot1 = Node(
package='webots_ros2_driver',
executable='ros2_supervisor.py',
output='screen',
additional_env={'WEBOTS_CONTROLLER_URL': controller_url_prefix() + 'Ros2Supervisor'},
name='Ros2Supervisor')
ros2_supervisor_robot2 = Node(
package='webots_ros2_driver',
executable='ros2_supervisor.py',
output='screen',
additional_env={'WEBOTS_CONTROLLER_URL': controller_url_prefix() + 'Ros2Supervisor'},
name='Ros2Supervisor2')
In the tutorial this launcher for the Ros2Supervisor is used:
ros2_supervisor_robot1 = webots_ros2_driver.webots_launcher.Ros2SupervisorLauncher()
In both cases, the first robot works properly like in the tutorial but the second robot does not because it try as well to connect to the same Ros2Supercisor node and thus the process dies.
I would also like to add that in the .wbt world file, I have left the "controller" field of each robot exactly the same as in the tutorial (controller "")
What is it that I miss? Is there a way to fix this issue?
Thank you
Originally posted by smarn on ROS Answers with karma: 54 on 2023-03-01
Post score: 3