dronekit / dronekit-python

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

Drone kit SITL issue #1219

Open MOHAMMEDSHAHED786 opened 2 months ago

MOHAMMEDSHAHED786 commented 2 months ago

I am using Mac m1 Apple chip When i am running this code

print("Start simulator (SITL)")

import dronekit_sitl sitl = dronekit_sitl.start_default() connection_string = sitl.connection_string()

Import DroneKit-Python

from dronekit import connect, VehicleMode

Connect to the Vehicle.

print("Connecting to vehicle on: %s" % (connection_string,)) vehicle = connect(connection_string, wait_ready=True)

Get some vehicle attributes (state)

print("Get some vehicle attribute values:") print(" GPS: %s") % vehicle.gps_0 print(" Battery: %s") % vehicle.battery print(" Last Heartbeat: %s") % vehicle.last_heartbeat print(" Is Armable?: %s") % vehicle.is_armable print(" System status: %s") % vehicle.system_status.state print(" Mode: %s") % vehicle.mode.name # settable

Close vehicle object before exiting script

vehicle.close()

Shut down simulator

sitl.stop() print("Completed")

It is showing this error

"/Documents/CODING/python/DRONE/hello.py" Start simulator (SITL) Starting copter simulator (SITL) SITL already Downloaded and Extracted. Ready to boot. Traceback (most recent call last): File "Documents/CODING/python/DRONE/hello.py", line 4, in sitl = dronekit_sitl.start_default() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/dronekit_sitl/init.py", line 462, in start_default sitl.launch(sitl_args, await_ready=True, restart=True) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/dronekit_sitl/init.py", line 251, in launch caps = ArdupilotCapabilities(self.path) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/dronekit_sitl/init.py", line 160, in init process = subprocess.Popen([path, '--help'], stdout=subprocess.PIPE) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 951, in init self._execute_child(args, executable, preexec_fn, close_fds, File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1821, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) OSError: [Errno 86] Bad CPU type in executable: '/.dronekit/sitl/copter-3.3/apm'

This is my python version ----> Python 3.9.12 This is my dronekit version ---> Version: 2.9.2 This is dronekit-SITL version ---> Version: 3.3.0

Can anyone help me out how to resolve this??