Cannot run examples from webinar

Hi! I attended the DronecodeSDK webinar, very informative indeed. I wanted to run the Python examples myself.
I was able to start PX4 jMAVSim (make posix jmavsim) in a docker container. Then I tried starting the backend in another container (since I couldn’t get past build gRPC with OpenSSL 1.1.x in the host PC, Ubuntu 18.04) and the backend is not able to discover the component from the other container. I’m using default bridge network 172.17.0.x

2 Likes

Hi @pablojr, this is quite an involved setup :grinning:

I’m not too familiar with networking through containers, so I might not be able to help there too well.

But if you post build issues that you’re getting trying to compile the pieces on Ubuntu, we can try to work through them and fix them. I’m gonna try to reproduce the Ubuntu 18.04 compilation error first. Btw. have you seen https://github.com/Dronecode/DronecodeSDK/issues/603 ? You might be lacking `golang.

I just checked the requirements to build on Ubuntu 18.04:

sudo apt install build-essential cmake make git gcc g++ golang libcurl4-openssl-dev zlib1g-dev

Then I was able to build it using:

 make BUILD_BACKEND=1 default

@JulianOes I started from scratch and I was able to build DronecodeSDK backend on host PC without issues. It looks like golang was missing as you pointed out.

However I still cannot connect DronecodeSDK backend running on host PC to jMAVSim running on docker container. I see your concerns regarding container networking but I’m able to connect QGC running on host PC to the simulator in container.

It looks like the backend is not able to connect to an autopilot running in a different machine, in my case:

  1. DronecodeSDK backend 172.17.0.1
  2. PX4 simulator (Firmware -> make posix jmavsim) 172.17.0.3

backend keeps showing messages:
No known remotes (udp_connection.cpp:130)

From the webinar it looks like you run everything on same IP (simulator, backend and python app)

Ok good, we made progress :smiley:.

For QGC, did you forward/unblock any ports or does that work just like that?

I know of two ways to make sure the UDP packets from PX4 go further than localhost:

  1. Set the param MAV_BROADCAST to 1.
  2. Add the IP of the host -t 172.17.0.1 here:
    https://github.com/PX4/Firmware/blob/c1f851a60066ce9677d88dae72caa1e7becf5ff0/ROMFS/px4fmu_common/init.d-posix/rcS#L238

I confirm that after:

  1. setting the param MAV_BROADCAST to 1 in PX4 project (Firmware/build/px4_sitl_default/parameters.xml)
  2. adding the IP address of the host PC (within the docker’s bridge network)

I was able to run DronecodeSDK-Python/examples and visualize the vehicle both in jMAVSim and QGC

Thank you for your assistance.

1 Like

Yay! Thanks for the feedback. And it would be great if you could add the commands/configs that you use for your docker setup, just in case someone reads this later.

For running PX4 + jMAVSim inside a docker container I used:

 docker run -it --rm --privileged --env=LOCAL_USER_ID="$(id -u)" -v ~/projects/Firmware:/projects/firmware/:rw -v /tmp/.X11-unix:/tmp/.X11-unix:ro -e DISPLAY=:0 --name=px4-dev-sim px4io/px4-dev-simulation:latest bash
1 Like