Skip to content

Dronekit Python's connection to SITL's Plane model does not receive heartbeat #155

Open
@krishnans2006

Description

@krishnans2006

Hello,

I am trying to start a Dronekit SITL simulation using the API, and connect to it with Dronekit-Python. Here is the first part of my code:

from dronekit import connect, VehicleMode
from dronekit_sitl import SITL, start_default

sitl = SITL()
sitl.download("plane", "3.3.0", verbose=True)
sitl.launch([], await_ready=True, restart=True, verbose=True)
connection_string = sitl.connection_string()

vehicle = connect(connection_string)

This code works perfectly when using sitl.download("copter", "3.3", verbose=True) as shown in the example. However, the code that starts a plane simulation does not work like so, and there is a connection timeout.

Here is the full traceback:

SITL already Downloaded and Extracted.
Ready to boot.
Execute: /home/krishnan/.dronekit/sitl/plane-3.3.0/apm --home=-35.363261,149.165230,584,353 --model=plane -I 0
SITL-0> Starting sketch 'ArduPlane'
SITL-0.stderr> bind port 5760 for 0
SITL-0> Starting SITL input
SITL-0.stderr> Serial port 0 on TCP port 5760
SITL-0> Waiting for connection ....
SITL-0.stderr> bind port 5762 for 2
SITL-0.stderr> Serial port 2 on TCP port 5762
SITL-0.stderr> bind port 5763 for 3
SITL-0.stderr> Serial port 3 on TCP port 5763
WARNING:dronekit:Link timeout, no heartbeat in last 5 seconds
ERROR:dronekit.mavlink:Exception in MAVLink input loop
Traceback (most recent call last):
  File "/venv/lib/python3.9/site-packages/dronekit/mavlink.py", line 211, in mavlink_thread_in
    fn(self)
  File "/venv/lib/python3.9/site-packages/dronekit/__init__.py", line 1370, in listener
    raise APIException('No heartbeat in %s seconds, aborting.' %
dronekit.APIException: No heartbeat in 30 seconds, aborting.
Traceback (most recent call last):
  File "test.py", line 9, in <module>
    vehicle = connect(connection_string)
  File "/venv/lib/python3.9/site-packages/dronekit/__init__.py", line 3166, in connect
    vehicle.initialize(rate=rate, heartbeat_timeout=heartbeat_timeout)
  File "/venv/lib/python3.9/site-packages/dronekit/__init__.py", line 2275, in initialize
    raise APIException('Timeout in initializing connection.')
dronekit.APIException: Timeout in initializing connection.

Process finished with exit code 1

I've already tried:

  • Increasing the timeout and heartbeat_timeout in the connect() function
  • Manually defining the connection string (127.0.0.1:5760)

Is there any connection parameter, setting, or option (plane-specific) that I am missing? Any help is appreciated, Thanks a lot!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions