blackcoffeerobotics / bcr_bot

A Gazebo-ROS AMR robot with differential drive, depth camera, IMU and 2D LiDAR
https://blackcoffeerobotics.com/blog/migration-from-gazebo-classic-to-ignition-with-ros-2
Apache License 2.0
133 stars 30 forks source link

Refactored Gz/Gazebo launch to dynamically spawn bcr_bot #26

Closed ANGELOANTU7 closed 5 months ago

ANGELOANTU7 commented 5 months ago

Merge Request: Implement Dynamic Spawning for bcr_bot in Gazebo/Gz

Description

This merge request implements a dynamic spawning mechanism for the bcr_bot robot in Gazebo. It involves the creation of two new files: gz_spawn.launch.py and gazebo.spawn.launch.py, which are used to spawn robots into any world without being tied to specific configurations. Additionally, modifications were made to gz.launch.py and gazebo.launch.py to call these spawn files, removing hardcoded bot spawning.

Changes Made

  1. Created gz_spawn.launch.py: This file is responsible for spawning robots into Gazebo worlds.
  2. Created gazebo.spawn.launch.py: This file handles robot spawning in gazebo worlds.
  3. Modified gz.launch.py: Updated to call gz_spawn.launch.py for dynamic bot spawning.
  4. Modified gazebo.launch.py: Updated to call gazebo.spawn.launch.py for dynamic bot spawning.

Test Cases

  1. Ran usual BCR Gazebo launch file with parameters: Tested and Passed
  2. Ran usual BCR Gz launch file with parameters: Tested and Passed
  3. Ran robot in BCR Gazebo world : Tested and Passed
  4. Ran robot in BCR Gz world: Tested and Passed
  5. Spawned robot in another Gazebo world with parameters: Tested and Passed
  6. Spawned robot in another Gz world with parameters: Tested and Passed

Additional Information

Video

Test Case (1 and 3) :Screencast from 03-24-2024 02:06:37 AM.webm Test Case (2 and 4) : Screencast from 03-23-2024 09:56:47 AM.webm Test Case 5 : Screencast from 03-24-2024 01:34:33 AM.webm Test Case 6 : Screencast from 03-24-2024 12:13:33 AM.webm

D-1shu commented 5 months ago

@ANGELOANTU7 PR looks great a small change is to rename files to have clearer and more descriptive names Here are the suggested names you can come up with better names and discuss that in help channel. gz_spawn.launch.py can be renamed to bcr_bot_gz_spawn.launch.py. gazebo_spwan.launch.py can be renamed to bcr_bot_gazebo.spawn.launch.py.