Dronekit-python running in docker connecting to MAVProxy on host

好久不见. 提交于 2021-01-29 13:51:07

问题


I am using dronekit-python in a docker container and am attempting to connect to an instance of MAVProxy running on my host machine (Mac OSX) using the following command:

vehicle = connect('udp:host.docker.internal:14551', wait_ready=True)

but am getting the following error:

File "/usr/local/lib/python3.7/site-packages/pymavlink/mavutil.py", line 1015, in __init__
self.port.bind((a[0], int(a[1])))

OSError: [Errno 99] Cannot assign requested address

Does anyone know what the issue is here? I am able to successfully connect using the above command when I run the python script locally on host but not when I have it running in a docker container.

I found a similar stackoverflow question here but the accepted answer did not work for me. Not sure if I need to be exposing ports or something like that.

Here is the command that I am running on my host machine to kick off MAVProxy: mavproxy.py --master=127.0.0.1:14550 --out udp:127.0.0.1:14551 --out udp:10.55.222.120:14550 --out udp:127.0.0.1:14552


回答1:


I ended up getting MAVProxy on host and dronekit-python in the docker flask container properly connected.

Seemus790's answer in this gitter thread did the trick.

Working solution: MAVProxy on host machine (Mac OS in my case)

mavproxy.py --master=127.0.0.1:14550 --out udp:127.0.0.1:14551 --out udp:10.55.222.120:14550 --out=tcpin:0.0.0.0:14552

dronekit-python command in docker container:

vehicle = connect('tcp:host.docker.internal:14552', wait_ready=True)

The trick was the --out=tcpin:0.0.0.0:14552 part of the mavproxy command which is documented here



来源:https://stackoverflow.com/questions/61714244/dronekit-python-running-in-docker-connecting-to-mavproxy-on-host

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!