Noob trying To learn how To do a gazebo Car sim

Hi everyone,

I’m new to Gazebo and currently using ROS2 Humble. I already have a car modelled in URDF, and I’d like to learn how to set up a simulation with it in Gazebo.

My goal is to place the car in a Gazebo world where the track is based on a PNG image I have. I’d appreciate any guidance on how to load this PNG as the environment or terrain in the simulation, and how to correctly position my car within it.

Additionally, I have some control algorithms already implemented, and I’d like to know how I can integrate them with the simulation to start testing and controlling the car within this setup.

Any help or pointers would be greatly appreciated!

Thanks in advance!

Hello @Duarte_Antonio_Diama

Check the launch examples within this repository. It includes the procedure to launch a URDF or xacro file.

ros2_control is a library to implement controls for robotics. In addition, it includes a lot of off-the-shelf. Check if your algorithm has already been made in its documentation.

If you want to describe your robot properties in more detail (like friction and damping), I would suggest using SDF directly instead of URDF.

Regarding the simulation world, it must be declared in a SDF file. I would suggest using an example world and modifying the elements inside to include yours. Here you have the documentation of the geometry part of a model, which has elements image and heightmap. I personally haven’t tried them, but they should transform your flat image into a 3D model. The trickiest aspect is URI referencing IMHO. Beyond that, it should be easy to create a model of your environment.

If I got it wrong and you need a planar world but with the PNG file printed on top, my usual go-to is creating a rectangle in a CAD software, adding the image on top and exporting it as an OBJ file. Then I add it to the SDF file as a mesh.

Do you have previous experience with URDF, gazebo classic or ros2 launch files?