Hi everybody,
back to the main topic… the communication between the ROV and the waterlinked system.
I looked at the file @williangalvani referred me to and now I think I understood the connection. Yesterday we did a test in our pool and I noticed a difference between the display in QGC and the waterlinked system.
I think it’s a little bit weird when the data comes directly from the ROV.
This difference is visible in both data streams (RAW position and filltered position).
- blue graph → waterlinked underwater GPS
- orange graph → OptiTrack Motion Capture System
The ROV was at the surface and the A1 locator was mounted at the bottom of the side of the ROV pointing downwards. The pool is 6 m in diameter and 1 m depth. The display from QGC show constant depth of -0.2 m during the whole time. We used python (see the attached code) and the modified waterlinked api example to send the data via UDP to MATLAB.
"""
Get position from Water Linked Underwater GPS
"""
from __future__ import print_function
import requests
import argparse
import json
import socket
import struct
import time
ID1 = 1 # RAW Data
ID2 = 2 # Filtered Data
#Remote_Address_Port = ("192.168.2.1", 50008)
#Local_Address_Port = ("192.168.2.151", 50009)
Remote_Address_Port = ("127.0.0.1", 50008)
Local_Address_Port = ("127.0.0.1", 50009)
def get_data(url):
try:
r = requests.get(url)
except requests.exceptions.RequestException as exc:
print("Exception occured {}".format(exc))
return None
if r.status_code != requests.codes.ok:
print("Got error {}: {}".format(r.status_code, r.text))
return None
return r.json()
def get_acoustic_position_raw(base_url):
return get_data("{}/api/v1/position/acoustic/raw".format(base_url))
def get_acoustic_position_fil(base_url):
return get_data("{}/api/v1/position/acoustic/filtered".format(base_url))
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('-u', '--url', help='Base URL to use', type=str, default='http://192.168.2.94') # getting real data
#parser.add_argument('-u', '--url', help='Base URL to use', type=str, default='http://demo.waterlinked.com') # for demo use only
args = parser.parse_args()
base_url = args.url
print("Using base_url: %s" % args.url)
# Create a UDP socket at client side
UDP_Socket = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM)
# Bind to address and ip
#UDP_Socket.bind(Local_Address_Port)
while 1:
# std --> Current acoustic position accuracy (meter)
# temp --> Current acoustic temperature
# x --> Current acoustic x position relative to master electronics (meter)
# y --> Current acoustic y position relative to master electronics (meter)
# z --> Current acoustic z position (depth) relative to master electronics (meter)
# Get current unfiltered acoustic position relative to master acoustics.
data_raw = get_acoustic_position_raw(base_url)
if data_raw:
bytesToSend = bytearray(struct.pack("ffffff",ID1,data_raw["std"],data_raw["temp"],data_raw["x"],data_raw["y"],data_raw["z"]))
UDP_Socket.sendto(bytesToSend, Remote_Address_Port)
# Get current Kalman filtered acoustic position relative to master acoustics.
data_fil = get_acoustic_position_fil(base_url)
if data_fil:
bytesToSend = bytearray(struct.pack("ffffff",ID2,data_fil["std"],data_fil["temp"],data_fil["x"],data_fil["y"],data_fil["z"]))
UDP_Socket.sendto(bytesToSend, Remote_Address_Port)
time.sleep(0.01) # 10 Hz
if __name__ == "__main__":
main()
Something else I’d like to ask: Does anyone know what the diagnostic view of the underwater GPS should look like? There are no labels on the axis and I really don’t know what is displayed in this plot.
Is this a picture of a well-functioning system or rather of a not so well-functioning system?
Thanks in advance
Sven