Home        Store        Learn        Blog

Reading Tether turns

Hello,
Is it possible to read Tetherturns via pymavlink or mavlink2rest ?

Hi @arend,

Try this:

from pymavlink import mavutil

# Create the connection
master = mavutil.mavlink_connection('udpin:0.0.0.0:14550')
# Wait a heartbeat before sending commands
master.wait_heartbeat()

while True:
    msg = master.recv_match()
    if not msg:
        continue
    if msg.get_type() == 'NAMED_VALUE_FLOAT':
        if msg.name == "TetherTrn":
            print("Tether turns: %s" % msg.value)

Hi @arend,

Just a reminder that is also possible to fetch the value using mavlink2rest via the websocket feature:
You can use as argument --url http://192.168.2.2:4777/ws/mavlink\?filter\=NAMED_VALUE_FLOAT

Thank you very much for the replay :slight_smile: @patrickelectric and @williangalvani

Hi @patrickelectric ,
Sorry for the late replay.
When i try to fetch data i get:
aiohttp.client_exceptions.WSServerHandshakeError: 404, message=‘Invalid response status’, url=URL(‘http://0.0.0.0:4777/ws/mavlink?filter=.*’)
Unclosed client session

This happen when i try to run the example as well. Is there anything else i need to do before i can run a websocket request ?

I believe you need to get a newer version of mavlink2rest. Download it here and replace the mavlink2rest file at ~/companion/tools/. Remember to make it executable (chmod +x).

Hi,

@williangalvani is correct, you should have mavlink2rest 0.9.0+ version, also make sure to have the latest companion version available running.

Thank you very much :slight_smile: