Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mavutil udpin connection string unable to send messages #932

Open
Stranjyr opened this issue Mar 20, 2024 · 0 comments
Open

Mavutil udpin connection string unable to send messages #932

Stranjyr opened this issue Mar 20, 2024 · 0 comments

Comments

@Stranjyr
Copy link

Stranjyr commented Mar 20, 2024

I'm building a simple ground control program using the pymavlink documentation as a guide, and have run into an issue with udpin connections. Specifically, the connection seems to be unable to properly send messages to a udpout connection.

Description

When using mavutils 'mavlink_connection' function, the 'udpin' is unable to send messages.

Steps to replicate

This code should connect a udp client and server, and allow both to send heartbeats to one another. However, only the udpin side receives heartbeats

from pymavlink import mavutil

conn_out = mavutil.mavlink_connection('udpout:localhost:14450')
conn_in = mavutil.mavlink_connection('udpin:localhost:14450')

conn_out.mav.heartbeat_send(0, 0, 0, 0, 0)
# Also tested with wait_heartbeat
msg = conn_in.recv_msg()
# As expected, msg is a heartbeat message, not None
assert msg is not None

conn_in.mav.heartbeat_send(0, 0, 0, 0, 0)
# Also tested with wait_heartbeat
msg = conn_out.recv_msg()
# Throws an error, conn_out never got the message
assert msg is not None

I have also investigated this with mavproxy
Test 1: mavproxy.py --master='udpin:localhost:14450' and a python script with connection = mavutil.mavlink_connection('udpout:localhost:14450')
Result: Both mavproxy and the python script were able to send and receive messages properly

Test2: mavproxy.py --master='udpout:localhost:14450' and a python script with connection = mavutil.mavlink_connection('udpin:localhost:14450')
Result: The python script receives messages from mavproxy, but mavproxy does not receive heartbeats (or other messages) from the python script when they are sent

Conclusion

Because udpout works with two way communication when connected to mavproxy, my guess is that the error is with udpin on message send. I took a look through the code, and my first thought is that there might be a bug somewhere in the mavudp write method that is grabbing the wrong destination address for udp clients, but I'm not familiar enough with the code to properly test for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant