# Are there a way to access Bar30 'depth' data with pymavlink?

**URL:** <https://discuss.bluerobotics.com/t/are-there-a-way-to-access-bar30-depth-data-with-pymavlink/11394>\
**Category:** Sensors\
**Tags:** pymavlink\
**Created:** [January 21, 2022, 12:59pm UTC](https://discuss.bluerobotics.com/t/are-there-a-way-to-access-bar30-depth-data-with-pymavlink/11394 "2022-01-21T12:59:46Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![toosat](https://avatars.discourse-cdn.com/v4/letter/t/a4c791/32.png) [@toosat](https://discuss.bluerobotics.com/u/toosat)\
**Post date:** [January 21, 2022, 12:59pm UTC](https://discuss.bluerobotics.com/t/are-there-a-way-to-access-bar30-depth-data-with-pymavlink/11394/1 "2022-01-21T12:59:46Z")

</div>

Hello dear forumers,  
We are currently working on an AUV system. And we have the Bar30 depth sensor. We are using the Pixhawk 2.4.8’s I2C port to access to the Bar30 depth sensor. And we want to access the depth value ,which is coming from the depth sensor, through mavlink messages.

First:  
I tried the [SCALED\_PRESSURE2](https://mavlink.io/en/messages/common.html#SCALED_PRESSURE2) message, but i couldn’t see anything such labelled as `'depth'` in there. There is only `'press_abs'` value looked like it might be helpful to get depth value through it, i am guessing that it might require to make some calculations to get the actual depth value from it however i couldn’t find what calculations i do need.

Second:  
I tried the [GLOBAL\_POSITION\_INT](https://mavlink.io/en/messages/common.html#GLOBAL_POSITION_INT) message, and again i couldn’t see anything such labelled as`'depth'` in there. I thought `'hdg'` value might be helpful to calculate `h` from the `P=hdg` formula. But as much as i know [GLOBAL\_POSITION\_INT](https://mavlink.io/en/messages/common.html#GLOBAL_POSITION_INT) message using the internal sensors of Pixhawk2.4.8, not the Bar30 sensor connected from I2C port. So it seemed me useless to implement. Because i want the Bar30 datas, not the Pixhawk’s internal sensor datas.

Third:  
I tried the [VFR\_HUD](https://mavlink.io/en/messages/common.html#VFR_HUD) message. I am currently using [VFR\_HUD](https://mavlink.io/en/messages/common.html#VFR_HUD) message to access to the `'heading'` value of Pixhawk. As i read on the net, a guy says that the message is including `'depth'` data, but again i couldn’t see anything such labelled as`'depth'` in there. And i also think that [VFR\_HUD](https://mavlink.io/en/messages/common.html#VFR_HUD) message using the internal sensors of Pixhawk2.4.8

Last but not least:  
I found some python examples for Bar30 ([ms5837-python](https://github.com/bluerobotics/ms5837-python)) i tried to install the library to my Ubuntu system but i failed to install it through terminal, so i also couldn’t get any results from there.

Thanks for your time to reading this, any help will be appreciated.

---

<div class="post-metadata">

**Author:** ![EliotBR](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/eliotbr/32/6937_2.png) [@EliotBR](https://discuss.bluerobotics.com/u/EliotBR)\
**Post date:** [January 22, 2022, 2:00am UTC](https://discuss.bluerobotics.com/t/are-there-a-way-to-access-bar30-depth-data-with-pymavlink/11394/2 "2022-01-22T02:00:18Z")

</div>

Hi @toosat,

If you’re using ArduSub, `VFR_HUD.alt` (altitude) should be what you’re after 🙂

---

<div class="post-metadata">

**Author:** ![toosat](https://avatars.discourse-cdn.com/v4/letter/t/a4c791/32.png) [@toosat](https://discuss.bluerobotics.com/u/toosat)\
**Post date:** [January 23, 2022, 3:34pm UTC](https://discuss.bluerobotics.com/t/are-there-a-way-to-access-bar30-depth-data-with-pymavlink/11394/3 "2022-01-23T15:34:50Z")

</div>

Hey @EliotBR ,  
Thanks for the response. We observed that when we plug in our Bar30 sensor to Pixhawk, the source of `'alt'` value at [VFR\_HUD](https://mavlink.io/en/messages/common.html#VFR_HUD) message switching from Pixhawk’s internal sensors to Bar30 sensor. And we succeeded to get values through [VFR\_HUD](https://mavlink.io/en/messages/common.html#VFR_HUD) message, thanks for the help 🙂

---

<div class="post-metadata">

**Author:** ![leaf](https://avatars.discourse-cdn.com/v4/letter/l/ec9cab/32.png) [@leaf](https://discuss.bluerobotics.com/u/leaf)\
**Post date:** [April 20, 2022, 7:02am UTC](https://discuss.bluerobotics.com/t/are-there-a-way-to-access-bar30-depth-data-with-pymavlink/11394/4 "2022-04-20T07:02:21Z")

</div>

Hi, I get depth data -85 with VFR\_HUD.alt, but what is the unit of this data? Thank you.

---

<div class="post-metadata">

**Author:** ![EliotBR](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/eliotbr/32/6937_2.png) [@EliotBR](https://discuss.bluerobotics.com/u/EliotBR)\
**Post date:** [April 20, 2022, 7:18am UTC](https://discuss.bluerobotics.com/t/are-there-a-way-to-access-bar30-depth-data-with-pymavlink/11394/5 "2022-04-20T07:18:49Z")

</div>

> [@leaf](#):
>
> I get depth data -85 with VFR\_HUD.alt, but what is the unit of this data?

It’s in meters (m), as specified in the links to the MAVLink specification in @toosat’s comments 🙂

---

<div class="post-metadata">

**Author:** ![leaf](https://avatars.discourse-cdn.com/v4/letter/l/ec9cab/32.png) [@leaf](https://discuss.bluerobotics.com/u/leaf)\
**Post date:** [April 20, 2022, 7:24am UTC](https://discuss.bluerobotics.com/t/are-there-a-way-to-access-bar30-depth-data-with-pymavlink/11394/6 "2022-04-20T07:24:33Z")

</div>

And I get “RAW\_IMU” data from Pixhawk2.4.7， I looked up the type and range of accelerometer and gyroscope in Pixhawk2.4.7. It seems that they use a range of 16g ofLSM303D accelermeter AND a range of gyroscope 2000DPS, but I am not sure what is the unit of the RAW\_IMU.xacc, do I need to divide raw data by precision to get real accelerate?

---

<div class="post-metadata">

**Author:** ![leaf](https://avatars.discourse-cdn.com/v4/letter/l/ec9cab/32.png) [@leaf](https://discuss.bluerobotics.com/u/leaf)\
**Post date:** [April 20, 2022, 7:27am UTC](https://discuss.bluerobotics.com/t/are-there-a-way-to-access-bar30-depth-data-with-pymavlink/11394/7 "2022-04-20T07:27:10Z")

</div>

Thank you, get it.

---

<div class="post-metadata">

**Author:** ![EliotBR](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/eliotbr/32/6937_2.png) [@EliotBR](https://discuss.bluerobotics.com/u/EliotBR)\
**Post date:** [April 20, 2022, 7:33am UTC](https://discuss.bluerobotics.com/t/are-there-a-way-to-access-bar30-depth-data-with-pymavlink/11394/8 "2022-04-20T07:33:58Z")

</div>

Use one of the [`SCALED_IMU`](https://mavlink.io/en/messages/common.html#SCALED_IMU) options instead. I believe ArduSub uses `SCALED_IMU2` by default.

---

<div class="post-metadata">

**Author:** ![leaf](https://avatars.discourse-cdn.com/v4/letter/l/ec9cab/32.png) [@leaf](https://discuss.bluerobotics.com/u/leaf)\
**Post date:** [April 20, 2022, 8:12am UTC](https://discuss.bluerobotics.com/t/are-there-a-way-to-access-bar30-depth-data-with-pymavlink/11394/9 "2022-04-20T08:12:33Z")

</div>

Thanks a lot, I used SCALED\_IMU2 to get data，the obtained value is about the same size as RAW\_IMU, but now I know the acceleration unit is mG.
