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

Multiple systems on the network #149

Open
tkocik92 opened this issue Feb 9, 2024 · 1 comment
Open

Multiple systems on the network #149

tkocik92 opened this issue Feb 9, 2024 · 1 comment

Comments

@tkocik92
Copy link

tkocik92 commented Feb 9, 2024

MAVSDK-Java Version: 2.0.1
MavSDK-Server Version: 2.0.0

I am running into an issue when there are multiple Systems detected on a network. My implementation looks like the following:

val mavSdkPort = mavSdkServer.run("udp://$ipAddress:$port")
val system = System(ipAddress, mavSdkPort)

Where ipAddress = "0.0.0.0" and port is the port of the system I am trying to connect to.

If only 1 system is on the network, I am able to connect perfectly fine. If 2 systems are on the network, I am connected to both Systems with no way to discern between the two. Logcat looks like the following:

Mavsdk           MAVSDK version: v2.1.0
MAVSDK-Server    Running mavsdk_server with connection url: udp://0.0.0.0:14550
Mavsdk           Waiting to discover system on udp://0.0.0.0:14550...
Mavsdk           New system on: 192.168.4.223:43620 (with system ID: 1) // Simulator
Mavsdk           New system ID: 1 Comp ID: 1
Mavsdk           Component Autopilot (1) added.
Mavsdk           Component Gimbal (154) added.
Mavsdk           New system on: 10.X.X.X:14550 (with system ID: 1) // System I am attempting to connect to

If I change ipAddress (mentioned above) to the IP of the desired system, MavSDK Server never finishes booting up. What can I do differently?

@JonasVautherin
Copy link
Collaborator

The problem is that MAVSDK-Java expects exactly one system on the port it listens to (here udp://:14550). It is the same with all the language bindings (e.g. MAVSDK-Swift, MAVSDK-Python). What you have to do is demultiplex the MAVLink stream, and send it to different instances of mavsdk_server.

Say you have two drones, both broadcasting on udp://:14550. You can run a mavlink-router that listens on 14550 and forwards to 14551 and 14552. Then you can run on mavsdk_server with mavSdkServer.run("udp://:14551") and the other with mavSdkServer.run("udp://:14552").

Does that make sense?

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

2 participants