I started to using the Dronekit, Dronekit-STIL and Mavlink to simulate my python scripts. Afters some days using it without problem I started to receive the error: WARNING:dronekit:Link timeout, no heartbeat in last 5 seconds.
I had tried to reinstall all the things but nothings works.
I had install the PIP pachages on Linux Ubutun 18. I had try the same packages on Ubutun 20 but I receive the same error.
I had install this packages:
pymavlink>=2.3.3
MAVProxy-1.8.39
dronekit-2.9.2
dronekit-sitl-3.3.0
Python 2.7.17
Follow my steps to receive the error:
1 - dronekit-sitl copter --home=-25.56731,-42.61554,0,180
os: linux, apm: copter, release: stable
SITL already Downloaded and Extracted.
Ready to boot.
Execute: /home/cesar/.dronekit/sitl/copter-3.3/apm --home=-23.56731,-46.61554,0,180 --model=quad -I 0
Started model quad at -23.56731,-46.61554,0,180 at speed 1.0
bind port 5760 for 0
Starting sketch 'ArduCopter'
Serial port 0 on TCP port 5760
Starting SITL input
Waiting for connection ....
bind port 5762 for 2
Serial port 2 on TCP port 5762
bind port 5763 for 3
Serial port 3 on TCP port 5763
2 - mavproxy.py --master tcp:127.0.0.1:5760 --out udp:127.0.0.1:14551 --out udp:10.0.2.15:14550
Connect tcp:127.0.0.1:5760 source_system=255
Log Directory:
Telemetry log: mav.tlog
MAV> Waiting for heartbeat from tcp:127.0.0.1:5760
online system 1
STABILIZE> Mode STABILIZE
AP: Calibrating barometer
AP: Initialising APM...
AP: barometer calibration complete
AP: GROUND START
Init Gyro**
INS
G_off: 0.00, 0.00, 0.00
A_off: 0.00, 0.00, 0.00
A_scale: 1.00, 1.00, 1.00
3 - python hello.py
Start simulator (SITL)
Starting copter simulator (SITL)
SITL already Downloaded and Extracted.
Ready to boot.
Connecting to vehicle on: tcp:127.0.0.1:5760
WARNING:dronekit:Link timeout, no heartbeat in last 5 seconds
after 30s
ERROR:dronekit.mavlink:Exception in MAVLink input loop
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/dronekit/mavlink.py", line 211, in mavlink_thread_in
fn(self)
File "/usr/local/lib/python2.7/dist-packages/dronekit/init.py", line 1371, in listener
self._heartbeat_error)
APIException: No heartbeat in 30 seconds, aborting.
Traceback (most recent call last):
File "hello.py", line 11, in
vehicle = connect(connection_string, wait_ready=True)
File "/usr/local/lib/python2.7/dist-packages/dronekit/init.py", line 3166, in connect
vehicle.initialize(rate=rate, heartbeat_timeout=heartbeat_timeout)
File "/usr/local/lib/python2.7/dist-packages/dronekit/init.py", line 2275, in initialize
raise APIException('Timeout in initializing connection.')
dronekit.APIException: Timeout in initializing connection.
Hard to say without knowing the content of hello.py.
Try connecting through udp:127.0.0.1:14551 in the hello.py script rather than tcp:127.0.0.1:5760.
Also, it looks like you're starting another SITL instance from your script, but again, hard to know without seeing the code.
DRONEKIT - WARNING:dronekit:Link timeout, no heartbeat in last 5 seconds