Gazebo 7 simulation setup

I have been trying to install and run the Gazebo simulation for the BlueROV2 model. My system is a Windows 11 laptop with Ubuntu 22.04.3 (Jammy) and Gazebo 7 - which was installed from the binary installation here: Gazebo. After running the install again I can run the 4 shape demo using: gz sim shapes.sdf and it opens perfectly fine. Next step was to install the freebouyancy_gazebo plugin from: freebuoyancy_gazebo/README.md at master · bluerobotics/freebuoyancy_gazebo · GitHub. When I run the install lines I am getting an error:


What causes this and how can I resolve it? Any help or links to other threads that resolve this is greatly appreciated.

The freebuoyancy_gazebo project works with Gazebo Classic, and AFAICT it is not maintained.

The good news is that Gazebo Garden has a built-in plugin for buoyancy, so you do not need it.

This project is a good starting point for getting a BlueROV2 model in Gazebo Garden: GitHub - clydemcqueen/bluerov2_ignition: BlueROV2 model for Gazebo Garden

Thanks for the reply Clyde! I was able to get your model working with Gazebo Garden - I had someone explain to me the difference between gazebo classic and ignition. My problem was that I didn’t have the colcon packages installed to build properly.

For anyone just starting with a project and not sure about the workspace environment on your device this may help. If you want to use the Gazebo Garden you should follow the source install instructions here: Gazebo. Be sure to double check any of the export commands that they are for your device file system. The basic file system should look like home/colcon_ws/src/bluerov2_ignition and if you git cloned the ardupilot_gazebo repo onto your home location home/ardupilot_gazebo - check the export commands in Clyde’s github above may clear things up.

1 Like

After getting everything setup and working I’m now sending some commands to the sim using python. I’ve found arming and sending a GPS position in GUIDED mode works well, but sending a second GPS location to travel to after the first doesn’t and the system will continue on the trajectory of the first. I am using MAVLink_set_position_target_global_int_message to send the position for the drone to travel to. When using this type of message do I need to disarm/rearm the drone when it reaches the location in order to send a new location?

Arm / disarm should not be required. You should be able to send SET_POSITION_TARGET_GLOBAL_INT message repeatedly, and the latest target will override the previous target.

There are a lot of error checks, take a look at the code to see if you are getting the various bits set correctly: ardupilot/ArduSub/GCS_Mavlink.cpp at ffec56cd0ecabc264f270a6279770337f06e6be8 · ArduPilot/ardupilot · GitHub

Thanks that’s how I expected SET_POSITION_TARGET_GLOBAL_INT to operate. I can see that the autopilot knows where the next target location is in the SITL map as the marker moves. But the autopilot will continue in the same direction as the first waypoint. I have also noticed the autopilot resetting a bunch in the Gazebo Ubuntu window - could this be caused by my PC not being strong enough to run everything all at once?

On another note I am fiddling around with adjusting the yaw when sending GPS positions using SET_POSITION_TARGET_GLOBAL_INT. Is this possible? I have adjusted the typemask to 0b100111111000 to not ignore the yaw input and computed the direction of travel from N=0deg. When sending a position the yaw doesnt change using this approach. There’s MAV_CMD_CONDITION_YAW that I could use but it would be nice to send only a single message.

Possibly. I assume that you are using the ardupilot_gazebo plugin. If so, you can slow down the simulation and ardupilot will run in lock-step. If it performs better at slower speeds then it is probably an artifact of the simulation. You might also try running gazebo without the client (GUI), this tends to use a lot of GPU + CPU.