Skip to content
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

Update First-Time Robot Setup Guide for Modern Gazebo #618

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

Amronos
Copy link

@Amronos Amronos commented Dec 10, 2024

Fixes #608.

  • Update setup_odom.rst
  • Update setup_sensors.rst
  • Add tutorial for SDF.

Copy link
Member

@SteveMacenski SteveMacenski left a comment

Choose a reason for hiding this comment

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

First of all, a huge, huge thank you for taking this on, it really helps alot to get some support in updating documentation :-)

I'm wondering if we should possibly create new pages for the odometry, sensors (in addition to the SDF we've already discussed) and leave the current pages alone. That would let you start fresh (which would probably make this easier honestly than trying to shoe horn the changes in) and also let us on the Index page https://docs.nav2.org/setup_guides/index.html allow people to choose their adventure for GZ Classic or Modern GZ if they're still on Humble. Unfortunately Humble is supported until mid-2025, so there will still be alot of GZ Classic users around for awhile.

Basically what I'm thinking is to have 2 parallel table contents, one for GZ and another for GZ Classic. They'd both share the Transformations and URDF tutorials, but the Odometry, Sensors, and SDF would change by simulator -- and then the Footprint / Plugins would again be the same. That would also give us a recipe to work with for adding support for new simulators in the future

Then once that passes, we can just delete those changes to complete the migration. What do you think? I think that would make your life easier by being able to have more control on the flow of the guide page and code blocks instead of trying to make a 1:1 analog.


We also need to install the ``gazebo_ros_pkgs`` package to simulate odometry and control the robot with ROS 2 in Gazebo:
Note that you may have described ``sam_bot`` using URDF. However, Gazebo uses `Simulation Description Format (SDF) <http://sdformat.org/>`_ to describe a robot in its simulated environment. Fortunately, Gazebo automatically translates compatible URDF files into SDF. The main requirement for the URDF to be compatible with Gazebo is to have an ``<inertia>`` element within each ``<link>`` element. This requirement is already satisfied in the URDF file of ``sam_bot``, so it can already be used in Gazebo.
Copy link
Member

Choose a reason for hiding this comment

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

I believe we're separating the SDF files now. I think the SDF tutorial should be before this one, so they should have one already (with basic frames?) that we're modifying to setup the odometry / diff drive controller

Copy link
Author

Choose a reason for hiding this comment

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

This is something defined in line 90 of the old tutorial, which I slightly updated. I think since we have/will be having a URDF and SDF tutorial now, this is something that may cause confusion so I will remove it.

@Amronos
Copy link
Author

Amronos commented Dec 11, 2024

First of all, a huge, huge thank you for taking this on, it really helps alot to get some support in updating documentation :-)

You are welcome! Thanks a lot for appreciating the effort.

I'm wondering if we should possibly create new pages for the odometry, sensors (in addition to the SDF we've already discussed) and leave the current pages alone. That would let you start fresh (which would probably make this easier honestly than trying to shoe horn the changes in) and also let us on the Index page docs.nav2.org/setup_guides/index.html allow people to choose their adventure for GZ Classic or Modern GZ if they're still on Humble. Unfortunately Humble is supported until mid-2025, so there will still be alot of GZ Classic users around for awhile.

Basically what I'm thinking is to have 2 parallel table contents, one for GZ and another for GZ Classic. They'd both share the Transformations and URDF tutorials, but the Odometry, Sensors, and SDF would change by simulator -- and then the Footprint / Plugins would again be the same. That would also give us a recipe to work with for adding support for new simulators in the future

Then once that passes, we can just delete those changes to complete the migration. What do you think? I think that would make your life easier by being able to have more control on the flow of the guide page and code blocks instead of trying to make a 1:1 analog.

Those ideas do sound good to me. I'm not sure what you mean by "2 parallel table contents." Could you go into a bit more detail about that/how to implement it?

@SteveMacenski
Copy link
Member

In the index page, we have a section called "Table of Contents" where we list those guide pages. Instead, we could have 2 separate sections, one for GZ Modern and another for GZ Classic where we link the appropriate versions of the pages. For some, they'll be the same page (URDF, Footprint), but for others they'll change (the ones you're working on).

that would give us the tutorials for both up simultaneously and give you more free reign on the Modern GZ pages to break from the existing where things change more easily

@Amronos
Copy link
Author

Amronos commented Jan 4, 2025

@SteveMacenski, I'm sorry for the delay on this! I will try my best to get this completed in a couple of days.
I tried my best to implement what you suggested for the index page. Do give feedback if it isn't how you expected it to be (I don't think it is).

@Amronos Amronos requested a review from SteveMacenski January 4, 2025 08:36
@SteveMacenski
Copy link
Member

Hey no worries at all - the holidays are for relaxing afterall :-)

Copy link
Member

@SteveMacenski SteveMacenski left a comment

Choose a reason for hiding this comment

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

Nice thinking in breaking out the robot localization page for both to share :-)

Largely speaking, this looks great! More or less small tweaks and a few things to shuffle around

@@ -30,8 +29,12 @@ When using Jazzy or newer, consider that the simulation elements of the tutorial

transformation/setup_transforms.rst
Copy link
Member

Choose a reason for hiding this comment

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

I think what we should have here is a page split in half with 2 of these toctrees for each the Gazebo Classic and Modern Gazebo. I checked with rst and there isn't a way to split vertically, but we can using HTML. I'm not much a web-dev guy, but this is one case where chatgpt can be helpful. It looks like we can do that via the following, adapted to our case here obviously:

My Split Page
=============

.. raw:: html

    <div style="display: flex; gap: 20px;">

    <div style="flex: 1; padding: 10px; border-right: 1px solid #ccc;">

.. toctree::
   :maxdepth: 2

   section1
   section2
   section3

.. raw:: html

    </div>

    <div style="flex: 1; padding: 10px;">

.. toctree::
   :maxdepth: 2

   section4
   section5
   section6

.. raw:: html

    </div>
    </div>

So each side should have the full setup_transformations -> select_algorithm pipeline, but with the links to the appropriate GZ vs classic pages where required

Copy link
Author

Choose a reason for hiding this comment

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

Thanks! Did it in 2f92964, had to use a bit of chatgpt too. :-)

Copy link
Member

Choose a reason for hiding this comment

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

So I see the 2 sections, but none of the actual links on it https://output.circle-artifacts.com/output/job/95f5e86b-5415-4fcd-8b17-ec6cdff44bb5/artifacts/0/html/setup_guides/index.html -- did you test this locally?

@@ -13,15 +13,14 @@ This section is a collection of guides that aims to provide readers a good resou

To guide you through the first-time setup of your robot, we will be tackling the following topics:

- Introduce TF2 and setup your robot URDF
- Introduce TF2 and setup your robot URDF or SDF
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- Introduce TF2 and setup your robot URDF or SDF
- Introduce TF2 and setup your robot URDF & SDF

Copy link
Author

Choose a reason for hiding this comment

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

I still think this should be URDF or SDF, as in most use cases, both are not needed. I will add a note in the tutorials for URDF & SDF, that the other is an option and to use SDF if the reader is going to make a Gazebo simulation.

Copy link
Author

Choose a reason for hiding this comment

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

I will add a note in the tutorials for URDF & SDF, that the other is an option and to use SDF if the reader is going to make a Gazebo simulation.

Done in 4209601.

Copy link
Member

Choose a reason for hiding this comment

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

@Amronos I think for new Gazebo, they really are pushing you down the road of using SDFs and separate URDFs. That has been best practices in Gazebo Classic for awhile, but old habits die hard.

I think for the purposes of this tutorial, we should only propose this as URDF and SDF. URDF is the basic robot frames and descriptions. SDF is the gazebo plugins and simulation items

setup_guides/index.rst Outdated Show resolved Hide resolved
setup_guides/sdf/setup_sdf.rst Outdated Show resolved Hide resolved
Setting Up Odometry
###################
Setting Up Odometry - Gazebo Classic
####################################

In this guide, we will be looking at how to integrate our robot's odometry system with Nav2.
Copy link
Member

Choose a reason for hiding this comment

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

In this paragraph the following should be removed

Afterwards, we will discuss how various sources of odometry can be fused to provide a smoothed odometry using the robot_localization package. Lastly, we will also show how to publish the odom => base_link transform using robot_localization.


.. code-block:: xml
<link name="front_caster">
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be in the URDF section not the odometry section? I believe this is already done in this section

Copy link
Author

Choose a reason for hiding this comment

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

The part where I set the <mu> tags hasn't been done in that section. Also, the reason I am including this here is that I think something related to this changed from Gazebo Classic to Modern Gazebo as it isn't present in the older tutorials and I think that various SDF related changes have also happened.
Will move it to setup_urdf and setup_sdf if this is not the case.


.. code-block:: xml
<gazebo reference="front_caster">
Copy link
Member

Choose a reason for hiding this comment

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

I think we should move this after the differential drive plugin is added -- I think that'll be more linear


.. code-block:: xml
<plugin filename="gz-sim-diff-drive-system" name="gz::sim::systems::DiffDrive">
Copy link
Member

Choose a reason for hiding this comment

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

Same comment on the SDF vs URDF

ros_gz_bridge,
spawn_entity,
Finally, create a file named ``bridge_config.yaml`` in the ``config`` directory of your package and add the following line to it to define what topics we want to bridge between ROS and Gazebo:
Copy link
Member

Choose a reason for hiding this comment

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

I think we should have a subsection after the Adding Gazebo Plugins to a URDF/SDF section called Creating Gazebo Bridge which does this (and adds a little explanation about the bridge). For example:

  • There is a bridge 😆
  • It translates GZ topics to ROS topics
  • We have to launch the bridge with a configuration about what topics to translate and what their ROS types are

So I think this should be moved before Launch and Build Files so this file is setup and ready by the time they go to actually modifying launch files. I think that's important because having the filepath to this config file is part of the launch modifications

)
ros_gz_bridge = RosGzBridge(
bridge_name='ros_gz_bridge',
config_file=bridge_config_path,
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this path is defined yet in the instructions

@Amronos
Copy link
Author

Amronos commented Jan 8, 2025

About the SDF and URDF things:
What I am trying to do here is to allow the readers to use either the URDF or SDF, whichever they are more comfortable with using / like more as it is possible to not use both the description formats and just use one instead. :-)
Of course if they want they could do what has been done in the nav2_min_tb3_sim package, instead of using a single description format.

@SteveMacenski
Copy link
Member

Ah I see, I think we should have the instructions be best practices: URDF for robot description, SDF for simulation, and we help them setup both. I don't think its wise to give folks too many options in first time setup (since they're new to all this and can't make a knowledgeable trade off yet), so I think its best to go with the best practices only.

Amronos and others added 4 commits January 8, 2025 18:20
Co-authored-by: Steve Macenski <[email protected]>
Signed-off-by: Aarav Gupta <[email protected]>
Signed-off-by: Aarav Gupta <[email protected]>
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.

Update sam_bot + first time setup guide for Modern Gazebo
2 participants