Control PX4 Gazebo Sim from networked MAVSDK

#1

Hey there, drone noob here with a (hopefully) simple problem.

Trying to control a simulated drone in gazebo from a MAVSDK application running on an external, networked computer. For reference, the simulator’s IP address is 192.168.42.1 and the client computer’s IP is 192.68.42.10

However, the application keeps getting a bind error or can’t find any system on the network. Even the takeoff_and_land example doesn’t work on the client computer, but it works when I run it local on the same computer as the gazebo simulator.

The simulator set the MAV_BROADCAST param to 1 (Always broadcast) and I can see the broadcast messages appear to arrive at the client with tcpdump. These broadcasts seem to be directed at UDP port 14550, but I’ve tried to make the client app to connect on UDP ports 14540, 14550, 14560, 14570, and 14580 to no success.

Are there any other parameters or configurations that I need to examine to get this setup to work out?

Thanks for the help, I really appreciate all I can get :grin:
Mitch

#2

So I’m trying again today, running the PX4+Gazebo on 192.168.42.1 and QGroundControl on my laptop on 192.168.42.20, and this seems to work. This is probably because QGroundControl is already set up to listen to port 14550.

So for some reason, my custom GroundControl application (which is what MAVSDK apps default to) even when it tries to listen to port 14550 does not connect to the simulated drone.

I think @dagar, you said your setup was the same as I have now in this reply. Do you know what I can do to make my custom controller app or even the MAVSDK takeoff_and_land demo connect to the simulator? Thanks

#3

Ok, I was able to run the takeoff_and_land demo on my laptop’s VM and connect to the simulation. So that means there must be a problem with the network interfaces on the other client computer at 192.168.42.10.
Maybe the program is binding to the wrong interface, the cable is connected through a USB-Ethernet dongle, so it could be defaulting to another interface built into it
Baby steps…

#4

Well I was finally able to get the takeoff_and_land demo working on the client computer. It was some networking black magic, I’m not really sure what I did, but I connected the two computers through a router instead of directly to one another. Now to see if my actual application has similar results.

#5

Thanks for sharing your progress.