# Ping360 ROS Python Driver

**URL:** <https://discuss.bluerobotics.com/t/ping360-ros-python-driver/13725>\
**Category:** Ping Sonar Devices\
**Tags:** ping, sonar\
**Created:** [February 21, 2023, 3:41pm UTC](https://discuss.bluerobotics.com/t/ping360-ros-python-driver/13725 "2023-02-21T15:41:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SirJansen](https://avatars.discourse-cdn.com/v4/letter/s/f08c70/32.png) [@SirJansen](https://discuss.bluerobotics.com/u/SirJansen)\
**Post date:** [February 21, 2023, 3:41pm UTC](https://discuss.bluerobotics.com/t/ping360-ros-python-driver/13725/1 "2023-02-21T15:41:02Z")

</div>

Hello,

I am a university student currently working on developing an AUV. I have been building a Python-based driver to get our Ping360 Sonar data onto our ROS network, specifically inside a sensor\_msgs/LaserScan message type for later use with SLAM. Currently, I have implemented a manual scan with the “control\_transducer” function and am manually stepping through a specified range of gradians. I had a few questions that don’t seem to be addressed anywhere in the documentation for either the Ping360 or the python driver GitHub repository and was hoping to either get pointed in the right direction or get some insight provided.

1. If we wanted to control the range of the scan, what combination of settings would we need to change? I assume the settings in question are sample period and transmit duration, I’m unsure if there are any more. More specifically if we are given a range of 12m for example. What would mathematical equations need to be performed, and what constants would we need to provide to get the correct settings?

2. Does the number of samples contribute anything to the range or is that simply for better resolution for the scan data?

3. The return data field states that “An array of return strength measurements taken at regular intervals across the scan region”. Is calculating the interval as simple as dividing the previously mentioned by the length of the array of the returned data or is there more to it than that?

I will greatly appreciate any and all information that may be provided.

---

<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:** [February 22, 2023, 6:03am UTC](https://discuss.bluerobotics.com/t/ping360-ros-python-driver/13725/2 "2023-02-22T06:03:03Z")

</div>

Hi @SirJansen, welcome to the forum 🙂

I’d recommend reading the following threads, then following up if you have further questions:

- [Ping Sonar range setting and the angle definition - #2 by EliotBR](https://discuss.bluerobotics.com/t/ping-sonar-range-setting-and-the-angle-definition/11686/2)
- [Changing the Ping360 scan distance](https://discuss.bluerobotics.com/t/changing-the-ping360-scan-distance/11762)

---

<div class="post-metadata">

**Author:** ![SirJansen](https://avatars.discourse-cdn.com/v4/letter/s/f08c70/32.png) [@SirJansen](https://discuss.bluerobotics.com/u/SirJansen)\
**Post date:** [February 24, 2023, 3:19am UTC](https://discuss.bluerobotics.com/t/ping360-ros-python-driver/13725/3 "2023-02-24T03:19:15Z")

</div>

Thank you very much @EliotBR. Those links were very insightful and I have the program working correctly now. While I was doing some searching related to this I read somewhere that the transmit frequency should also be attenuated based on a few other parameters for clarity. I was wondering what you’d recommend for this aspect.

---

<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:** [February 24, 2023, 4:06am UTC](https://discuss.bluerobotics.com/t/ping360-ros-python-driver/13725/4 "2023-02-24T04:06:51Z")

</div>

> [@SirJansen](#):
>
> Those links were very insightful and I have the program working correctly now.

Glad to hear it! 🙂

> [@SirJansen](#):
>
> … I read somewhere that the transmit frequency should also be attenuated based on a few other parameters for clarity. I was wondering what you’d recommend for this aspect.

Can you provide a link to where you read that? I’m not sure of the context.

If it’s relevant, [the Ping Viewer docs description](http://docs.bluerobotics.com/ping-viewer/device-settings-ping360/) may be helpful:

> [@Ping Viewer - Ping360 Device Settings](#):
>
> - **Transmit Frequency:** Changes the frequency of the emitted pulse. [Lower frequencies are less absorbed by water](http://resource.npl.co.uk/acoustics/techguides/seaabsorption/physics.html), but the Ping360 transducer is tuned to 750kHz and less sensitive to other frequencies. Practically recommended to stay within 650-850kHz. Can make minor changes to account for the doppler effect if consistently moving quickly (e.g. if moving at 1.5m/s (BlueROV2 max forward speed) reduce by 1-3kHz to optimise receiver sensitivity to objects being approached). May be useful for reducing interference to other nearby sensors with a similar acoustic range sensitivity.

Alternatively, if you actually meant the `transmit_duration`,

> [@Changing the Ping360 scan distance](https://discuss.bluerobotics.com/t/changing-the-ping360-scan-distance/11762/4):
>
> The Ping Viewer implementation … covers the actual [`set_range`](https://github.com/bluerobotics/ping-viewer/blob/master/src/sensor/ping360.h#L176-L203) functionality, which calculates the sample period ([`calculateSamplePeriod`](https://github.com/bluerobotics/ping-viewer/blob/master/src/sensor/ping360.cpp#L613-L629)) from the currently specified sound speed and number of samples, and **updates the transmit duration ([`adjustTransmitDuration`](https://github.com/bluerobotics/ping-viewer/blob/master/src/sensor/ping360.h#L438-L465)) to stay within reasonable limits for the sensor.**
