Raspberrypi connection with pixhawk using mavproxy

I used dronekit package to control the drone from raspberry pi .I was able to arm the drone successfully but when I try to execute the take script .I am getting the error component arm_disarm failed I don’t know the exact problem and what is failing … can you guys help me out…

Hi,
What was the connection for the Raspberry Pi Pixhawk flight controller.
Also do you have a link for the DroneKit package installation on Raspi.
Is the GPS module fixed on Raspi or the flight controller.

I don’t think Dronekit is very much tested or used with PX4. I can recommend using MAVSDK instead.

1 Like

@JulianOes …that is great …Can you please point me to a link where i could understand this in detail and install the same on a Raspberry pi. along with required libraries

HI julianOes thanks for the info .Actually I don’t know how to connect my mavsdk example take off script with the actual drone .I know It can done through Tcp protocol but don’t know how to do can you please explain .

so I have pi4 with me .Now I making my pi as an external computer companion and run my python mavsdk code to take off and land .I was able to arm my drone using raspberrypi but when I try to run take off script its not working properly .

Connect to the Vehicle (in this case a simulator running the same computer)

vehicle = connect(‘tcp:127.0.0.1:5760’, wait_ready=True)

def arm_and_takeoff(aTargetAltitude):
“”"
Arms vehicle and fly to aTargetAltitude.
“”"

print "Basic pre-arm checks"
# Don't try to arm until autopilot is ready
while not vehicle.is_armable:
    print " Waiting for vehicle to initialise..."
    time.sleep(1)

print "Arming motors"
# Copter should arm in GUIDED mode
vehicle.mode    = VehicleMode("GUIDED")
vehicle.armed   = True

# Confirm vehicle armed before attempting to take off
while not vehicle.armed:
    print " Waiting for arming..."
    time.sleep(1)

print "Taking off!"
vehicle.simple_takeoff(aTargetAltitude) # Take off to target altitude

# Wait until the vehicle reaches a safe height before processing the goto (otherwise the command
#  after Vehicle.simple_takeoff will execute immediately).
while True:
    print " Altitude: ", vehicle.location.global_relative_frame.alt
    #Break and return from function just below target altitude.
    if vehicle.location.global_relative_frame.alt>=aTargetAltitude*0.95:
        print "Reached target altitude"
        break
    time.sleep(1)

arm_and_takeoff(20)