dronekit / dronekit-python

DroneKit-Python library for communicating with Drones via MAVLink.
https://readthedocs.org/projects/dronekit-python/
Apache License 2.0
1.62k stars 1.45k forks source link

Dronekit over 4G #781

Open ml1206079 opened 6 years ago

ml1206079 commented 6 years ago

Hey guys. i have been having a really strange issue i'm using dronekit as a ground-station with a remote server running a drone-kit script which accepts a udpin connection. the drone it self is using mavproxy to transmit the connection over 4G dongle to the ip address of the server running dronekit sometimes it connects sometimes it doesn't and i have noticed it mostly doesn't connect when i'm indoors. so i digged in through your code and i found this line msg = self.out_queue.get(True, timeout=0.01) line 172 at mavlink.py which i think is causing the problems. because my 4g link indoors has a delay of over 100ms do you think i'm right in my assumption ? and if so. why did you guys specifically choose this number as a timeout ?

rtfswr commented 6 years ago

check help and support on pilotanywhere.com. we have some documentation there how to set up the connection. r.

Am 10.01.2018 14:30 schrieb "ml1206079" notifications@github.com:

Hey guys. i have been having a really strange issue i'm using dronekit as a ground-station with a remote server running a drone-kit script which accepts a udpin connection. the drone it self is using mavproxy to transmit the connection over 4G dongle to the ip address of the server running dronekit sometimes it connects sometimes it doesn't and i have noticed it mostly doesn't connect when i'm indoors. so i digged in through your code and i found this line msg = self.out_queue.get(True, timeout=0.01) line 172 at mavlink.py which i think is causing the problems. because my 4g link indoors has a delay of over 100ms do you think i'm right in my assumption ? and if so. why did you guys specifically choose this number as a timeout ?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/dronekit/dronekit-python/issues/781, or mute the thread https://github.com/notifications/unsubscribe-auth/AP-uB69X3bI74Pimp3Yv5SSmHHy2mF_Lks5tJLt_gaJpZM4RZUlQ .

pietrodn commented 6 years ago

The line of code you mentioned is not the problem. out_queueis a Queue object, which is defined in the queue module.

From the documentation:

The queue module implements multi-producer, multi-consumer queues. It is especially useful in threaded programming when information must be exchanged safely between multiple threads. The Queue class in this module implements all the required locking semantics. It depends on the availability of thread support in Python; see the threading module.

Queue.get(block=True, timeout=None) Remove and return an item from the queue. If optional args block is true and timeout is None (the default), block if necessary until an item is available. If timeout is a positive number, it blocks at most timeout seconds and raises the Empty exception if no item was available within that time. Otherwise (block is false), return an item if one is immediately available, else raise the Empty exception (timeout is ignored in that case).

So, this has nothing to do with network latency.

Can you ping the drone when it does not connect?

borhanreo commented 6 years ago

I think, you need to use Raspberry Pi and 4G Modem. So you will able to connection between 4G modem, raspberry pi and socket server. Raspberry pi will connected with APM/PIX via USB cable. I already developed a ground station using 3G modem, raspberry pi 3 B, APM 2.8 and socket server.