Home        Store        Learn        Blog

How to display Ping1D data from USV using PingViewer on Ground Station

Good morning,

I purchased the Ping1D to mount on a boogie board a few months ago to do some basic freshwater mapping with a USV for my senior capstone. I’m using an RPi and Navio2 with Sik 915MHz telemetry radios and have collected 30,000+ data points that I’ve gridded up using Matlab. These surveys were done using the default parameters from Blue Robotics, and without any post-processing. I can run the board on either MP or QGC, but would like to be able to run PingViewer on my laptop at the same time to see the data coming in in wave form, as well as adjust the gains, and sound speed. I’ve been digging around in the forums for a few weeks trying to wrap my head around things since I’m still new to configuring/troubleshooting robotics, but I was wondering if someone could steer me in the right direction to be able to adjust these parameters and model the data on the fly for a USV. Any tips or tricks would be greatly appreciated and I’d be happy to share the results of this project once I get a little more functionality out of it.

Thank you for your interest,
-Jake

Hi @Slarskey,

You’ll need to add a second radio or connect via wifi/4g with your vessel to create a communication link with your vehicle and ping-viewer.
Since you’re using a single radio that’s using mavlink to do the communication, is not possible to use the same radio to transmit both mavlink and ping-protocol at the same time.

2 Likes

Thank you for your help Patrick. I am now unable to connect the sonar to Mission Planner and QGC. Here is what I have configured on the RPi and in mission planner. I’ve looked through old forum posts about how to connect it which worked while I collected my initial dataset, but now it is not registering. Is there something that I am overlooking in the configuration?

Best,
-Jake

Update: Ping1D is now working again, it was an issue with Mission Planner not wanting to reboot after I wrote the parameters. Now I believe all I need to do is configure the udp network for data transfer in order to connect to the RPi to PingViewer and model the data.

Another update-

I’ve installed the bluerobotics-ping python packages on the RPi in order to connect to the device via UDP. I’ve been looking at the device manager guide on the bluerobotics website and my understanding of it is that I need to configure it to know which port to look for the device on in the python module. When I enter python -m brping/pingproxy --device /dev/ttyAMA0 in the command line, which is the final line of the device manager guide, I get an error message saying that there is no module named brping/pingproxy. I double check that these packages I just downloaded do exist by entering: ./.local/lib/python3.7/site-packages (both 0.1.0 and 3.4) and /usr/lib/python3/dist-packages (0.16.0), I get a message saying that there is a directory.

My question is, what am I missing in the configuration process in order to specify where Ping1D can request data to be passed over the UDP connection, allowing me to connect to PingViewer and and see the data coming in?

My apologies for crowding the forum with novice questions, I’m still learning how to get things to talk to each other.
Best,
-Jake

You have installed the library under python3 and you are probably calling python2, try:
python3 -m brping/pingproxy --device /dev/ttyAMA0

If you want to communicate with the sensor via UDP, you can use the port 9090, the sensor when connected while running the companion image, will be provided automatically under this port.

Hi Patrick,

When I call python it does run python3. The issue is that when I did pip install, it did not install pingproxy. So when I try and connect over UDP with the port 9090, it does not connect. Is the companion image something I can download right from github on the raspberry pi? I poked around there and did not see it.

By companion image, do you mean the Raspbian Image? I’m looking around now to see if I can install ping proxy as well.

Hi Jacob,

You can download our latest software version here:

If you installed bluerobotics-ping via pip, you should call pingproxy.py without problems, if you have installed it via your normal user, it should be under /home/user/.local/bin/pingproxy.py, or if you have installed with root, should be in /usr/local/bin/pingproxy.py, in both cases should be accessible without problems if your system is correct configured.

I have found pingproxy.py under ‘/home/user/.local/bin/pingproxy.py’, but when I run
‘python -m brping/pingproxy --device /dev/ttyAMA0’ or ‘python -m pingproxy --device /dev/ttyAMA0’ it says that module pingproxy not found. How should I configure it to look for the right module?

you should just call pingproxy.py --device /dev/ttyAMA0

I appended ‘/home/user/.local/bin/’ and ‘/home/user/.local/lib/’ to the python $PATH, and this is the error that it gave me.

Sorry if I was not clear.
What you need to do is to login in your raspberry via ssh, access the terminal, and type:
pingproxy.py --device /dev/ttyAMA0

There is no need to open the python console or do anything else, pingproxy.py is a script that is accessible in your path, if your system path is correct. It’s not a module, it’s executable script provided by our bluerobotics-ping package.

Here is my version with Ping 1D. Works really well, especially in among weeds. No prop or thruster fouling!

2 Likes

My apologies for opening up the same thread again, but here is the update:

I can now view the data in PingViewer. The issue was with the github packages not downloading properly. Reinstalling and specifying the correct location has made a world of difference!

PingViewer is crashing quite a bit, and I’ve included the error message that it throws. I haven’t been able to figure out what it is yet, but it seems to be pretty random and my best guess is that it is because the WiFi router on the Pi is pretty weak, and when an object gets in the way it loses communication. Also, I have to disable the sonar in Mission Planner in order to use PingViewer, otherwise PingViewer cannot receive the data over the UDP link. I believe is probably something that can be can be worked around with a ROS script, but that is not my main priority at the moment.

I want to be able to use it in salt water and use Ping Viewer to adjust the sound setting accordingly, then download the sensor log data and combine it with the Mission Planner gps data based off the timestamp of each data point. When I try and load the sensor log in Notepad and/or Excel, it just gives me a bunch of gibberish characters that mean nothing to me. Is this because it is the raw ping protocol data? Can anyone tell me how to view the data in Excel? Weather looks good tomorrow (11/6) and I am bringing it to the ocean to do some testing, and would appreciate it if anyone can offer their input on this.

I think it is super cool that Blue Robotics has products that when integrated correctly, the average person can build something to go do seafloor mapping without spending a whole lot of money on it. Great learning tool!!
image|690x140

Good to hear!

Best to put error messages in a text format so they can be viewed more easily on mobile devices and by screen readers, and be more easily copied and googled.

pi@navio:~ $ .local/bin/pingproxy.py --device /dev/ttyAMA0
Traceback (most recent call last):
    File ".local/bin/pingproxy.py", line 112, in <module>
        proxy.run()
    File ".local/bin/pingproxy.py", line 88, in run
        self.socket.sendto(device_data, client)
BlockingIOError: [Errno 11] Resource temporarily unavailable

As is, the error is letting you know that the messages aren’t getting through, so the device you’re trying to communicate with isn’t responding and likely isn’t receiving the data being sent. Given the error is occurring on the top computer the “data being sent” would be the command to take each reading. Your hypothesis of a dropped connection seems quite reasonable here.

Looking at this stackoverflow response, it seems like it’s because pingproxy uses a non-blocking socket, which means it errors out immediately if the connection doesn’t respond. You might want to try replacing line 59 of pingproxy.py (self.socket.setblocking(False)) by setting a small timeout and seeing if that helps (e.g. self.socket.settimeout(0.01) to wait 10ms before timing out). If you’ve only got the one ping device that you’re communicating with then you might even want to use self.socket.setblocking(True) to make it just wait until the communication works.

I believe sockets are 1:1, so to simultaneously view in Mission planner and PingViewer you’ll need to arrange for the data to send to both relevant ports (you may have to be careful to select separate ports on each application once it’s sending, or you could have issues with fighting if both applications try to connect to the same port)

The sensor log is saved in a binary format, which I believe is just the binary version of the ping messages. You can try accessing it by reading it as a binary file in Python and then using the brping.pingmessage.PingMessage class (as defined here) to convert it into messages that you can extract the data from. I’ll need to start accessing the data for the Ping360 next week some time, so if you haven’t got it working by then then I’ll hopefully be able to help some more once I’ve figured it out, since the protocol is the same :slight_smile:

More info on this can be found in the documentation, including an example python script to parse the data.

1 Like