-
Notifications
You must be signed in to change notification settings - Fork 44
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
Running the MAVSDK server in UDP client mode #141
Comments
What are 14552, 14550 and 14540? Are they the port on which the autopilot listens for MAVLink (so MAVSDK should send to 14552, etc), or are they the port to which the autopilot sends MAVLink? I would guess it's the latter, in which case you want to try |
Thanks for replying! I saw the MAVSDK default is 14540 or 14550, and I found the port number might be 14552. I tried run("udp://:14540", 50051); run("udp://:14550", 50051); and run("udp://:14552", 50051); before but none works. |
What is your setup? What does the autopilot expect? Does the autopilot send MAVLink messages over the network? It depends on your setup, you need to provide more details if you want us to help 🙈. |
I installed the Android example app in the Herelink ground controller and I am trying to control my ArduPilot drone. I didn't make any changes in settings so everything should be default. Let me know if you need anything, and any details. Thank you very much for helping! |
Are you sure that Ardupilot sends MAVLink to 14550? Doesn't MAVSDK have to initiate the connection to Ardupilot on a port like 5760? I am not sure but I think you need to check that. If MAVSDK needs to initiate the connection, then it's |
I found that Herelink creates a UDP client that emits data to the 14550 port. By default, the MAVSDK server creates a UDP server using the 14550 port. So if MAVSDK needs to initiate the connection, I should do something like run("udp://192.168.42.129:5760", 50051); right? Thank you! |
Oh, on Herelink I think you should listen on 14551: Does QGC work on Herelink? If you run it, does it get MAVLink messages? |
Thank you! The QGC works fine on Herelink. Do I need to use 5760 to initiate the connection? |
Try to stop/kill QGC and run MAVSDK with |
Thank you! It went to the next line. However, it went to the next line whether the drone is powered on or not. Should it go to the next line only when it gets the flight controller's heartbeat? |
Oh right, that is a problem. I believe it is because the Herelink air unit sends MAVLink messages with a different system_id, and MAVSDK-Java expects exactly one system (the drone). If MAVSDK-Java receives the Herelink heartbeat before the drone heartbeat, then it is screwed and you have to restart the app 🙈. It is fixed in C++, but I had not made a MAVSDK-Java release with the fix. I'll try to do that in the next few days. In the meantime, make sure that the flight controller is already running when you start your app, and if the app doesn't receive e.g. telemetry, assume that it is not connected to the right system and restart it. That's a bit inconvenient, but in my experience most of the time it picks up the autopilot. Again, a proper fix is coming in the next MAVSDK-Java release 🙈. |
The RxJava subscription will happen no matter what. But if you receive e.g. positions, then the
|
Not sure I understand the question. If you receive positions, then |
I started the app after the drone was on. It skips over line viewModel.currentPositionLiveData.postValue(latLng); It seems like it didn't trigger right? Thank you! |
Are you familiar with RxJava? You are basically registering a callback, which won't be triggered at the moment where you register it, but at a later time, right? |
Hmm I think it should receive something (both with PX4 and Ardupilot) 🤔. Do you receive any telemetry at all, like position or battery updates? |
Battery is defined here, in Java it will result in something like |
Thank you! For battery, I got this. It looks right. I always need to run the QGC first, then it can receive the drone heartbeat. Otherwise, it keeps receiving the Herelink heartbeat and no telemetry information can be received. |
I am trying to run the Mavsdk in the android-client example with the UDP client mode. I tried mavsdkServer.run("udp://192.168.42.129:14552", 50051);
mavsdkServer.run("udp://192.168.42.129:14550", 50051);
and mavsdkServer.run("udp://192.168.42.129:14540", 50051); but no one get to the next line -- drone = new System(BACKEND_IP_ADDRESS, mavsdkServerPort);
I wonder if I am doing it correctly. Thank you!
The text was updated successfully, but these errors were encountered: