Jump to content

[1.12.x] Kramax Autopilot Continued: Course guidance and auto-land for spaceplanes


linuxgurugamer

Recommended Posts

This is a continuation of the older Kramax Autopilot.  

The new version for KSP 1.4.1 has new dependencies

New Dependencies

CKAN has been updated to install the dependencies, if needed.

Download from: http://spacedock.info/mod/1019/Kramax Autopilot Continued

Source code:  https://github.com/linuxgurugamer/KramaxAutoPilot

License:  CC-NC-SA-4.0

The following is from the old thread:

Sample Flight Video

Kramax Autopilot

Recently I started flying spaceplanes in Kerbal and discovered I could never land them successfully. My keyboard flying skills are sub-par. This despite being an instrumented rated pilot of real planes.

I found a very good autopilot mod by Crzyrndm called "Pilot Assistant" (see thread). But it did not have any course following abilities. I have taken the source code for Pilot Assistant and heavily modified it to add course guidance (both horizontal and vertical) so that it can autoland a spaceplane on the KSC runway. Many thanks to Crzyrndm--this mod would never have happened without the excellent starting point. Note that I did not keep all the capabilities of Pilot Assistant--I was very focused on auto-landing and things that were not really needed for that were omitted.

Flight plans can be loaded from configuration files located in the GameData folder. There is currently no capability to create new flight plans on the fly within the game, but you can edit the GameData/KramaxAutoPilot/FlightPlans.cfg file and add flight plans that way. Look at GameData/KramaxAutoPilot/DefaultFlightPlans.cfg for the format of the flight plans. The "Refresh" button on the flight plan load/save dialog will reload from that file so you do not have to restart the game every time you change a flight plan.

Basic Instructions

You can use the autopilot to depart from KSC runway 09 as well as land on it. Here is a basic flight using the autopilot. You start lined up on KSC RW09.

Departure

 

  • Show the autopilot window by selecting the airplane icon from your toolbar
  • Press the "Load/Store" button next to the "Flight Plan" button. This will display the flight plan loading window.
  • Select the plan named "KSC DEP 09". This is a flight plan that takes you straight out on a heading of 090 to space. You can close the flight plan loading window now.
  • Select the horizontal mode "NAV" and enable horizontal mode by selecting the button "Roll". The autopilot should track straight down the runway now.
  • I normally use "pitch hold" mode for vertical control on departure. You can set this up for use after rotation by selecting the "Pitch" button and entering a desired pitch up amount (10-30 degrees, depending on your thrust to weight ratio).
  • Start your takeoff. It should track down the runway and after you liftoff, turn the vertical mode autopilot on by pressing the "Target Pitch" button. It should pitch up to your preset pitch value. It should retract your gear at 150m of altitude.
  • Now just control pitch angle to what works for your vehicle. When you get to high altitude where aerodynamics more or less stops, you should turn off the autopilot modes by pressing the "Roll" and "Vertical" buttons.
  • Hopefully you get to orbit

 

Landing

 

  • You need to de-orbit. For KSC RW09, I found that when coming from an 80km orbit, a 100m/s retrograde burn just before I get to the huge impact crater seems to work well. Depending on how fast your craft decelerates you may need to burn slightly earlier or later.
  • Setup the autopilot by loading the landing flight plan. You want to open the flight plan load/save window and select "KSC ILS 09" (ILS stands for "instrument landing system"). This flight plan has an initial point to aim for that is named "MAXKY". It is at 12000m, more or less on the equator about 75km West of KSC.
  • Descend into the atmo and try to stay on a heading of 090. I generally enable the autopilot around 20000m altitude. I initially will enable it in Bank mode (level) and pitch hold mode (4 to 6 degrees).
  • As you near 12000m altitude enable NAV mode and altitude hold of 12000m.
  • When you get very close to MAXKY, enable GS mode to follow the vertical guidance.
  • Now setup your landing speeds. Open up the "Approach Speeds" pane at the bottom. Change the speeds to match your craft. You want to land as slow as possible, so make your final speed something that is a good margin above stall speed.
  • After passing MAXKY you can enable auto-throttle "Landing" mode to hold current speed and then decrease it to match the approach speeds as it heads for the next fixes.
  • At 500m (above ground) it should auto-lower your landing gear. But a good pilot makes sure he has 3-green before touching down! If all goes well it will cut your throttle right over the threshold, touchdown, and turn on max braking.

 

Attributions

This plugin is a heavily modified version of "Pilot Assistant" by Crzyrndm (https://github.com/Crzyrndm/Pilot-Assistant). At least half (if not more) of the code is his. Many thanks to him, as this would never have been possible without it. In addition, I drew heavily on algorithms for calculating great circle routes from http://www.movable-type.co.uk/scripts/latlong.html. Many thanks for that information.

License

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.

This work is a derivative of "Pilot Assistant" by Crzyrndm that was distributed under the same license. The original work was found athttps://github.com/Crzyrndm/Pilot-Assistant.

Edited by linuxgurugamer
Link to comment
Share on other sites

Hi LinuxGuruGamer,

 

did you take over the mod as a whole or do you just do maintenance for some time?

For I have a question... and a wish.

 

What I would like to know is, if the original mod on wich this autopilot is basing could be used together with this one.

And my wish is the folowing:

In the video at 8:22 the player hits the NAV-button. Since then a HSI-element appears just over the Nav-Ball.

And at 8:46 after hitting the GS-Button, a Glide-slope element appears on the right of the Nav-Ball.

What I would ask is, if you would do me a favor and cut out these two parts as a single little mod to use. Do you think this is possible and do you have the time and the fun doing so?

I would be very happy if so.

 

Thank you in advance,

- Isabelle

Link to comment
Share on other sites

what is the glide slope defined for this mod?  I use the PAPI mod and have it set to 3 but it tells me I am coming in too high with this mod.   I would like to either set the PAPI mod to match this glide slope, or even better have a way to edit the glide slope for this mod.

 

also when I hit the heading hold button it makes my plane bank and then hold this bank forever,  passing right by my desired heading over and over again.  it is like the heading button and the bank button are doing the same function.

 

and lastly could you integrate the WP list for this mod with Waypoint manager?  so the 2 are interchangeable?  or at least export your list to WPM so they will show up on the map.

 

 

Link to comment
Share on other sites

3 hours ago, Bit Fiddler said:

what is the glide slope defined for this mod?  I use the PAPI mod and have it set to 3 but it tells me I am coming in too high with this mod.   I would like to either set the PAPI mod to match this glide slope, or even better have a way to edit the glide slope for this mod.

 

also when I hit the heading hold button it makes my plane bank and then hold this bank forever,  passing right by my desired heading over and over again.  it is like the heading button and the bank button are doing the same function.

 

and lastly could you integrate the WP list for this mod with Waypoint manager?  so the 2 are interchangeable?  or at least export your list to WPM so they will show up on the map.

 

 

This mod disagrees with the glideslope of NavUtilities as well... although either way it seems to work out OK.  It seems like Kramax glideslopes are more on the order of 4-5 degrees whereas the PAPI and NavUtilities default at least to 3 degrees (as is common in the real world, although there's a 4+ degree glideslope on 16R at KVNY which gets interesting! :) ).
Also, and somewhat surprisingly since most autopilot mods don't do this, this works well with FAR.  In fact none of my spaceplanes will even fly correctly on stock aero I learned last night, so that's an important distinction... Hopefully Kerbinside will be back in business soon too, so we have places to land other than KSC :)

Link to comment
Share on other sites

yes my testing last night was great I love this autopilot mod.  I have tried others in the past, and while they may hold a course or a speed, they would never succeed in auto landing a plane of any sort.   this is on my must have mod list now. 

Link to comment
Share on other sites

on the topic of Kerbinside I really hope they make atleast an airstrip at each of the radio relays around Kerbin that the new not-remote tech-system uses.

 

 

EDIT: It has come to my attention that the stock WP system in 1.2 has been revamped such that mods like this one can easily use the Stock WP rather than their own internal WP database.  would this be possible for you to convert your WP system to use this new setup?  thus every mod that uses a WP can share the same set of points.

Edited by Bit Fiddler
Link to comment
Share on other sites

@linuxgurugamer, yes smartass was active while I was using kramax.  I just had the cruise control on, was flying the craft myself and all of a sudden the controls went dead and the craft stayed on trajectory.  Happened once when I was using ascent guidance on MJ as well.  I use Kramax to get to a certain altitude and then ascent guidance to take me the rest of the way...mainly because Im lazy.   I turned ascent guidance on before I turned kramax off...control freeze. Its not a huge issue to me...I just don't use MJ for anything when Kramax is on. 

 

On 10/26/2016 at 10:57 PM, Bit Fiddler said:

 

EDIT: It has come to my attention that the stock WP system in 1.2 has been revamped such that mods like this one can easily use the Stock WP rather than their own internal WP database.  would this be possible for you to convert your WP system to use this new setup?  thus every mod that uses a WP can share the same set of points.

Would this make it possible to set up WP flight plans on the fly and be sort of like the rover autopilot in mechjeb...click the map to set the WP and then set the altitude in a different window?

Link to comment
Share on other sites

18 minutes ago, bsooner77 said:

@linuxgurugamer, yes smartass was active while I was using kramax.  I just had the cruise control on, was flying the craft myself and all of a sudden the controls went dead and the craft stayed on trajectory.  Happened once when I was using ascent guidance on MJ as well.  I use Kramax to get to a certain altitude and then ascent guidance to take me the rest of the way...mainly because Im lazy.   I turned ascent guidance on before I turned kramax off...control freeze. Its not a huge issue to me...I just don't use MJ for anything when Kramax is on. 

You ended up with two autopilots conflicting with each other.  Nothing I can really do about that.

 

19 minutes ago, bsooner77 said:
On 10/26/2016 at 11:57 PM, Bit Fiddler said:

 

EDIT: It has come to my attention that the stock WP system in 1.2 has been revamped such that mods like this one can easily use the Stock WP rather than their own internal WP database.  would this be possible for you to convert your WP system to use this new setup?  thus every mod that uses a WP can share the same set of points.

Would this make it possible to set up WP flight plans on the fly and be sort of like the rover autopilot in mechjeb...click the map to set the WP and then set the altitude in a different window?

 

This would probably be a significant rewrite, which I'm not about to do at this time, sorry

Link to comment
Share on other sites

On 10/26/2016 at 1:23 PM, Bit Fiddler said:

also when I hit the heading hold button it makes my plane bank and then hold this bank forever,  passing right by my desired heading over and over again.  it is like the heading button and the bank button are doing the same function.

@linuxgurugamer Sorry for the delay.  Finally got my tech tree & complex upgrades completed and all of my necessary mods(*coughB9coughTweakscale*) installed to be able to launch my A380, and I've noticed the same.  Heading hold seems to be completely jacked.  Normally when you activate it, it automatically sets the target heading to whatever heading you're currently at.  Now, it just defaults at 0.00, and when you try to adjust it to anything, it banks the aircraft and doesn't seem to ever settle out at any particular heading.  NAV mode seems to work fine, though.  I've done a few KSC ILS 27 approach/landings with zero issues. 

Also, purely cosmetic, but the GS/NAV indicators are kinda huge relative to the default size of the navball.  I usually turn my navball down to around 80-90%, but then I could probably fit two navballs within that space inside the indicators.  Is there a simple way to scale these down a bit?

Link to comment
Share on other sites

Quote
20 hours ago, floydian022 said:

@linuxgurugamer Sorry for the delay.  Finally got my tech tree & complex upgrades completed and all of my necessary mods(*coughB9coughTweakscale*) installed to be able to launch my A380, and I've noticed the same.  Heading hold seems to be completely jacked.  Normally when you activate it, it automatically sets the target heading to whatever heading you're currently at.  Now, it just defaults at 0.00, and when you try to adjust it to anything, it banks the aircraft and doesn't seem to ever settle out at any particular heading.  NAV mode seems to work fine, though.  I've done a few KSC ILS 27 approach/landings with zero issues. 

Also, purely cosmetic, but the GS/NAV indicators are kinda huge relative to the default size of the navball.  I usually turn my navball down to around 80-90%, but then I could probably fit two navballs within that space inside the indicators.  Is there a simple way to scale these down a bit?

 

I second the stuff about the heading hold function...this has happened to me once as well.  No, I wasn't using 2 autopilots at the same time this go round. 

Link to comment
Share on other sites

14 hours ago, bsooner77 said:
Quote
On 10/31/2016 at 11:53 PM, floydian022 said:

@linuxgurugamer Sorry for the delay.  Finally got my tech tree & complex upgrades completed and all of my necessary mods(*coughB9coughTweakscale*) installed to be able to launch my A380, and I've noticed the same.  Heading hold seems to be completely jacked.  Normally when you activate it, it automatically sets the target heading to whatever heading you're currently at.  Now, it just defaults at 0.00, and when you try to adjust it to anything, it banks the aircraft and doesn't seem to ever settle out at any particular heading.  NAV mode seems to work fine, though.  I've done a few KSC ILS 27 approach/landings with zero issues. 

Also, purely cosmetic, but the GS/NAV indicators are kinda huge relative to the default size of the navball.  I usually turn my navball down to around 80-90%, but then I could probably fit two navballs within that space inside the indicators.  Is there a simple way to scale these down a bit?

 

I second the stuff about the heading hold function...this has happened to me once as well.  No, I wasn't using 2 autopilots at the same time this go round. 

Ok, I've opened a Github issue on this.

Just curious, did you see any errors in the logs?

14 hours ago, bsooner77 said:

Also, purely cosmetic, but the GS/NAV indicators are kinda huge relative to the default size of the navball.  I usually turn my navball down to around 80-90%, but then I could probably fit two navballs within that space inside the indicators.  Is there a simple way to scale these down a bit?

I also opened a github issue on this

Link to comment
Share on other sites

35 minutes ago, linuxgurugamer said:

Ok, I've opened a Github issue on this.

Just curious, did you see any errors in the logs?

I did not...but then again I wasn't looking...I don't know where to look. But, I'd be happy to test and look at if for you if you tell me what to do or point me to something with some instruction on where the logs are and what to look for in them. I'm not a programming wiz, but I pick up on things pretty quick.  Also, in the future, would you prefer us to open an issue on Github for things like this instead of posting it here?

Link to comment
Share on other sites

Just now, bsooner77 said:

I did not...but then again I wasn't looking...I don't know where to look. But, I'd be happy to test and look at if for you if you tell me what to do or point me to something with some instruction on where the logs are and what to look for in them. I'm not a programming wiz, but I pick up on things pretty quick.  Also, in the future, would you prefer us to open an issue on Github for things like this instead of posting it here?

Either way works.

for the log, just run the game and get it to fail the way you describe, then send me the entire output_log.txt file

Link to comment
Share on other sites

9 minutes ago, bsooner77 said:

Where is the output_log.txt file, in the KSP folder? 

Windows:  Kerbal Space Program\KSP_x64_Data\output_log.txt

OSX:         Kerbal Space Program/KSP_x64_Data/output_log.txt 

                  /home/(username)/.config/unity3d/Squad/Kerbal Space Program/Player.log

Linux:       /home/user/.config/unity3d/Squad/Kerbal Space Program/Player.log

Edited by linuxgurugamer
Link to comment
Share on other sites

Output log doesn't really seem to show that anything is happening at all, as far as I can see. Here's a snippet from the moment when I switch from NAV mode to Heading Hold mode and then set a target heading(for reference, I changed camera view to "Chase" immediately before switching modes in Kramax): 


 

Quote

 

[KRAMAX] GearHandler: raising gear at height 150.079788208008
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

[KRAMAX] FlightPlan.Update: time to turn (speed 159.526129216357, remain 15.6207956922162, timeToNext 0.0979199819424603, amount 0.3527099120777, rate 3, timeToTurn 0.117569970692567
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

[KRAMAX] SequenceWaypoint: go
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

[KRAMAX] SequenceWaypoint: current alt below prev alt, keep it
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

[KRAMAX] WayPointSequenced: -0.050185 20.9289803282443 50000 6
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

[KRAMAX] UpdateLandingMode: WayPoint KSC DOWNRANGE -0.050 20.929 50000m Active Vertical 
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

[KRAMAX] WayPointSequenced: autoland--not on approach yet
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

[KRAMAX] landingModeChanged: new mode None
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

[KRAMAX] HrztActive: NAV mode, invalid course guidance (NaN), skip setting.
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

[KRAMAX] UpdateData: marking course to WayPoint KSC DOWNRANGE -0.050 20.929 50000m Active Vertical  with dist 0.100359071734445 as valid
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

Camera Mode: FREE
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

Camera Mode: ORBITAL
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

Camera Mode: CHASE
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

[UIMasterController]: ShowUI
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

Game Paused!
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

Active Vessel is in atmosphere. Cannot save.
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

[FlightDriver]: Flight State Reverted to Prelaunch.

 

 

Link to comment
Share on other sites

  • 2 weeks later...

Just got a dev build of FAR installed, so had a chance to actually fly something... Kramax seems to be working correctly, although... it seems overcorrecting for certain things.. but that could be something going on with FAR, since that only happens with certain designs.  As far as Kramax itself.. heading hold is definitely broken and I cannot find anything else useful in the logs either ><  Following a flight plan still seems to work, as does altitude and pitch and bank and glideslope.  it's like it's literally only the NAV function that's broken.

Link to comment
Share on other sites

  • 2 weeks later...

@linuxgurugamer: As well as the heading hold issues mentioned above, I can't seem to get the nav function to work at all either. The "xtrk" display just flickers rapidly (often +- the same reading), and the aircraft settles into a gentle left bank plus some twitching. The OSD heading indicator works just fine. The bank controller is working fine too if I set a manual bank angle.
Modded (inc. FAR dev build), nothing interesting in the logs. Any ideas? I've used PA extensively in the past, but the nav function here is the main draw...

Link to comment
Share on other sites

On 30/11/2016 at 0:40 AM, linuxgurugamer said:

Please download and test again, and then get me the log files.

WRT not following waypoints: No change.
Log. (mods)

Well bugger me. Saved in flight, then restarted the game to get a clean (ish) log... and now it's working perfectly (so this log is useless).
Go to orbit, dock, undock, re-enter: Nav doesn't work (as mentioned previously).
Load a craft from an in-flight quicksave: everything is fine. Odd.

Link to comment
Share on other sites

3 hours ago, steve_v said:

(...)
Go to orbit, dock, undock, re-enter: Nav doesn't work (as mentioned previously).
Load a craft from an in-flight quicksave: everything is fine.
(...)

This problem I have in 'Pilot assistant' too, from which the autopilot originates. But I have tested it. If I use a more the less clean installation of KSP, it works. But if I use my heavy modded game, then after undocking the pilot assistant doesn't respond any longer. I have to save and load and then everything works well again. There seems to be some kind of intolerance between the pilot assistant (or the autopilot) and another mod. But I hevo not found out, which it may be.

 

- Isabelle

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...