Indoor copter flight
See original GitHub issueI am working with dronekit python and using RPi 1 and Pixhawk with copter v3.3.3, in a gps denied environment.
Last few weeks I am trying to make the drone takeoff through python script but unable to do so as i dont know in a gps denied environment, what mode should i use to make the drone takeoff.
----------------next part i want to do-------------- And also I want to control the drone through an android mobile app having joystics on screen to send the exact values as of my transmitter and for that I am trying with RC Override but Im not able to takeoff or increase the throttle with rc override as it says cannot ARM:Throttle too high. ----------------next part i want to do--------------
But first of all, I want to takeoff the drone in GPS Denied environment, hover for few seconds and Land but I am not sure what mode to use instead of guided, with which simple_takeoff() will work.
NOTE: In STABILIZE the motors are disarming after some time instead of increase in their speed:
I am using the following code:
#/usr/bin/env python
# -*- coding: utf-8 -*-
from dronekit import connect,VehicleMode,LocationGlobalRelative
from pymavlink import mavutil
import time
# Receiving from command line
# import argparse
# parser = argparse.ArgumentParser()
# parser.add_argument('--connect',help="PORT_NO")
# args = parser.parse_args()
# Connecting to the vehicle
#connection_string = args.connect
connection_string = "/dev/ttyAMA0,57600"
print("Connecting to...% s" % connection_string)
vehicle = connect(connection_string, wait_ready=True)
#Function to arm and takeoff to a specified altitude
print(vehicle.mode)
# vehicle.mode = VehicleMode("LAND")
# time.sleep(5)
def arm_and_takeoff(aTargetAlt):
print("Basic Prearm checks..dont touch!!")
# while not vehicle.is_armable:
# print("Waiting for vehicle to initialize")
# time.sleep(2)
print("Arming Motors..")
# Copter should arm in Guided-mode
vehicle.mode = VehicleMode("GUIDED")
time.sleep(3)
vehicle.armed = True
while not vehicle.armed:
print("Waiting for arming..:% s"% vehicle.mode)
vehicle.armed = True
time.sleep(2)
print("Taking Off..")
vehicle.simple_takeoff(aTargetAlt)
time.sleep(5)
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>=aTargetAlt*0.95:
print("Reached Target Altitude..")
modeLand()
# print("Landing....")
# vehicle.mode = VehicleMode("LAND");
# print("Vehicle mode:%s"% vehicle.mode)
break
def modeLand():
print("Landing now")
vehicle.mode = VehicleMode("LAND")
time.sleep(5)
print("-------------Vehicle is in:-------%s"% vehicle.mode)
arm_and_takeoff(2)
print(vehicle.mode)
print("Vehicle object closed")
vehicle.close()
And I have Optical flow Camera and a Lidar which i can use. Please help I’m stuck with this.
Regards Biswajit
Issue Analytics
- State:
- Created 7 years ago
- Comments:19 (3 by maintainers)
Top GitHub Comments
Try this: Need a recent version of ArduPilot.
Thanks @studroid ,
I will look into it. And sorry for late response.
Regards Biswajit