I am using the Bar30 sensor on the Navigator Controller. QGroundControl and BlueOS’s cockpit are able to show the depth readings.
However, MAVROS does not publish the depth in metres anywhere. I could not get it to publish SCALED_PRESSURE2 either.
I am using PyMavLink to get the SCALED_PRESSURE2 values. However, I am not able to figure out the formula to convert that hPa value to depth in metres. Could someone help?
Hi, I have been working with MAVROS and have obtained many MAVROS topics. I am trying to determine which one corresponds to the Bar30 sensor. Would /mavros/vfr_hud
be the correct topic, or is there another one I should check? Thank you!
It is supposed to be the correct one. However, the altitude value is always 0.0
.
Hi @jalansubham, welcome to the forum
Is the AHRS2
message available? Cockpit and QGC use AHRS2.altitude
, as the filtered output from the autopilot’s internal state.
I’m not familiar with MAVROS, but if the same message is available with Pymavlink then presumably this is a MAVROS issue rather than an autopilot issue.
Converting from a pressure measurement to a distance (e.g. relative altitude/depth) requires knowing (or estimating)
- the density of the fluid creating the pressure
- the atmospheric pressure at the surface, to use as an offset
- the static conversion factor for the units being used
The altitude calculation in ArduSub is done using:
where _specific_gravity
is determined by the BARO_SPEC_GRAV
parameter (as a proxy for the density of the water being operated in), and the ground_pressure
is set when the barometer is calibrated at the surface, and stored in the BARO2_GND_PRESS
parameter.[1]
I’m not sure why VFR_HUD
isn’t returning correct values - that’s likely a bug in the firmware.
There is a subsequent correction that can be applied by specifying
BARO_ALT_OFFSET
values, but that is rarely used. ↩︎
The alt in the VFR_HUD message in the machine is not the correct depth information. The depth information is in NAV_CONTROLLER_OUTPUT, but there is no. The alt_error field information in NAV_CONTROLLER_OUTPUT is also displayed in QGC, but the ALT_HUD mode can run normally and maintain depth . Why is this? Any impact?
Hi @chang-M,
I’ve moved your post here because it seems to be about the same topic. I’d recommend reading the responses above.
Could you describe more about which ArduSub and QGroundControl versions you’re using, and which sensors you have connected to your system? It may be that some other positioning sensor / barometer / rangefinder value is being used for the altitude estimate, and/or there could be a bug in how VFR_HUD
is being populated.
Have you tried perturbing (e.g. pushing, or changing the buoyancy of) the vehicle to verify this? If you’re in relatively still water and have a neutrally buoyant vehicle then maintaining depth just involves not doing anything, which could be mistaken for working correctly.
Yes, when I perturb the rov up and down, it will remain at the current depth, and when I perturbate, its orientation will remain the same.