Project Autopilot ScriptMFD by Thunder Chicken

Thunder Chicken

Fine Threads since 2008
Donator
Joined
Mar 22, 2008
Messages
4,346
Reaction score
3,273
Points
138
Location
Massachusetts
Hello all,

This is an initial beta release of my ScriptMFD Autopilot suite. It was developed under Orbiter 2016 on Linux. If folks could give it a try with their different vessels and OS and give me their feedback it would be much appreciated. If I can get it polished up enough I'll release it on Orbiter Hangar.

Autopilot ScriptMFD by Thunder Chicken revision 2.
January 27, 2024

Installation

1. Extract zip file to Orbiter directory
2. In Orbiter Launchpad, under Modules, activate ScriptMFD

Operation

There are four main autopilot functions:

1. SPD - Airspeed autopilot.

This autopilot will manage the main engine throttles in order to maintain a target airspeed.
  • The target airspeed (in m/s) can be set manually using:
    • +C/-C buttons to increase/decrease in 100 m/s increments
    • +10/-10 buttons to increase/decrease in 10 m/s increments
    • +1/-1 buttons to increase/decrease in 1 m/s increments
  • Enable the target airspeed autopilot by clicking Engage (ENG) button.
  • Current airspeed hold can be engaged by clicking Hold (HOL) button.
  • Disable the airspeed autopilot by clicking Release (REL) button.
  • Return to the main menu by clicking Menu (MNU) button.
2. CRD - Coordinate autopilot

This autopilot automatically coordinates the atmospheric flight of vessels with rudder control surfaces. It will yaw the vessel left/right to align the z-axis with the relative wind.
  • Enable the coordinate autopilot by clicking Engage (ENG) button.
  • Disable the coordinate autopilot by clicking Release (REL) button.
  • Return to the main menu by clicking Menu (MNU) button.
3. ALT - Altitude autopilot

This autopilot will manage the elevator control surfaces to maintain a certain vertical airspeed to climb or descend to a set altitude target

  • The target altitude (in m) can be set manually using:
    • +.1/-.1 buttons for hundreds of meters
    • +1/-1 buttons for thousands of meters
    • +10/-10 buttons for tens of thousands of meters.
  • Enable the target altitude autopilot by clicking Engage (ENG) button.
  • Current altitude hold can be engaged by clicking Hold (HOL) button.
  • Disable the altitude autopilot by clicking Release (REL) button.
  • Return to the main menu by clicking Menu (MNU) button.

4. HDG - Heading autopilot

This autopilot will manage the aileron control surfaces to bank vessel to a particular heading target. The NAV and WPT heading autopilots calculate the bearing to a given VOR or waypoint marker. This calculation continuously updates the bearing between the vessel and the waypoint and will fly the vessel along the great circle route to the waypoint.

* The heading target (in degrees) can be set manually using:
+1/-1 buttons for single degrees
+10/-10 buttons for tens of degrees
  • Enable the target heading autopilot by clicking Engage (ENG) button.
  • Current heading hold can be engaged by clicking Hold (HOL) button.
  • Disable the heading autopilot by clicking Release (REL) button.
  • NAV will set heading to VOR input in the NAV1 radio in the COM/NAV stack
  • WPT allows user to set heading by selecting through a list of waypoints extracted from the Cities.mkr and Islands.mkr markers using UP/DN buttons.
  • Return to the main menu by clicking Menu (MNU) button.

Notes

These autopilots are intended for used for vessels in atmospheric flight on Earth that have defined elevator, rudder, and aileron control surfaces and a main engine defined. The proportional-integral-derivative (PID) control gains have been tuned for fighter-type aircraft with realistic aerodynamic models, vessel mass, and primary moments of inertia (PMI). It works for Delta-Glider variants below about Mach 2, but the DG is rather massive and so it tends to overshoot in pitch and roll somewhat.

Revisions

Revision 0 - 01152024 initial beta release

Revision 1 - 01182024 bug fixes for issues #1 and #2 and read/write of autopilot states to scenario files enabled for Orbiter 240117 and later.
Revision 2 -01272024 bug fix for issue #3, incrementing of airspeed, and added autopilot status panel to menu screen. Tweaked proportional gain for heading autopilot so chonky DeltaGlider doesn't overshoot in roll so much.

Bugs / Issue List
  1. Marker files are different in OpenOrbiter 240105 and Orbiter 2016. [Fixed Revision 1]
  2. Pressing HOL in HDG mode crashes Orbiter when stationary. [Fixed Revision 1]
  3. Autopilot flight control settings seem to remain at last commanded position when autopilot released. [Fixed Revision 2]
Feature Requests
  1. Allow different autopilot functions to be opened on different MFD displays.
  2. Allow incrementing of airspeed in same manner as altitude. [Added Revision 2]
  3. Find quicker/easier way to select marker waypoints.

Enjoy! Post to this thread with any concerns.

Thunder Chicken
 

Attachments

  • Autopilot ScriptMFD by Thunder Chicken rev 2.zip
    9.1 KB · Views: 6
Last edited:

Thunder Chicken

Fine Threads since 2008
Donator
Joined
Mar 22, 2008
Messages
4,346
Reaction score
3,273
Points
138
Location
Massachusetts
Some additional notes:

Autopilot States and Scenario Files


Autopilot states currently cannot be read or written to scenario files in Orbiter 2016 because the necessary read-write APIs haven't been implemented in the LuaInterpreter.dll. However, kuddel has implemented these methods in OpenOrbiter and these hopefully will be updated in future releases of Open Orbiter soon.


Right now, readstatus(scn) and writestatus(scn) callbacks are enabled, but the read/write code in them using the anticipated read-write APIs has been commented out. If these methods are updated in Open Orbiter, simply removing these block comments should enable storing states to the scenario files.

Heading Autopilot Waypoint Bearings

The NAV and WPT heading autopilots calculate the bearing to a given VOR or waypoint marker.


This calculation continuously updates the bearing between the vessel and the waypoint and will fly the vessel along the great circle route to the waypoint.
 

Matias Saibene

Development hell
Joined
Jul 7, 2012
Messages
1,051
Reaction score
630
Points
128
Location
Monte Hermoso - Argentina
Website
de-todo-un-poco-computacion-e-ideas.blogspot.com.ar
Hello all,

This is an initial beta release of my ScriptMFD Autopilot suite. It was developed under Orbiter 2016 on Linux. If folks could give it a try with their different vessels and OS and give me their feedback it would be much appreciated. If I can get it polished up enough I'll release it on Orbiter Hangar.

Autopilot ScriptMFD by Thunder Chicken version 0.
January 15, 2024

Installation

1. Extract zip file to Orbiter directory
2. In Orbiter Launchpad, under Modules, activate ScriptMFD

Operation

There are four main autopilot functions:

1. SPD - Airspeed autopilot.

This autopilot will manage the main engine throttles in order to maintain a target airspeed.

  • The target airspeed (in m/s) can be set manually using +/- buttons.
  • Enable the target airspeed autopilot by clicking Engage (ENG) button.
  • Current airspeed hold can be engaged by clicking Hold (HLD) button.
  • Disable the airspeed autopilot by clicking Release (REL) button.
  • Return to the main menu by clicking Menu (MNU) button.

2. CRD - Coordinate autopilot

This autopilot automatically coordinates the atmospheric flight of vessels with rudder control surfaces. It will yaw the vessel left/right to align the z-axis with the relative wind.

  • Enable the coordinate autopilot by clicking Engage (ENG) button.
  • Disable the coordinate autopilot by clicking Release (REL) button.
  • Return to the main menu by clicking Menu (MNU) button.

3. ALT - Altitude autopilot

This autopilot will manage the elevator control surfaces to maintain a certain vertical airspeed to climb or descend to a set altitude target

* The target altitude (in m) can be set manually using:
+.1/-.1 buttons for hundreds of meters
+1/-1 buttons for thousands of meters
+10/-10 buttons for tens of thousands of meters.
  • Enable the target altitude autopilot by clicking Engage (ENG) button.
  • Current altitude hold can be engaged by clicking Hold (HLD) button.
  • Disable the altitude autopilot by clicking Release (REL) button.
  • Return to the main menu by clicking Menu (MNU) button.

4. HDG - Heading autopilot

This autopilot will manage the aileron control surfaces to bank vessel to a particular heading target.

* The heading target (in degrees) can be set manually using:
+1/-1 buttons for single degrees
+10/-10 buttons for tens of degrees
  • Enable the target heading autopilot by clicking Engage (ENG) button.
  • Current heading hold can be engaged by clicking Hold (HLD) button.
  • Disable the heading autopilot by clicking Release (REL) button.
  • NAV will set heading to VOR input in the NAV1 radio in the COM/NAV stack
  • WPT allows user to set heading by selecting through a list of waypoints extracted from the Cities.mkr and Islands.mkr markers using UP/DN buttons.
  • Return to the main menu by clicking Menu (MNU) button.

Notes

These autopilots are intended for used for vessels in atmospheric flight on Earth that have defined elevator, rudder, and aileron control surfaces and a main engine defined. The PID controls have been tuned for fighter-type aircraft with realistic aerodynamic models, vessel mass, and PMI. It works for Delta-Glider variants below about Mach 2, but the DG is rather massive and so it tends to overshoot in pitch and roll somewhat.

Revisions

Verion 0 - initial beta release

Enjoy! Send your feedback to Thunder Chicken at the Orbiter Forums.

Thunder Chicken
At first glance, it worked like magic on OpenOrbiter on Linux using Wine. However it does not load in Orbiter for native Linux.

I'm going to continue testing it and report in this thread.
 

Thunder Chicken

Fine Threads since 2008
Donator
Joined
Mar 22, 2008
Messages
4,346
Reaction score
3,273
Points
138
Location
Massachusetts
At first glance, it worked like magic on OpenOrbiter on Linux using Wine. However it does not load in Orbiter for native Linux.

I'm going to continue testing it and report in this thread.
Is Orbiter for native Linux another Orbiter fork? If you can point me to it I can take a look at what is happening. I've been mostly working with stock Orbiter 2016 under Wine.
 

Matias Saibene

Development hell
Joined
Jul 7, 2012
Messages
1,051
Reaction score
630
Points
128
Location
Monte Hermoso - Argentina
Website
de-todo-un-poco-computacion-e-ideas.blogspot.com.ar
Is Orbiter for native Linux another Orbiter fork? If you can point me to it I can take a look at what is happening. I've been mostly working with stock Orbiter 2016 under Wine.
Orbiter for native Linux (a.k.a XOrbiter) is being developed by @Gondos and works quite well on Linux, I use it to compile my add-ons because I can't stand the slowness of Winslow+Vislow Studio.
https://www.orbiter-forum.com/threads/linux-playground.40476/

However Orbiter.log is not yet implemented as far as I know. But I'm going to investigate, maybe it's a permissions problem.
 

Thunder Chicken

Fine Threads since 2008
Donator
Joined
Mar 22, 2008
Messages
4,346
Reaction score
3,273
Points
138
Location
Massachusetts
Orbiter for native Linux (a.k.a XOrbiter) is being developed by @Gondos and works quite well on Linux, I use it to compile my add-ons because I can't stand the slowness of Winslow+Vislow Studio.
https://www.orbiter-forum.com/threads/linux-playground.40476/

However Orbiter.log is not yet implemented as far as I know. But I'm going to investigate, maybe it's a permissions problem.
Is it available as a compiled download, or does the user have to build it themselves? Does it have a Lua interpreter capability?

I'm probably not going to be chasing to get my autopilots functional on a flavor of Orbiter that needs to be built.
 

Thunder Chicken

Fine Threads since 2008
Donator
Joined
Mar 22, 2008
Messages
4,346
Reaction score
3,273
Points
138
Location
Massachusetts
One issue that I just ran into using OpenOrbiter is that it doesn't have the same marker files as Orbiter 2016 and so the script may crash.

In Orbiter 2016 the necessary marker files are:

/Orbiter 2016/Config/Earth/Marker/Cities.mkr
/Orbiter 2016/Config/Earth/Marker/Islands.mkr

OpenOrbiter (build 240105) only has the following file, which is not titled the same:

/Orbiter 2016/Config/Earth/Marker/City.mkr

I'm not sure why these files were altered in OpenOrbiter. I am having a hard time running OpenOrbiter - it is really really slow and choppy and terrain graphics are badly broken. Orbiter 2016 runs just about perfectly under Wine for me, but OpenOrbiter struggles.

EDIT: I filed an issue in GitHub asking about why these files are different.

 
Last edited:

Matias Saibene

Development hell
Joined
Jul 7, 2012
Messages
1,051
Reaction score
630
Points
128
Location
Monte Hermoso - Argentina
Website
de-todo-un-poco-computacion-e-ideas.blogspot.com.ar
Is it available as a compiled download, or does the user have to build it themselves? Does it have a Lua interpreter capability?

I'm probably not going to be chasing to get my autopilots functional on a flavor of Orbiter that needs to be built.
It is not available pre-compiled. You have to compile it. But anyway I'm not sure Lua is fully implemented in XOrbiter.
 

misha.physics

Well-known member
Joined
Dec 22, 2021
Messages
394
Reaction score
513
Points
108
Location
Lviv
Preferred Pronouns
he/him
@Thunder Chicken, unfortunately I can't try your Autopilot with OpenOrbiter build x32 on my Windows yet. I copied (with replacement) your files into my Orbiter directory and activated the ScriptMFD module. But running your scenario "DG-S at KSC Autopilot Example" leads to a crash during loading. And if I'm loading another scenario and trying to open the Autopilot MFD I get a crash too. I don't know if my Orbiter.log can help, but I attaches it.

WINE is mentined in my log file, maybe some changes should be made with your script for Windows.
 

Attachments

  • Orbiter.log
    8.2 KB · Views: 2
Last edited:

Matias Saibene

Development hell
Joined
Jul 7, 2012
Messages
1,051
Reaction score
630
Points
128
Location
Monte Hermoso - Argentina
Website
de-todo-un-poco-computacion-e-ideas.blogspot.com.ar
@Thunder Chicken, unfortunately I can't try your Autopilot with OpenOrbiter build x32 on my Windows yet. I copied (with replacement) your files into my Orbiter directory and activated the ScriptMFD module. But running your scenario "DG-S at KSC Autopilot Example" leads to a crash during loading. And if I'm loading another scenario and trying to open the Autopilot MFD I get a crash too. I don't know if my Orbiter.log can help, but I attaches it.

WINE is mentined in my log file, maybe some changes should be made with your script for Windows.
Line 81 of your Orbiter.log:
Code:
000231.428: BaseObject: Parse error

Apparently it's the same bug that ThunderChicken found. I think it would be a good idea to copy Cities.mkr and Islands.mkr from Orbiter 2016 to OpenOrbiter. This is how I have it in my installation and it works perfectly.
One issue that I just ran into using OpenOrbiter is that it doesn't have the same marker files as Orbiter 2016 and so the script may crash.

In Orbiter 2016 the necessary marker files are:

/Orbiter 2016/Config/Earth/Marker/Cities.mkr
/Orbiter 2016/Config/Earth/Marker/Islands.mkr

OpenOrbiter (build 240105) only has the following file, which is not titled the same:

/Orbiter 2016/Config/Earth/Marker/City.mkr

I'm not sure why these files were altered in OpenOrbiter. I am having a hard time running OpenOrbiter - it is really really slow and choppy and terrain graphics are badly broken. Orbiter 2016 runs just about perfectly under Wine for me, but OpenOrbiter struggles.

EDIT: I filed an issue in GitHub asking about why these files are different.

 

Thunder Chicken

Fine Threads since 2008
Donator
Joined
Mar 22, 2008
Messages
4,346
Reaction score
3,273
Points
138
Location
Massachusetts
I can see what I can do to get the script to read whatever marker file is available. I don't know why they were changed going from Orbiter 2016 to OpenOrbiter. I'd like to know why just so I understand what changed in the Open Orbiter dependencies. As far as I can tell those markers are just used for the bases in the Map MFD.
 

Thunder Chicken

Fine Threads since 2008
Donator
Joined
Mar 22, 2008
Messages
4,346
Reaction score
3,273
Points
138
Location
Massachusetts
Getting Lua to look through the Config/Earth/Markers folder to find all the different marker files isn't happening without installing special libraries, and every user of this add-on would have to have those libraries to use it. I think the least painful way would be to simply check for all of the default marker file names found in all versions of Orbiter and load the ones that are found.
 

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
2,064
Reaction score
507
Points
113
As far as I can remember (long time ago) the Markers have been incorporated into the binary, packed, "Archive" structure in the Textures Folder (for example .\Textures\Earth\Archive\Label.tree)

This has to do with performance considerations as reading those Text-files is not the fastest way to do.

And just before you ask... I will not provide a Lua interface for that ;)
 

misha.physics

Well-known member
Joined
Dec 22, 2021
Messages
394
Reaction score
513
Points
108
Location
Lviv
Preferred Pronouns
he/him
@Thunder Chicken, thanks for these scripts. I have some suggestions and results of some my tests.

1) It would be nice to add the buttons description and hotkeys like it's for other MFDs (MNU key (at the bottom) activates this):

Без імені.png

So, it would be very nice to add hotkeys for all buttons, for example, hotkeys for+/- buttons (Shift +/Shift -) to avoid clicking the mouse button. It will be very convenient. A while ago I mentioned such feature request for the standard DGs autopilot:
4) Adding keyboard hotkeys/hotkeys combinations for DG's autopilot: activate/tuning, etc:

2) I noticed some instability. I setted airspeed=300 m/s, engaged it, then released, but my DG behaved as if the autopilot was working, it swayed from side to side. The behaviour was just like the Auto-coordination engaged, but I didn't enabled other autopilots.

3) It's a problem (or feature) when this Autopilot MFD is open on two MFDs. Try to make this:

Без імені3.png

and then click MNU on the left and see what's happening. But if you close these two MFDs and open only one, then it works good. So, those two MFDs are not completely synchronized with each other.

4) I get a crash when I click on HOL in the HDG mode.

5) Maybe you have to replace the command name HOL with HLD in the SPD, ALT and HDG mode.

6)
to maintain a certain vertical airspeed
But we can't set this vertical airspeed for now, isn't it?

7) It would be nice to add different change steps for SPD mode like for the ALT mode.

8) Do CRD mode only work when Atmospheric wind effects is enabled? Sadly I don't quite understand how this mode works.

9) What are the PID and PMI you mentioned in Notes, namely what is it?
 
Last edited:

Thunder Chicken

Fine Threads since 2008
Donator
Joined
Mar 22, 2008
Messages
4,346
Reaction score
3,273
Points
138
Location
Massachusetts
@Thunder Chicken, thanks for these scripts. I have some suggestions and results of some my tests.

1) It would be nice to add the buttons description and hotkeys like it's for other MFDs (MNU key (at the bottom) activates this):

View attachment 36457
So, it would be very nice to add hotkeys for all buttons, for example, hotkeys for+/- buttons (Shift +/Shift -) to avoid clicking the mouse button. It will be very convenient. A while ago I mentioned such feature request for the standard DGs autopilot:
I am new to MFDs and organizing the nested pages is something I am learning, as are hotkeys. I'm sure the organization could be better.
I'll put it these on the to-do list.
2) I noticed some instability. I setted airspeed=300 m/s, engaged it, then released, but my DG behaved as if the autopilot was working, it swayed from side to side. The behaviour was just like the Auto-coordination engaged, but I didn't enabled other autopilots.
I'm not sure why this would occur. The CRD autopilot would not toggle on with anything related to the airspeed autopilot. Were you maneuvering, climbing, descending?
3) It's a problem (or feature) when this Autopilot MFD is open on two MFDs. Try to make this:

View attachment 36460

and then click MNU on the left and see what's happening. But if you close these two MFDs and open only one, then it works good. So, those two MFDs are not completely synchronized with each other.
This is probably another issue with my understanding how to render multiple page MFDs. I see that the button mappings do not change. When you press the buttons, you get the commands for the other page. Yuck.. that definitely needs a fix.
4) I get a crash when I click on HOL in the HDG mode.
Under what circumstances? I have not seen this happen.
5) Maybe you have to replace the command name HOL with HLD in the SPD, ALT and HDG mode.
I see no reason why the button label would have any affect on anything.
6) But we can't set this vertical airspeed for now, isn't it?
Right now, no. It maxes out at 20 m/s which is nearly 4000 ft/min. The vertical speed goes to zero as the vessel approaches the target altitude. How quickly a vessel can climb depends on its thrust-to-weight ratio and its flight velocity.
7) It would be nice to add different change steps for SPD mode like for the ALT mode.

8) Do CRD mode only work when Atmospheric wind effects is enabled? Sadly I don't quite understand how this mode works.
Coordinated flight is when there is no sideslip i.e. the vessel will always be pointed into the relative wind during turns and maneuvering.


If you manually fly the DG to an altitude and bank it, you will see that the vessel does not point directly at the relative speed marker. If you engage CRD at that time you will see the rudder input that will yaw the vessel to the marker.

These autopilots are for atmospheric flight. No testing is done to determine if there is an atmosphere.
9) What are the PID and PMI you mentioned in Notes, namely what is it?
PID = Proportional Integral Derivative gains for the control responses.
PMI = Primary Moments of Inertia of the vessel.
 

misha.physics

Well-known member
Joined
Dec 22, 2021
Messages
394
Reaction score
513
Points
108
Location
Lviv
Preferred Pronouns
he/him
Thanks for the explanations of the sideslip.
I'm not sure why this would occur. The CRD autopilot would not toggle on with anything related to the airspeed autopilot. Were you maneuvering, climbing, descending?
I was trying to repeat this effects, but it haven't happened again, although earlier I noticed it a couple of times, namely a vessel swayed from side to side just after released the SPD autopilot, and I couldn't stabilize the vessel. It looked like the rudders are working from left to right and from right to left as if someone is controlling these rudders. But now I couldn't repeat this.
When you press the buttons, you get the commands for the other page.
Yes, I meant exactly this.
Under what circumstances? I have not seen this happen.
I'm just launching a default scenario Quickstart, taking off on the DG, turning on Autopilot MFD, pressing HDG, pressing HOL, and after this getting a crash to desktop without of reopening Launchpad window. I'm attaching the log just after this crash. Orbiter 2016. Those two *.mkr files are presented in my directory.
I see no reason why the button label would have any affect on anything.
I meant it was probably just a misprint of the button label (HOL instead of HLD).
 

Attachments

  • Orbiter.log
    6 KB · Views: 1
Last edited:
Top