HITL simulation With MAVSDK-Python

Hi.
I am trying to run a HITL simulation in jMAVSim on a quadcopter and connect it to Raspberry Pi by using the 433 MHz Telemetry dongle.

I got the simulation running, tested it with the RC, and I am getting expected output. (Connecting PX4 (Pixhawk 2.4.8.) via USB to Windows PC (with HITL enabled), running the jMAVSim simulation from run-console.bat, and then opening Qgroundcontrol.)

Now for my RPi - PX4 connection I am using the 433MHz telemetry radio, which is connected to RPI in USB and to PX4 to TELEM2 port. I set up the baud rate on RPI and PX4 to 57600 8N1 which seems to work. When I run the takeoff_and_land.py example from https://github.com/mavlink/MAVSDK-Python I get Timeouts all the time. Sometime the Quad takes off and then timesout and is left hanging, or times out right after sending the takeoff command. I have set MAV_1_MODE to “minimal” and it has helped a little, because before that if I remember correctly I never got to ARM the Quad.

Can anybody help me with this? Is the 433MHz just to slow for this type of application, or is there some workaround I am not seeing? I have no idea how to troubleshoot this.

What setting are you using in PX4 for that MAVLink link? I’m suspecting it’s sending too much information. Can you also paste the output of mavlink status. You can e.g. run it in MAVLink shell in QGC.

Thanks for the reply @JulianOes.
I have set MAVLink parameters accordingly. (Hope these are all that ar required)
image
Here is the mavlink status output in Qgroeundcontrol:
image
image
image

This works with C++ but seems to fail with this Python example:

#!/usr/bin/env python3

import asyncio

from dronecode_sdk import connect as dronecode_sdk_connect
from dronecode_sdk import start_mavlink

start_mavlink()
drone = dronecode_sdk_connect(host="127.0.0.1")


async def run():
    print("-- Arming")
    await drone.action.arm()
    print("-- Taking off")
    await drone.action.takeoff()
    await asyncio.sleep(5)
    print("-- Landing")
    await drone.action.land()

loop = asyncio.get_event_loop()
loop.run_until_complete(run())

Learn more about python:https://www.cetpainfotech.com/technology/python-training

I think you have configured your data rate 10 times too high for the radio, see the high txerr.

The rate should be 1/10 of the baudrate as documented here: https://dev.px4.io/master/en/advanced/parameter_reference.html#MAV_1_RATE

Hi @JulianOes
Thank you for your recommendation and help. I changed it to 5760 B/s but still sometimes got timeouts. Then reduced it even further to 1200 B/s as for default MAV_0_RATE and now it seems to work without timeouts.
Maybe you could point me in the right direction on what read into further, so that I can better understand all the messages that are being sent and broadcasted by default on this link? I would like to understand what is already available and what I need to request from pixhawk, to control it remotely.

These are the MAVLink modes as they are defined:

Note that the rates (in Hz) are all scaled down to comply with the configured rate.