Without knowing more about your setup I can't provide a specific code example. But if that's how you want to do it, running Mavproxy and then using a python script to send messages is probably a good way to do it.
You could check out this code which takes in data from our Ping sonar and sends it to the pixhawk over Mavproxy. There are probably simpler examples out there though.
Hi Patrick, sorry for the delay in replying, we have been busy field testing the system our Ping1D is on recently. The firmware version reported by our Ping is 3.27.
We also noticed in our field testing that we sometimes get seemingly random changes in the appearance of our data, shown in this screenshot. We usually see data like that on the right of the image, but sometimes it appears smoothed like in the left of the image. Just wondering if you or anyone has seen this before, or knows what might be causing it.