How can the freshwater pressure reported by the Bar30 pressure sensor through ArduSub be calibrated using pymavlink.
I am able to calibrate using QGroundControl but would like to do so through code instead.
Hi @nkh -
The autopilot parameter BARO_SPEC_DENSITY needs to be set to fresh or saltwater - that is the only calibration of the pressure sensor necessary! The default is freshwater.
On startup, the vehicle assumes it is out of the water, and takes the ambient pressure to represent 0 depth - this calibration process happens every startup, automatically. Nothing else is required (or possible) to calibrate depth!
You are probably calibrating the other motion sensors via QGround Control - the compass, accelerometer? The Gyro is possible to calibrate in BlueOS vehicle setup.
Can you share more details on your goals of calibrating via code?
Hi @nkh,
You can send a PREFLIGHT_CALIBRATION
MAVLink command with param3 (ground/surface pressure) set to True (1), to set the current pressure as the relative zero point (pressure offset).
As @tony-white mentioned that happens automatically on startup, and it’s also possible to configure the scale factor by setting the BARO_SPEC_GRAV
parameter.
You can also refer to the code we use in BlueOS, if that’s of interest