Skip to content

more worlds in gazebo #595

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 21, 2025
Merged

more worlds in gazebo #595

merged 2 commits into from
Jul 21, 2025

Conversation

husarafal
Copy link

@husarafal husarafal commented Jul 11, 2025

Description

I have added a new scene launch argument in husarion_ugv_gazebo, in simulation.launch.py, which can be set to predefined strings like outdoor, ioffice, etc. This allows to easily switch between worlds.

Specifying the argument effectively updates the launch arguments passed to descendant launch files, husarion_gz_worlds/gz_sim.launch.py, and husarion_ugv_gazebo/simulate_robot.launch.py. This is done in order to load a different world and to set a more suitable initial position of the robot.

Try it out like this:

ros2 launch husarion_ugv_gazebo simulation.launch.py scene:=outdoor

Scenes to review:

Requirements

  • Backport
  • Code style guidelines followed
  • Documentation updated

Tests 🧪

  • Container
  • Simulation

Summary by CodeRabbit

  • Documentation

    • Added a "Worlds" section to the README explaining how to run simulations with different world scenes and listing available built-in worlds.
  • Chores

    • Updated the version of the simulation worlds dependency.
  • Refactor

    • Changed the default initial robot position along the 'y' axis in the simulation launch settings from -2.0 to 0.0.

Copy link
Contributor

coderabbitai bot commented Jul 11, 2025

"""

Walkthrough

The updates include a new section in the README explaining how to select simulation worlds, an updated commit hash for the husarion_gz_worlds dependency, and a modification to the default robot spawn position in the launch file.

Changes

File(s) Change Summary
husarion_ugv_gazebo/README.md Added a "Worlds" section explaining world selection in simulation and listing available worlds.
husarion_ugv/simulation_deps.repos Updated husarion_gz_worlds commit hash from 9727556... to 56b5788....
husarion_ugv_gazebo/launch/spawn_robot.launch.py Changed default robot y position from -2.0 to 0.0.

Suggested reviewers

  • rafal-gorecki
    """

Estimated code review effort

1 (<30 minutes)


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 15efdfc and 5c2d5de.

📒 Files selected for processing (1)
  • husarion_ugv/simulation_deps.repos (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • husarion_ugv/simulation_deps.repos
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Run unit tests simulation build type
  • GitHub Check: Run unit tests hardware build type
  • GitHub Check: pre-commit / pre-commit

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
husarion_ugv_gazebo/launch/simulation.launch.py (1)

51-55: Clarify the missing y coordinate for the outdoor scene.

The outdoor scene configuration doesn't specify a y coordinate, while other scenes with custom positions include all three coordinates. This inconsistency might lead to confusion.

If the intention is to use the default y value (likely 0), consider explicitly setting it for clarity:

     "outdoor": {
         "gz_world": '"https://fuel.gazebosim.org/1.0/Cole/worlds/Rubicon World"',
         "x": "3",
+        "y": "0",
         "z": "2",
     },
husarion_ugv_gazebo/README.md (1)

12-25: Minor documentation improvements.

The documentation is clear and helpful. Consider these small refinements:

 ### Worlds
 
-In order to run the simulation with a different world, use:
+To run the simulation with a different world, use:
 
-```
+```bash
 ros2 launch husarion_ugv_gazebo simulation.launch.py scene:=outdoor

</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

**Configuration used: .coderabbit.yaml**
**Review profile: CHILL**
**Plan: Pro**


<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 702a1bd20f6c13ecff038e9df55e92a0c13b45f9 and 4b0d4891ce6d6a38caed7fa2636033794c918a0f.

</details>

<details>
<summary>📒 Files selected for processing (2)</summary>

* `husarion_ugv_gazebo/README.md` (1 hunks)
* `husarion_ugv_gazebo/launch/simulation.launch.py` (5 hunks)

</details>

<details>
<summary>🧰 Additional context used</summary>

<details>
<summary>🪛 LanguageTool</summary>

<details>
<summary>husarion_ugv_gazebo/README.md</summary>

[style] ~13-~13: Consider a more concise word here.
Context: ... with the given arguments.  ### Worlds  In order to run the simulation with a different wor...

(IN_ORDER_TO_PREMIUM)

</details>

</details>
<details>
<summary>🪛 markdownlint-cli2 (0.17.2)</summary>

<details>
<summary>husarion_ugv_gazebo/README.md</summary>

16-16: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

</details>

</details>

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)</summary>

* GitHub Check: Run unit tests hardware build type
* GitHub Check: Run unit tests simulation build type

</details>

<details>
<summary>🔇 Additional comments (1)</summary><blockquote>

<details>
<summary>husarion_ugv_gazebo/launch/simulation.launch.py (1)</summary>

`65-91`: **Well-structured implementation of scene configuration.**

The dynamic parameter passing using dictionary unpacking is clean and maintainable. The approach allows easy extension with new scenes in the future.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

@husarafal husarafal changed the base branch from ros2 to ros2-devel July 11, 2025 10:27
Copy link
Contributor

@rafal-gorecki rafal-gorecki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I forget about this review (ping me in the future ;) ).

Looking on this PR IMO, we duplicate the logic of gz_world arg. What about adding additional world like this: https://github.com/husarion/husarion_gz_worlds/blob/main/worlds/sonoma_raceway.sdf
where we can specify x, y, z offset.

At best, could we simplify the execution of this argument so that we don't have to enter the entire path, but instead have aliases to the ones we already have?
So both
gz_world:=/path/to/racaway.sdf
and
gz_world:=raceway
could work.

@husarafal
Copy link
Author

husarafal commented Jul 17, 2025

Hi @rafal-gorecki,

The reason why it is a new argument in husarion_gv_gazebo is because it's not only exchanging the SDF, but also setting up the initial position of the robot.

I attempted moving the entire world in reverse by creating a new SDF in the husarion_gz_worlds that referenced the remote world from fuel, but this didn't work well for Rubicon World. There, the heightmap terrain didn't follow the transformation and became misaligned with the mesh entities.

So that leads me to a conclusion that we shouldn't be trying to modify the worlds themselves, but only move the robot within them.

If we really do not wish to add new arguments, I could modify husarion_gz_worlds' gz_world arg to accept single word filenames as you suggested, and then in husarion_ugv_gazebo I could tap into this argument and override the initial position of the robot while passing the arg down to husarion_gz_worlds as usual.

@husarafal husarafal force-pushed the gazebo-worlds branch 2 times, most recently from 727d6fe to 4f5dcbe Compare July 18, 2025 13:40
@husarafal
Copy link
Author

husarafal commented Jul 18, 2025

Okay, I have refactored everything, implementing new worlds as .sdf files in husarion_gz_worlds. Also modified the gz_world parameter to accept single-word identifiers as alternative to full paths to .sdf files.

Most changes were introduced in husarion_gz_worlds: husarion/husarion_gz_worlds#11
Those in this PR right here is just docs. And I have changed the initial Y position in spawn_robot.launch.py to be at zero.
Initial Z position was left at 0.2 so that the footprint is at world origin instead of base_link.

Test each new world using:

ros2 launch husarion_ugv_gazebo simulation.launch.py gz_world:=rubicon

Worlds to test:

  • cave
  • empty_with_plugins
  • husarion_office
  • husarion_world
  • rubicon
  • sonoma_raceway

@husarafal husarafal requested a review from rafal-gorecki July 21, 2025 09:22
@rafal-gorecki rafal-gorecki self-requested a review July 21, 2025 12:27
Copy link
Contributor

@rafal-gorecki rafal-gorecki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update hash in vcs after merge.

@rafal-gorecki rafal-gorecki merged commit ac55ed1 into ros2-devel Jul 21, 2025
3 checks passed
@rafal-gorecki rafal-gorecki deleted the gazebo-worlds branch July 22, 2025 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants