Skip to content

status_text() doesn't work #459

Open
@ferglezr1998

Description

@ferglezr1998

Hi! I have the next problem:
I have two PC's connected to my Pixhawk. One of them is connected via serial port (micro usb) and the other is connected via 'Telem1' port (configured as Mavlink output). What I what to do is so simple. From one PC I want to send a custom command using telemetry_server.publish_status_text(). This message should travel across the pixhawk and it should be read by the other PC where I am using the next code block to be able to see the messages I receive:

async for msg in drone.telemetry.status_text():
        print(str(msg.type) + ": " + msg.text)

Well... If I run manually ./mavsdk_server serial:///dev/ttyACM0:115200 I can see that I receive the messages correctly because they are printed in the console.
However, when I run my python program, I only receive the messages auto generated by the pixhawk (Prearm check, etc etc) but I dont receive my messages.

The code I'm using to send the messages is the following:

from mavsdk import System
from mavsdk.telemetry_server import TelemetryServerError, StatusTextType, StatusText
import asyncio
import sys
import time

async def main(args=None):
    drone = System()
    await drone.connect("serial:///dev/ttyS0:115200")

    text = StatusText(StatusTextType.CRITICAL, "CUSTOM: Hello World")
    while (True):
        try:
            await drone.telemetry_server.publish_status_text(text)
        except TelemetryServerError as e:
            print(e)
            continue
        print("Message Sended!")
        time.sleep(1.5)

if __name__ == "__main__":
    loop = asyncio.get_event_loop()
    loop.run_until_complete(main(sys.argv))

Help please!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions