Multi-robot spawning in WeBots from launch #849
Replies: 3 comments 1 reply
-
I would recommend you to upgrade to Humble (or Iron) as Foxy is not supported any more. |
Beta Was this translation helpful? Give feedback.
-
I've now upgrade my ros installation to humble, and I'm running into a problem that there isn't a webots_ros2_tests module. Is that only available on Iron? |
Beta Was this translation helpful? Give feedback.
-
Realized I had more going on under the surface with supervisor issues, and I needed to upgrade to Ros2 Humble. The below snippet essentially solved these problems, and now I'm onto different and hopefully easier bugs! import os
import launch
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from webots_ros2_driver.webots_launcher import WebotsLauncher
from webots_ros2_driver.webots_controller import WebotsController
package_dir = get_package_share_directory('webots_pkg')
def generate_launch_description():
"""
Launches the webots world and the ros2 supervisor
"""
# THIS is for the robot_driver (unnecessary for webots_pkg)
webots = WebotsLauncher(
world=os.path.join(package_dir, 'worlds', 'apartment.wbt'),
mode=''
)
webots = WebotsLauncher(
world=os.path.join(package_dir, 'worlds', 'apartment.wbt'),
ros2_supervisor=True
)
# Add event handler so everything shuts down on Webots exit
event_handler = launch.actions.RegisterEventHandler(
event_handler=launch.event_handlers.OnProcessExit(
target_action=webots,
on_exit=[launch.actions.EmitEvent(event=launch.events.Shutdown())],
)
)
return LaunchDescription([
webots,
webots._supervisor,
event_handler,
])
if __name__ == "__main__":
generate_launch_description()
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've been having some issues with spawning Robots within my webots environment. My end goal is to spawn a few crazyflies and potentially a few turtlebots to an already running simulation, or use them as parameters to add to a simulation. I've been looking into the documentation extensivly regarding URDF's and Xacros. I wasn't able to find much regarding spawning robots via the Supervisor Node.
One launch file looks like this:
When I exit the second launch file, here is my output:
Any ideas on how to help with this problem
Also, here's my rqt graph if it is helpful

This was run on Ubuntu 20.04, and Webots 2022b with ROS Foxy. I can change that as needed.
Beta Was this translation helpful? Give feedback.
All reactions