@dr_aerospace on Dragonfly Control Software
I made a program, written in the KerboScript language, to autonomously control a replica of NASA’s Dragonfly mission (or any kind of rotorcraft) in Kerbal Space Program. Aside of selecting your target altitude or waypoint, the script is designed to be completely independent of human interaction. To use this program, you will need a ship with rotors that can maneuver in any direction and a kOS-enabled probe core. The script also integrates with the SCANsat mod to show the user telemetry and ETA data in the terminal (you can still use the script if you don’t have the SCANsat mod). The program’s flight profile divides into four main stages Liftoff, Cruise, Approach, and Landing. Each one of these has its own variables, loops, conditionals, and triggers. The script’s flow is designed to move on with each stage in an orderly manner. Each stage also has controls for altitude, pitch, and throttle depending on which stage is the code running. Besides the main control functions, the script also has two safety function to prevent crashes or rolling down slopes. The first one of this functions is Landing Abort. This function activates the exact second the drone lands and checks for five seconds if its pitch or roll exceed dangerous angles. If so happens, the script will take off rapidly, fly in a straight line for 30 seconds, and attempt to land again. If the drone lands in stable ground, it simply understands that it landed in safe ground and that landing abort is not needed. The other safety function is called the Safe Altitude Maintenance. This function executes with every refresh of the Cruise loop, and checks if the drone is within its target altitude margin and the distance to the ground goes below 500 meters. If that occurs, the drone accelerates to climb and maintain a 500 meter distance to the ground. When the drone returns to its target altitude margin and the distance to the ground becomes greater than 500, it returns to its normal Cruise mode. This is especially useful when flying at low altitude and near mountainous regions. After the drone lands and confirms it is safely leveled, it activates the Scientific Analysis Sequence. This sequence is composed by PRINT, action group, and WAIT commands. The main idea of this function is that it is completely customizable; this way, the user can select which instruments activate at what time. Also, there is another function that, in a fraction of a second, activates only one action group just after the Cruise loop’s conditionals are fulfilled and before the Approach loop activates. The objective is to place either telemetry or barometric scans while the drone is airborne. The objective of this script is to make powered flight in KSP rather an autonomous, stress-free experience. Any KSP player, from newbie to experienced can use the script to automate planet exploration.
- 8 devlogs
- 35h
- 12.24x multiplier
- 515 Stardust