Multiple Robot #929
Replies: 7 comments
-
turtlebot_driver_1 = WebotsController(
robot_name='TurtleBot3Burger1',
parameters=[
{'robot_description': robot_description_path,
'use_sim_time': use_sim_time,
'update_rate':50,
'set_robot_state_publisher': True},
ros2_control_params
],
port='1234',
remappings=mappings_1,
respawn=True,
namespace='robot1'
)
turtlebot_driver_2 = WebotsController(
robot_name='TurtleBot3Burger2',
parameters=[
{'robot_description': robot_description_path,
'use_sim_time': use_sim_time,
'update_rate':50,
'set_robot_state_publisher': True},
ros2_control_params
],
port='1235',
remappings=mappings_2,
respawn=True,
namespace='robot2'
) my turtlebot drivers |
Beta Was this translation helpful? Give feedback.
-
[webots_controller_TurtleBot3Burger1-7] [INFO] [1717368580.961037646] [resource_manager]: Initialize hardware 'WebotsControl'
[webots_controller_TurtleBot3Burger1-7] [INFO] [1717368580.961125287] [resource_manager]: Successful initialization of hardware 'WebotsControl'
[webots_controller_TurtleBot3Burger1-7] [INFO] [1717368580.961201163] [resource_manager]: 'configure' hardware 'WebotsControl'
[webots_controller_TurtleBot3Burger1-7] [INFO] [1717368580.961206153] [resource_manager]: Successful 'configure' of hardware 'WebotsControl'
[webots_controller_TurtleBot3Burger1-7] [INFO] [1717368580.961209710] [resource_manager]: 'activate' hardware 'WebotsControl'
[webots_controller_TurtleBot3Burger1-7] [INFO] [1717368580.961213063] [resource_manager]: Successful 'activate' of hardware 'WebotsControl'
[webots_controller_TurtleBot3Burger1-7] [INFO] [1717368581.097228238] [plugin_node_example]: - properties: {'parameterExample': 'someValue'}
[webots_controller_TurtleBot3Burger1-7] [INFO] [1717368581.097492533] [plugin_node_example]: - robot name: TurtleBot3Burger1
[webots_controller_TurtleBot3Burger1-7] [INFO] [1717368581.097703848] [plugin_node_example]: - basic timestep: 20
[webots_controller_TurtleBot3Burger1-7] [INFO] [1717368581.097924458] [plugin_node_example]: - is supervisor? False
[ERROR] [launch]: Caught exception in launch (see debug for traceback): ExecuteLocal action 'webots_controller_TurtleBot3Burger2-9': executed more than once: <webots_ros2_driver.webots_controller.WebotsController object at 0x7c3e27f6bc10>
[INFO] [webots_controller_TurtleBot3Burger2-8]: sending signal 'SIGINT' to process[webots_controller_TurtleBot3Burger2-9]
[INFO] [webots_controller_TurtleBot3Burger1-7]: sending signal 'SIGINT' to process[webots_controller_TurtleBot3Burger1-7]
[INFO] [static_transform_publisher-6]: sending signal 'SIGINT' to process[static_transform_publisher-6]
[INFO] [static_transform_publisher-5]: sending signal 'SIGINT' to process[static_transform_publisher-5]
[INFO] [robot_state_publisher-4]: sending signal 'SIGINT' to process[robot_state_publisher-4]
[INFO] [robot_state_publisher-3]: sending signal 'SIGINT' to process[robot_state_publisher-3]
[INFO] [ros2_supervisor.py-2]: sending signal 'SIGINT' to process[ros2_supervisor.py-2]
[INFO] [webots-1]: sending signal 'SIGINT' to process[webots-1]
[static_transform_publisher-6] [INFO] [1717368581.102902468] [rclcpp]: signal_handler(signum=2)
[static_transform_publisher-5] [INFO] [1717368581.103542493] [rclcpp]: signal_handler(signum=2)
[robot_state_publisher-4] [INFO] [1717368581.104079386] [rclcpp]: signal_handler(signum=2)
[robot_state_publisher-3] [INFO] [1717368581.104681721] [rclcpp]: signal_handler(signum=2)
[ERROR] [ros2_supervisor.py-2]: process has died [pid 22287, exit code -2, cmd '/home/harunkurtdev/workspace_ws/install/webots_ros2_driver/lib/webots_ros2_driver/ros2_supervisor.py --ros-args -r __ns:=/Ros2Supervisor -r /Ros2Supervisor/clock:=/clock'].
[webots_controller_TurtleBot3Burger1-7] [INFO] [1717368581.142501719] [robot1.TurtleBot3Burger1]: Controller successfully disconnected from robot in Webots simulation.
[INFO] [static_transform_publisher-6]: process has finished cleanly [pid 22297]
[INFO] [static_transform_publisher-5]: process has finished cleanly [pid 22295]
[INFO] [robot_state_publisher-4]: process has finished cleanly [pid 22293]
[INFO] [robot_state_publisher-3]: process has finished cleanly [pid 22290]
[INFO] [webots-1]: process has finished cleanly [pid 22285]
[INFO] [webots_controller_TurtleBot3Burger1-7]: process has finished cleanly [pid 22300]
[webots_controller_TurtleBot3Burger2-9] Cannot connect to Webots instance, retrying for another 40 seconds...
[ERROR] [webots_controller_TurtleBot3Burger2-8]: process[webots_controller_TurtleBot3Burger2-9] failed to terminate '5' seconds after receiving 'SIGINT', escalating to 'SIGTERM'
[INFO] [webots_controller_TurtleBot3Burger2-8]: sending signal 'SIGTERM' to process[webots_controller_TurtleBot3Burger2-9]
[ERROR] [webots_controller_TurtleBot3Burger2-8]: process has died [pid 22302, exit code -15, cmd '/home/harunkurtdev/workspace_ws/install/webots_ros2_driver/share/webots_ros2_driver/scripts/webots-controller --robot-name=TurtleBot3Burger2 --protocol=ipc --port=1235 ros2 --ros-args -r /diffdrive_controller/cmd_vel_unstamped:=/cmd_vel -r /diffdrive_controller/odom:=/odom -r __ns:=/robot2 -p robot_description:=/home/harunkurtdev/workspace_ws/install/webots_ros2_turtlebot/share/webots_ros2_turtlebot/resource/turtlebot_webots.urdf -p use_sim_time:=True -p update_rate:=50 -p set_robot_state_publisher:=True --params-file /home/harunkurtdev/workspace_ws/install/webots_ros2_turtlebot/share/webots_ros2_turtlebot/resource/ros2control.yml']. I got have error for webots_controller_TurtleBot3Burger |
Beta Was this translation helpful? Give feedback.
-
@DavidMansolino sir, can you give me some advice for this. I have not use multiple robot |
Beta Was this translation helpful? Give feedback.
-
# Wait for the simulation to be ready to start navigation nodes
waiting_nodes_1 = WaitForControllerConnection(
target_driver=turtlebot_driver_1,
nodes_to_start= navigation_nodes + ros_control_spawners
)
waiting_nodes_2 = WaitForControllerConnection(
target_driver=turtlebot_driver_2,
nodes_to_start= navigation_nodes + ros_control_spawners
) we have to support waiting node |
Beta Was this translation helpful? Give feedback.
-
turtlebot_driver_2 = WebotsController(
robot_name='TurtleBot3Burger2',
parameters=[
{'robot_description': robot_description_path,
'use_sim_time': use_sim_time,
'update_rate':50,
'set_robot_state_publisher': True},
ros2_control_params_2
],
port='1235',
remappings=mappings_2,
respawn=False,
namespace='robot2'
) if use that port 1234 getting error like this, [ERROR] [launch]: Caught exception in launch (see debug for traceback): ExecuteLocal action 'spawner-13': executed more than once: <launch_ros.actions.node.Node object at 0x7d2b4cdb9fc0>
[INFO] [spawner-9]: process started with pid [8888]
[INFO] [spawner-10]: process started with pid [8890]
[INFO] [spawner-11]: process started with pid [8892]
[INFO] [spawner-12]: process started with pid [8894]
[INFO] [webots_controller_TurtleBot3Burger2-8]: sending signal 'SIGINT' to process[webots_controller_TurtleBot3Burger2-8]
[INFO] [webots_controller_TurtleBot3Burger1-7]: sending signal 'SIGINT' to process[webots_controller_TurtleBot3Burger1-7]
[INFO] [static_transform_publisher-6]: sending signal 'SIGINT' to process[static_transform_publisher-6]
[INFO] [static_transform_publisher-5]: sending signal 'SIGINT' to process[static_transform_publisher-5]
[INFO] [robot_state_publisher-4]: sending signal 'SIGINT' to process[robot_state_publisher-4]
[INFO] [robot_state_publisher-3]: sending signal 'SIGINT' to process[robot_state_publisher-3]
[INFO] [ros2_supervisor.py-2]: sending signal 'SIGINT' to process[ros2_supervisor.py-2]
[INFO] [webots-1]: sending signal 'SIGINT' to process[webots-1]
[static_transform_publisher-6] [INFO] [1717878984.148218054] [rclcpp]: signal_handler(signum=2)
[static_transform_publisher-5] [INFO] [1717878984.158651176] [rclcpp]: signal_handler(signum=2)
[robot_state_publisher-4] [INFO] [1717878984.159629526] [rclcpp]: signal_handler(signum=2)
[robot_state_publisher-3] [INFO] [1717878984.160725534] [rclcpp]: signal_handler(signum=2)
[INFO] [spawner-9]: sending signal 'SIGINT' to process[spawner-13]
[INFO] [spawner-10]: sending signal 'SIGINT' to process[spawner-10]
[INFO] [spawner-11]: sending signal 'SIGINT' to process[spawner-11]
[INFO] [spawner-12]: sending signal 'SIGINT' to process[spawner-12]
[spawner-13] Traceback (most recent call last):
[spawner-13] File "/opt/ros/humble/lib/controller_manager/spawner", line 10, in <module>
[spawner-13] from importlib.metadata import distribution
[spawner-13] File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 10, in <module>
[ERROR] [ros2_supervisor.py-2]: process has died [pid 8737, exit code -2, cmd '/home/harunkurtdev/workspace_ws/install/webots_ros2_driver/lib/webots_ros2_driver/ros2_supervisor.py --ros-args -r __ns:=/Ros2Supervisor -r /Ros2Supervisor/clock:=/clock'].
[spawner-10] Traceback (most recent call last):
[spawner-10] File "/opt/ros/humble/lib/controller_manager/spawner", line 10, in <module>
[spawner-10] from importlib.metadata import distribution
[spawner-10] File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 17, in <module>
[spawner-11] Traceback (most recent call last):
[spawner-11] File "/opt/ros/humble/lib/controller_manager/spawner", line 10, in <module>
[spawner-11] from importlib.metadata import distribution
[spawner-11] File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 17, in <module>
[spawner-12] Traceback (most recent call last):
[spawner-12] File "/opt/ros/humble/lib/controller_manager/spawner", line 10, in <module>
[spawner-12] from importlib.metadata import distribution
[spawner-12] File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 17, in <module>
[spawner-13] import textwrap
[spawner-13] File "/usr/lib/python3.10/textwrap.py", line 17, in <module>
[spawner-12] from . import _adapters, _meta
[spawner-12] File "/usr/lib/python3.10/importlib/metadata/_adapters.py", line 3, in <module>
[spawner-10] from . import _adapters, _meta
[spawner-10] File "/usr/lib/python3.10/importlib/metadata/_adapters.py", line 3, in <module>
[spawner-11] from . import _adapters, _meta
[spawner-11] File "/usr/lib/python3.10/importlib/metadata/_adapters.py", line 3, in <module>
[spawner-11] import email.message
[spawner-11] File "/usr/lib/python3.10/email/message.py", line 15, in <module>
[spawner-12] import email.message
[spawner-12] File "/usr/lib/python3.10/email/message.py", line 15, in <module>
[spawner-10] import email.message
[spawner-10] File "/usr/lib/python3.10/email/message.py", line 10, in <module>
[spawner-10] import uu
[spawner-10] File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
[spawner-13] class TextWrapper:
[spawner-13] File "/usr/lib/python3.10/textwrap.py", line 81, in TextWrapper
[spawner-13] wordsep_re = re.compile(r'''
[spawner-13] File "/usr/lib/python3.10/re.py", line 251, in compile
[spawner-11] from email import utils
[spawner-11] File "/usr/lib/python3.10/email/utils.py", line 28, in <module>
[spawner-12] from email import utils
[spawner-12] File "/usr/lib/python3.10/email/utils.py", line 29, in <module>
[spawner-12] import socket
[spawner-12] File "/usr/lib/python3.10/socket.py", line 51, in <module>
[spawner-13] return _compile(pattern, flags)
[spawner-13] File "/usr/lib/python3.10/re.py", line 303, in _compile
[spawner-13] p = sre_compile.compile(pattern, flags)
[spawner-13] File "/usr/lib/python3.10/sre_compile.py", line 788, in compile
[spawner-10] File "<frozen importlib._bootstrap>", line 1002, in _find_and_load_unlocked
[spawner-10] File "<frozen importlib._bootstrap>", line 945, in _find_spec
[spawner-11] import random
[spawner-11] File "/usr/lib/python3.10/random.py", line 857, in <module>
[spawner-10] File "<frozen importlib._bootstrap_external>", line 1439, in find_spec
[spawner-10] File "<frozen importlib._bootstrap_external>", line 1411, in _get_spec
[spawner-10] File "<frozen importlib._bootstrap_external>", line 1572, in find_spec
[spawner-12] import _socket
[spawner-12] KeyboardInterrupt
[spawner-10] File "<frozen importlib._bootstrap_external>", line 128, in _path_join
[spawner-10] File "<frozen importlib._bootstrap_external>", line 128, in <listcomp>
[spawner-10] KeyboardInterrupt
[spawner-13] p = sre_parse.parse(p, flags)
[spawner-13] File "/usr/lib/python3.10/sre_parse.py", line 955, in parse
[spawner-11] _inst = Random()
[spawner-11] File "/usr/lib/python3.10/random.py", line 119, in __init__
[spawner-11] def __init__(self, x=None):
[spawner-11] KeyboardInterrupt
[spawner-13] p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
[spawner-13] File "/usr/lib/python3.10/sre_parse.py", line 444, in _parse_sub
[spawner-13] itemsappend(_parse(source, state, verbose, nested + 1,
[spawner-13] File "/usr/lib/python3.10/sre_parse.py", line 846, in _parse
[spawner-13] state.closegroup(group, p)
[spawner-13] File "/usr/lib/python3.10/sre_parse.py", line 98, in closegroup
[spawner-13] self.groupwidths[gid] = p.getwidth()
[spawner-13] File "/usr/lib/python3.10/sre_parse.py", line 185, in getwidth
[spawner-13] l, h = av.getwidth()
[spawner-13] KeyboardInterrupt
[ERROR] [spawner-10]: process has died [pid 8890, exit code -2, cmd '/opt/ros/humble/lib/controller_manager/spawner joint_state_broadcaster --controller-manager-timeout 50 --ros-args -r __ns:=/robot1'].
[ERROR] [spawner-11]: process has died [pid 8892, exit code -2, cmd '/opt/ros/humble/lib/controller_manager/spawner diffdrive_controller --controller-manager-timeout 50 --ros-args -r __ns:=/robot2'].
[ERROR] [spawner-12]: process has died [pid 8894, exit code -2, cmd '/opt/ros/humble/lib/controller_manager/spawner joint_state_broadcaster --controller-manager-timeout 50 --ros-args -r __ns:=/robot2'].
[ERROR] [spawner-9]: process has died [pid 8888, exit code -2, cmd '/opt/ros/humble/lib/controller_manager/spawner diffdrive_controller --controller-manager-timeout 50 --ros-args -r __ns:=/robot1'].
[webots_controller_TurtleBot3Burger2-8] [INFO] [1717878984.241975457] [robot2.TurtleBot3Burger2]: Controller successfully disconnected from robot in Webots simulation.
[webots_controller_TurtleBot3Burger1-7] [INFO] [1717878984.241982274] [robot1.TurtleBot3Burger1]: Controller successfully disconnected from robot in Webots simulation.
[INFO] [static_transform_publisher-6]: process has finished cleanly [pid 8747]
[INFO] [static_transform_publisher-5]: process has finished cleanly [pid 8745]
[INFO] [robot_state_publisher-4]: process has finished cleanly [pid 8743]
[INFO] [robot_state_publisher-3]: process has finished cleanly [pid 8740]
[INFO] [webots-1]: process has finished cleanly [pid 8735]
[INFO] [webots_controller_TurtleBot3Burger2-8]: process has finished cleanly [pid 8752]
[INFO] [webots_controller_TurtleBot3Burger1-7]: process has finished cleanly [pid 8749]
harunkurtdev@harunkurtdev:~/workspace_ws$ |
Beta Was this translation helpful? Give feedback.
-
Only running one Supervisior |
Beta Was this translation helpful? Give feedback.
-
I changed webots = WebotsLauncher(
world=PathJoinSubstitution([package_dir, 'worlds', world]),
mode=mode,
port="1236",
#ros2_supervisors=[ros2_supervisor_1, ros2_supervisor_2]
ros2_supervisor=True
) drive connect second turtlebot |
Beta Was this translation helpful? Give feedback.
-
Is your feature request related to a problem? Please describe.
The current implementation of the
WebotsLauncher
class does not support launching multiple supervisors simultaneously, which limits the capability of running multiple robot instances in Webots with different controllers.Describe the solution you'd like ?
To enable support for launching multiple supervisors simultaneously, the
WebotsLauncher
class needs to be modified to accept configurations for multiple supervisors. Each supervisor configuration should include parameters such as the port number.Describe alternatives you've considered ?
An alternative solution could be to manually launch each supervisor node separately outside of the
WebotsLauncher
class, but this would be less convenient and may require additional setup and coordination.Additional context ?
Adding support for multiple supervisors would enhance the flexibility and scalability of running multiple robot instances in Webots, especially in complex robotic simulations or multi-robot scenarios.
Beta Was this translation helpful? Give feedback.
All reactions