Hi. I am running PX4 SITL inside a docker container. I would like to use QGroundControl outside the docker container (running on host) but I am not able to do that so far. I followed instruction in (https://dev.px4.io/v1.10/en/test_and_ci/docker.html#qgroundcontrol):
I used p 14570:14570/udp with the run docker command to expose/forward 14570 port
Created comm link in QGC with 14570 port and the docker container IP address.
However, when I try to connect to this link, QGC gives a message that the bounding address is already in use!
But I don’t think that this address is being used. What could be the issue?
@Jaeyoung-Lim I currently have the same issue. I’m fairly new to all this, could you provide the steps to forward it? Would this be done in QGC or the docker config?
@mhoang@Mzahana, you should check your ${FIRMWARE_DIR}/build/px4_sitl_default/etc/init.d-posix/px4-rc.mavlink folder. There you can find the udp_gcs_port_local. That is the value you should be specifying in QGroundControl. The tutorial incorrectly assumes 14570 for everyone, or it has been deprecated.
Hi @bigbellmercy
I would like to ask you for help. I have exactly the same situation. I am running the PX4 from docker using -p 18570:18570/udp. And then I go to Qgroundcontrol sw and I create new Comm Link with setup as:
udp
port - 18550
server (optional) - 172.17.0.2:18570
But still even if I click to connect I see Disconnected in the main QGC window. I absolutly dont know what can be wrong here. Can you help, did I miss any step?
Hi @bigbellmercy ,
I have noticed of those messages during simulation start, when there are ports mentioned. And After hours of tunning I have finally connected to the drone from docker The trick was in proper port number 18570 (thanks to your post) and using localhost IP address 0.0.0.0 with proper port pinted in docker image.
So finally it is working. Thank you for interest and for your post, it was very big hint
Hi @Lukas,
I’m running into the exact same issue but I still cannot find a way to connect from QGC to the simulation running in the docker container. As far as I can tell I have tried all of the suggestions mentioned in this comments.
Could you please tell me what steps to follow?
Is the script provided here correct or should I manually publish some ports?
What ip address and port should I enter in QGC and where can I find them?
hi @gamberoillecito, sure.
I dont use those docker files from here PX4 Docker Containers | PX4 User Guide. I use my own docker file instead, but from that description I can say the port is wrong, in default it is exposed on 18570.
So when I use my own docker image I expsoe this port in taht image and it is set on 0.0.0.0 IP as default.
So in QGC you need to go to commlinks, create a new one and say the QGC shall listen on 18571 (port: filed) and in server (optional) field you need to specify the ip and exposed port, so it needs to say 0.0.0.0:18570. And you shall be able to communicate with the drone.
If yo uwant to use the docker command from documentation, I would suggest to try to expose this other port, not the one mentioned in example.
Hi @Lukas, I’ve been trying to configure the exposed ports according to what you said but I haven’t yet been able to connect to QGC Daily.
When creating the container I ran it with the following code: docker run --name arucosim_2 -p 18570:18570/udp -it tracking bash
And when I ran docker ps, I got this as the output:
In QGC Daily, I created the Comm Link with the following settings:
Let me see if I can help as I’ve done this many times with Docker, but struggled for months to figure it out. Inside my Docker container I have PX4 cloned and am testing with a world I’m working on for April Tag detection. It’s based on the aruco world you’re testing with. If you read the comment here:
You’ll see that broadcasting doesn’t work in a VM. Right now I’m running Docker on Mac but I think the same should apply if you’re on Windows.
Open a terminal in your Docker container and run the following command:
Now run your make px4_sitl gz_x500_mono_cam_down_aruco
and fire up QGC on the host. It should automatically connect. I hope this helps and I realize it’s not the cleanest solution, but it does work for me. Feel free to follow up with any questions.