we are building a copter and right now we want to run a dronekit script but we are having problems establishing connection .
i downloaded python 2.7(i tried using python 3.7 but did not work as well and as far i understood dronekit does not support python 3) on my laptop and connected the telemetry to it and my raspberry pi ,and lastly connected to it with mission planner, as far as i understood by reading the dronekit documentation , i should be able to connect to my drone with this lines of code (the SITL is working and i was able to control the mission planner simulation drone with code):
from dronekit import connect, VehicleMode
vehicle = connect(‘com14’, wait_ready=True,baud=57600)
#the telemetry is connected to a USB port on my raspberry pi+navio2 drone,instead of con14 i tried the drone ip address or “/dev/ttyUSB0” but it didn’t work as will.
am getting this error message:
Traceback (most recent call last):
File “C:/Users/Yaser/PycharmProjects/test/main.py”, line 4, in
vehicle = connect(‘com14’, wait_ready=True, baud=57603,heartbeat_timeout=120)
File “C:\Users\Yaser\Downloads\WinPython-64bit-18.104.22.168Zero\python-2.7.13.amd64\lib\site-packages\dronekit_init_.py”, line 3159, in connect
handler = MAVConnection(ip, baud=baud, source_system=source_system, source_component=source_component, use_native=use_native)
File “C:\Users\Yaser\Downloads\WinPython-64bit-22.214.171.124Zero\python-2.7.13.amd64\lib\site-packages\dronekit\mavlink.py”, line 130, in init
self.master = mavutil.mavlink_connection(ip, baud=baud, source_system=source_system, source_component=source_component)
File “C:\Users\Yaser\Downloads\WinPython-64bit-126.96.36.199Zero\python-2.7.13.amd64\lib\site-packages\pymavlink\mavutil.py”, line 1727, in mavlink_connection
File “C:\Users\Yaser\Downloads\WinPython-64bit-188.8.131.52Zero\python-2.7.13.amd64\lib\site-packages\pymavlink\mavutil.py”, line 926, in init
serial.serialutil.SerialException: could not open port ‘com14’: WindowsError(2, ‘The system cannot find the file specified.’)
Process finished with exit code
some images of my drone:
note: i was getting error message no module named serial but after downloading pyserial and serial the problem went away
what am i doing wrong?