Drone auto take off without rc/gcs input after changing the battery

Hello everyone!!
I want to do the follwoing using pixhawk4 and mission planner.

Once the battery failsafe is triggered in between a mission, the mission should get resume or start takeoff automatically and go to the last break point without any input from Mission planner or Transmitter AFTER REPLACING THE BATTERY.

Is there any parameter availablle on mission planner to achieve the above scenario.

OR, Is there any other way to achieve the above using the on board computer like raspbberry pi?
I am looking forward to your valuable reply.

Keep the flight controller powered while changing the battery. This can easily be done by connecting power to the USB port.

1 Like

Thank you very much for a reply Dave.

But the Drone should take off automatically and go to the last waypoint and continue the mission without arming again from TX or Mission planner after changing the battery.

Will it happen? If I keep the flight controller power ON even when the battery is getting swapped automatically.

( Battery changing also automated by battery swapping machine)

Normally we arm the drone and put into auto mode using the the TX or GCS.

In my case at the beginning only I will setup everything and arming, changing the flight mode into auto mode, then when the battery failsafe triggered during the mission drone will come to the Docking station, battery change will happen then the Drone also should take off automatically and continue the mission.

With available Mission Commands no. I think the closest you could come to that would be to not trigger from Battery Failsafe but define a Landing point in the Mission where the Charging station is with a delay before another Takeoff. I have run Missions like this before. You do have to disable Auto Disarm or at least set the duration longer than the charge event.

Beyond that I suppose you are into a Companion Computer for more sophistication.

You could do this through lua scripting but you’d need to be running 4.1 beta for that. The script could monitor battery voltage or capacity remaining and when they hit a set value it could read the current mission progress, remove completed commands and create a new mission with the non-completed commands. You’d have to get the script to switch to another mode such as guided and then back to auto for the new mission to execute. You can set auto take off without arming/throttle input in automode on copter 4.1 now too.

Thanks Dave.
I think I have to go for some microcontroller.

But I am not good at any programming language.

Please let me know if there is anything else I can do to achieve my goal.

Thanks for getting back to me Yasin.
Could you guide me on writing the script or any tutorial video where I can watch and learn it.

I am not good at programming any programming language.

Or to write this script what should I have to learn?

Please let me know.


Have a look at the LUA examples folder in the github repo for ardupilot here: https://github.com/ArduPilot/ardupilot/tree/master/libraries/AP_Scripting/examples

I’d recommend running them in SITL first before running them on your copter

1 Like

You have to learn LUA, simple as that. Google “LUA Programming” and get to it…

1 Like

Okay Dave,
Thanks again.