You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently started using MAVLink in a robotics project, and I was passing IMU data using MAVLink over a direct Ethernet from a Teensy 4.1 to an NVIDIA Jetson Orin nano.
I ran some tests, and the results show that on the receiving end (the Jetson Orin Nano) there are processing delays of ~30ms
To run the test, I connected one of the Teensy's GPIO pins to the Jetson's GPIO, and used the following code to send a heartbeat message while pulsing the GPIO line:
The send_buffer function is also just a simple wrapper around Arduino's built-in UDP functionality
On the Jetson side, I wrote a Python script that waits for the GPIO falling edge, then measures the time until the MAVLink message is received:
#!/usr/bin/env python3importJetson.GPIOasGPIOimporttimeimportsocketfrompymavlinkimportmavutilGPIO_PIN=21GPIO.setmode(GPIO.BCM)
GPIO.setup(GPIO_PIN, GPIO.IN)
mavlink_connection=mavutil.mavlink_connection('udpin:0.0.0.0:14550')
#sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)#sock.bind(("", 14550))defwait_for_heartbeat():
whileTrue:
msg=mavlink_connection.recv_match(blocking=False)
# msg, addr = sock.recvfrom(1024)ifmsg:
returntime.time()
try:
# Wait for GPIO to go LOWGPIO.wait_for_edge(GPIO_PIN, GPIO.FALLING)
start_time=time.time()
# Measure time to first MAVLink heartbeatheartbeat_time=wait_for_heartbeat()
elapsed_time=heartbeat_time-start_timeprint(f"Time from GPIO LOW to MAVLink heartbeat: {elapsed_time*1000:.4f}ms")
exceptKeyboardInterrupt:
passfinally:
GPIO.cleanup()
When commenting out the MAVLink code and uncommenting the raw UDP code in this script, the time drops from ~30ms to ~0.5ms. Am I doing something wrong on the receive code that causes such a massive delay? Or is this an fundamental limitation of pymavlink?
The text was updated successfully, but these errors were encountered:
I recently started using MAVLink in a robotics project, and I was passing IMU data using MAVLink over a direct Ethernet from a Teensy 4.1 to an NVIDIA Jetson Orin nano.
I ran some tests, and the results show that on the receiving end (the Jetson Orin Nano) there are processing delays of ~30ms
To run the test, I connected one of the Teensy's GPIO pins to the Jetson's GPIO, and used the following code to send a heartbeat message while pulsing the GPIO line:
The heartbeat() method is just a small wrapper:
The send_buffer function is also just a simple wrapper around Arduino's built-in UDP functionality
On the Jetson side, I wrote a Python script that waits for the GPIO falling edge, then measures the time until the MAVLink message is received:
When commenting out the MAVLink code and uncommenting the raw UDP code in this script, the time drops from ~30ms to ~0.5ms. Am I doing something wrong on the receive code that causes such a massive delay? Or is this an fundamental limitation of pymavlink?
The text was updated successfully, but these errors were encountered: