I build my drone using the Pixhawk and Raspberry pi4 and I try the MAVProxy its work there is the communication between Pixhawk and Raspberry but when I run the drone arm script this problem appears:
(smartdrone) smartdrone@raspberrypi:~/ardupilot $ python smart.py --connect udp:192.168.1.100:14550
Connecting to vehicle on: udp:192.168.1.100:14550
An error occurred: [Errno 99] Cannot assign requested address
I have this script code with Python for drone arming :
from dronekit import connect, VehicleMode, LocationGlobalRelative, APIException
import time
import math
import socket
import argparse
import geopy.distance
# Connect to the drone
def connectMyCopter():
parser = argparse.ArgumentParser(description='commands')
parser.add_argument('--connect')
args = parser.parse_args()
connection_string = args.connect
baud_rate = 115200
print("\nConnecting to vehicle on: %s" % connection_string)
vehicle = connect(connection_string, baud=baud_rate, wait_ready=True)
return vehicle
# Arm the drone
def arm(vehicle):
while not vehicle.is_armable:
print("Waiting for vehicle to become armable...")
time.sleep(1)
print("Your Vehicle is now armable")
vehicle.armed = True
while not vehicle.armed:
print("Waiting for drone to become armed...")
time.sleep(1)
print("Vehicle is now armed... OMG props are spinning, look out!!!!!!!!!!")
return None
# Main function
if __name__ == "__main__":
vehicle = connectMyCopter() # Call the function to connect to the vehicle
arm(vehicle) # Arm the vehicle
print("End of script...")
vehicle.close() # Close the connection when done
######################################################################