Troubleshooting
My vehicle sinks
Nothing floats it, or the floating volume has nothing to measure. Check in this order:
Is a collision marked? The world floats only collisions marked
gz:buoyancy="true"(Mark what displaces). Look at the model file Gazebo actually loaded, not the xacro: the mark must survive expansion, and the root element must declarexmlns:gz="http://gazebosim.org/schema". In a URDF the mark only survives inside a model-level<gazebo>block; on a URDF<collision>or in<gazebo reference="...">the conversion drops it (Marking from a URDF).Can buoyancy measure the shape? Box, sphere, cylinder, capsule, ellipsoid or cone. A mesh has no volume to it, and you get a warning.
Is it too heavy? If the draft is deeper than the hulls are tall, it sinks (Work out the draft).
Does the world run gz-maritime’s buoyancy? Until a Gazebo release ships the marked-collision change, stock
gz-sim-buoyancy-systemignores the marks, and with<enable_by_default>false</enable_by_default>it floats nothing.
My vehicle bumps into things it shouldn’t, or sits on the water oddly
A marked collision is still a collision to the physics engine. Give every
mark <surface><contact><collide_bitmask>0x00</collide_bitmask></contact></surface>
so the displacement volume touches nothing, and let the URDF’s shapes do the
bumping.
“Unsupported collision geometry for graded buoyancy”
A marked collision, or an enabled link’s collision, has a shape buoyancy can’t slice, usually a mesh. Use boxes, spheres, cylinders, capsules, ellipsoids or cones for the floating volume, and keep the mesh as contact geometry.
The vehicle capsizes
The centre of mass is too high for the hull’s width. Lower it, or widen the stance.
The marked shapes don’t match the hull. Buoyancy only knows the marked shapes; if they’re off-centre, so is the lift.
Roll and pitch aren’t damped. Without
kPandmQin the Hydrodynamics plugin, the vehicle rocks and can tip over.
The boat moves sideways, or spins, instead of going forward
The commands arrived one after the other. They latch, so the first propeller pushes alone for a moment. Start both commands together.
Sideways motion isn’t damped enough.
yVandyVabsVshould be much larger thanxUandxUabsU.Both propellers turn the same way. Counter-rotating propellers need opposite signs of
thrust_coefficient.
The boat barely moves, or a bigger command changes nothing
Propeller commands are a fraction of full thrust, in [-1, 1]: 1.0 is
already full ahead, and the thruster clips anything beyond it. A value that
would have been a modest force in newtons, such as 5.0, is full thrust
here. The limits themselves are <max_thrust_cmd> and <min_thrust_cmd>
in the model (Thrusters).
The spawn launch stops with “invalid instance name”
A name is a Gazebo model name, a topic prefix, a ROS namespace and a TF
prefix at once, so it is held to the strictest of those: letters, digits
and underscores, starting with a letter. boat-b and 2nd_boat are out;
boat_b is fine.
The spawn launch returns straight away
That is expected. With composition on, its bridge and state publisher load
into the simulation’s container and the launch has nothing left to run.
ros2 node list shows /<name>/ros_gz_bridge and
/<name>/robot_state_publisher, and they go down with the simulation.
Two boats answer the same command, or RViz shows a jumping robot
Both instances share a name somewhere. Every instance needs its own name,
which must reach the model’s topics and frame ids, the ROS namespace and
robot_state_publisher’s frame_prefix
(One name per instance). If you
spawned the installed default model twice by hand, spawn each boat through
spawn_vehicle.launch.xml name:= instead, which renders the model for its
name.
A plugin can’t find a link
Gazebo merges links attached by fixed joints into their parent when it reads
a URDF, so those links no longer exist, only frames with their names.
Reference a link that survives, or place things relative_to the frame. See
what survives with gz sdf -p
(What survives the conversion).
The server stops with “ODE INTERNAL ERROR … aabbBound”
A box-shaped hull floating almost exactly level made the buoyancy
calculation return a wildly wrong result, which blew the simulation up. This
is a gz-math bug, fixed upstream in
gazebosim/gz-math#847, and
gz-maritime’s buoyancy system already works around it. If you see it, check
that your world loads gz-maritime-buoyancy-system and not
gz-sim-buoyancy-system.
The boat falls very slowly when spawned high
The Hydrodynamics plugin doesn’t know where the water is, and damps motion in
the air too. Spawn at the waterline (z:=0 when base_link is on the
waterline).
RViz shows nothing, or “Fixed Frame does not exist”
In a simulation every frame carries the instance name: the fixed frame is
custom_usv/base_link, not base_link, the description is on
/custom_usv/robot_description, and the RobotModel display only finds
the links if its TF Prefix property is the instance name; without it
the display reports “No transform from [base_link] to [custom_usv/base_link]”
and draws nothing. ros2 launch kai_custom_vehicle rviz.launch.xml name:=<name>
starts RViz on a config with all three set
(Look at it in RViz).
For your own vehicle, set the same three things in your RViz config.
display.launch.xml, which runs without Gazebo, uses no prefix.
robot_state_publisher warns about the root link inertia
The root link base_link has an inertia specified in the URDF, but KDL does not
support a root link with an inertia.
Harmless: KDL only computes TF and ignores inertia, while Gazebo reads it.
Don’t add a dummy root link to silence it. Gazebo would merge base_link into
the dummy, and every plugin that refers to base_link would break.
The ocean looks flat or white in the GUI
Check the GUI output for wave errors. The GUI needs the wave engine’s GUI plugin, which the
water_surfacemodel loads at its<visual>; a world that includes the model gets it.On a machine with several network interfaces (Wi-Fi, Docker, VPN), the server and the GUI can pick different ones and miss part of each other’s data. Try
export GZ_IP=127.0.0.1in both terminals.
Camera images look green or blue
open_water.sdf’s ambient light is cyan. See the note in
Add sensors.
Two simulations interfere with each other
Give each simulation its own GZ_PARTITION, and each ROS graph its own
ROS_DOMAIN_ID.
The underwater image is the same as the plain one
The camera is above the water: at or above the surface only the camera’s own exposure, white balance and noise apply, none by default.
The world has no water optics: add
gz-maritime-water-optics-system(See through the water); without it the water is clear.
The underwater image is all one colour
That is the veil: everything farther than the water’s visibility fades into
it. In coastal water (3C) a black target is gone at about 4 m. Choose a
clearer type, or a larger <visibility>.
The underwater image gets black at depth
The daylight fades with depth, red first: in coastal water there is little
left at 20 m. That is the water, not a bug. Give the vehicle lamps (spot
lights) and include the underwater_optics model
(Lights at depth), or use
<exposure>auto</exposure> to brighten what light there is.
The GUI and the underwater camera differ
The underwater camera plugin works on its own image; the GUI only sees
through the water with the underwater_optics model in the world
(See through the water).
With the model, they agree on every surface and on open water, where both
show the veil. Looking up at the surface, the GUI draws Snell’s window,
faded by the water, where the camera plugin shows the sky the renderer drew
through the water up to the surface.