Python file to operate the quadcopter

Hi,im using pixhawk 2.4.8 and jetson nano.I’ve integrated pixhawk with jetson and able to send and receive commands like arming,rc commands.
Now,i want to make a python code for doing all these procedure like firstly arming it then takeoff then hover and at last land…i tried dronekit library for this but it’s not working because im not using GPS in my drone…
Please help me that how can i make such code and which library should i use…Please keep in kind im not using GPS…!!

Hello,
In that case you need to use other means for localization.
Take a look at these alternatives:
https://ardupilot.org/copter/docs/common-non-gps-navigation-landing-page.html

Thanks but this dosen’t include any reference of how to make the code of python…
Please help regarding any library you know or anything

I suggest you read specifically this one:
https://ardupilot.org/copter/docs/common-vio-tracking-camera.html

Non GPS navigation is not an easy task, be prepared to invest time and dedication

You are not getting me…I will use gps in my second prototype but for now i just wanna check that how my drone will work on piece of code…Just i have to do that
Takeoff and gain a height
then Hover in the air for 5 to 10 seconds
and then land…Just this

I think you need to understand that you cannot get into guided mode if you don’t have a localization system working.
Alternatively you can do (what we don’t recommend) RC override and operate the vehicle in Open Loop and blindly command the system to fly in the unknown… good luck :wink:

yah exactly that what i wanna do boss…
Now,please can you tell me how can i do RC override with a piece of python code…which library should i use??please help

Open loop with python is very dangerous. If you don’t understand why open loop using a keyboard is very bad, then you really really need to gain more experience.

The safe and simple solution is:

  • get a GPS
  • use dronekit in guided mode
  • mode guided
  • arm throttle
  • takeoff 10
  • mode land

That’s It. once that works you can thing about non-GPS operation, but not before.

1 Like

I understand the risk buddy…See we are doing some kind of research here and so we need to do this…we’re doing it in very secure and safe manner…
Please help…
:innocent:

dronekit should be able do this. You will need to takeoff in stabilize mode and have a lot of spare parts. You will crash the copter often.

1 Like

I’ve tried using dronekit…it is able to arm the throttle but unable to takeoff…and i don’t want to use GPS at any cost…
btw i’ve all the spare parts… :wink:

Good luck, keep us posted of your results. I will not try to use dronekit in stabalize mode with one of my copters, so I can not help you there.

1 Like

Sure will share you the flight video and by the way thanks :wink:

I have not used dronekit in a while but you should be able to use pymavlink or MAVROS or anything really that sends MAVLINK commands. What you are doing is sending mavlink commands so, once you can think in terms of that, the library you use shouldn’t really be an issue. Here’s a bunch of links to get you going:
https://mavlink.io/en/messages/common.html#mavlink-common-message-set

https://ardupilot.org/dev/docs/mavlink-commands.html

and
https://ardupilot.org/copter/docs/common-non-gps-navigation-landing-page.html#common-non-gps-navigation-landing-page

https://ardupilot.org/copter/docs/ac2_guidedmode.html#guided-nogps

I have never tried Guided-noGPS but, according to the docs, you should be able to send an attitude target via a SET_ATTITUDE_TARGET mavlink messsage, leaving the control problem of achieving the attitude to the Pixhawk.