I am working on a simulation of an unmanned surface vehicle. I’m using Ubuntu 22.04, ROS2 Humble, the head of the PX4 repository, and gz sim from gz garden (formerly ignition). I am pretty new to this architecture and I’ve mainly been tweaking the examples included from PX4.
I’ve tested my model sdf file independently in gz sim and I can confirm the buoyancy and wind plugins are working as intended. My problem occurs when trying to make the px4_sitl target. I’ve hijacked the x500 example and changed all of the relevant model.sdf, world.sdf, config, and cmake files from the drone and replaced with my files.
My world file uses the gz::sim::systems::Buoyancy plugin to apply graded buoyancy to my model, which works when I include the model inside of the world file with gz sim. Since PX4 is loading the world and model files separately, it seems the world can’t see the links of the model to apply buoyancy forces to it. In the documentation I’ve seen some world-dependent models such as the boat and the uuv_hippocampus, but none of those worlds ever need to see the specific models or links as plugin arguments. Does anyone know a convenient way around this? Like I said I’m fairly new and hopefully I’m missing an easier way to do this. I can post output if needed.
The x500 drone works correctly with the default world after the migration. I edited the x500 model file to include my custom model and I created a custom world file that includes the buoyancy plugin which takes the model as an argument. I followed the instructions there providing the respective arguments to PX4_GZ_MODEL and PX4_GZ_WORLD.
Still no luck getting buoyancy forces applied to the model with this method, I’ve only been able to get buoyancy working when the model is added to the world file with an statement in the sdf file and passing it as an argument to the buoyancy plugin that way.
I was able to get this working without including the model in the world file. When the model is loaded into the simulator the name is changed from “x500” to “x500_0”. Keeping the “name=‘x500’” tag in the model file and then passing “x500_0” as an argument to the plugins instead produces the desired forces.