Mission Planning - Dronekit

Hello everyone I want to run a mission using the dronekit , I have some files/mission that I created using mission planner . is there a way or code I can use to do that task ?

I was trying to download the examples folder on the dronekit website but it would not work for me . i was hoping maybe there is another solution .

I seen a source code from github, but that seems to like I would have to put in all the information i want so I didn’t know if that was the most simplest of solutions .

Thanks for the help!

Kevin,

So to make sure we are on the same page. You want to take the mission you built in Mission Planner and run it with your droneKit script?

Do you have a script you have already started? If this is what you are trying to do, I have done, just need to see your code so I can tell you where to put it in.

yes correct , and I have a one script that helps connect to the vehicle , I’m not sure if it can be added to this
Thank you for your help

Yeah I got it. Give me until tonight or tomorrow to break it down for you.

Hi Kevin,

I think you can just upload the mission to the autopilot using Mission Planner. Then you can access to the waypoints from dronekit using:

vehicle.commands

And to start the mission you only need to have the vehicle armed and change the mode to auto from the dronekit script.

In this example you can see some code from Dronekit explaining how to do a basic mission:

https://dronekit-python.readthedocs.io/en/latest/examples/mission_basic.html

Hope it helped

2 Likes

okay that would be great ! thank you I appreciate that

Kevin,

This isn’t great but I am short on time this week. It will take a couple hours of doing for me to dig back into my script and figure out all the variables differences and what not. I don’t know how experienced you are with python but hopefully this can serve as a basis for you start figuring it out. If you can tell me exactly what you are trying to do I might maybe be able to build you a working script sometime next week.

waypoint_upload_dronekit.txt (5.0 KB)

My recommendation however, is to grab some coffee and dedicate a couple days to the dronekit documentation and figuring it out. It took me a couple weeks to get it figured out but its definitely worth it. I also did mine on my raspberry pi which I recommend as well.

Below are links to the resources I used. I built a GUI for my rover so that I may record waypoints while driving the rover manually. Then I can upload and set the mission to the pixhawk. All done with a simple GUI on the RPi which I built a cyberdeck for with a touchscreen. I’m not quite sure I’m ready to give up that entire script yet. Mainly because I’m still working on it and when I let it go I want it to be plug and play.

Ask questions from here and I will try to help when I can.

Thanks,
River


https://dronekit-python.readthedocs.io/en/latest/examples/mission_import_export.html

Best course on python ive found on udemy:
https://www.udemy.com/share/103IHMA0USc1ZTTX4=/

Albert’s advice is the simplest and most straight forward.

okay, I will take a deeper look into this , thank you for the insight , if i have some questions i will reach back out

yeah I’m new to working with python but def trying to get more and more familiar with if.
I know I was able to connect to the vehicle without having mission planner open so i wondering if i can do a mission without having to open mission planner as well or maybe even i can get the car to go to a point A to a point B put putting in some coordinates .

I will def take a look into what you sent and play around with it , I appreciate it ! if you have the time still can work on script for me I will for certain appreciate that .
I will be reaching back out to you if I have any questions , thanks for your time

question, does mission planner need to be open when running the code or can you run without it ?

A script is like directly writing instructions for the autopilot to follow. No it does not have to be open, though. Keep researching and studying the dronekit documentation. I can see you need a better understanding of how everything works here. Did you watch the drone dojo video? And study the rover docs some more too. You do know you don’t even have to write a script to make the autopilot work right? You can start using only Mission Planner.

I know where you are at right now and the answers to your questions are out there. So keep pushing forward.

Yeah I know, my professor that wants me to do this project is very adamant on me doing it without having Mission planner open so that’s why i been try write a script for it

Yes I watched the video, it did help a lil bit, gave me some more clarity I been snuck on actually arming the vehicle, beside that the code seems to be working properly, just stuck in the loop right now since the vehicle is not armable but that’s probably another issue

oof, yeah. Academics is a sure way to make things more complex than they need to be.

Probably pre-arm checks getting in your way. Get on MP and see if it will arm without pre-arm errors coming up. If they do, see what they are and fix them. Arming the vehicle should be a as simple as vehicle.armed = False

You can bypass all pre-arms by changing parameters but I don’t recommend it.

Are you using a companion computer? Like Raspberry Pi?

Also, what do you need the vehicle to do? What is the mission?

I’m using a pixhawk ,and i just need the vehicle to drive one point to another , something simple just to show him that the method works