Jump to content

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


linuxgurugamer

Recommended Posts

10 hours ago, linuxgurugamer said:

Don't you think I know that?  Do you have any idea how many mods I need to update?  Whatever you guess, it's going to be too low.

Here is a link to a page where you can see all of my mods' statuses:

 

Any more comments, and I'll move this to the bottom of the list

Apologies, I certainly didn't mean to come off as snide or flippant, just excited is all.  I honestly wasn't expecting 1.3 to even drop quite so soon.  

Link to comment
Share on other sites

  • 2 weeks later...

Hi linuxgurugamer,

I have some feedback on the issue with Kramax's heading autopilot. When entering a target heading, Kramax will bank the aircraft and continually turn without finding the target heading. Tested on a fresh install with Kramax as the only mod, using the Aeris 3A stock craft. Output_log.txt

After running the test with Kramax, I compared the difference with Pilot Assistant, which Kramax was originally developed from. This is what I noticed, purely from the GUI as I'm not a coder.

In Kramax, when updating the target heading in the heading autopilot, the entered value also updates in the textbox to the right of the GUI in green text, and the plane begins turning, to the right if a positive value is entered or to the left, if the value is negative. However, in Pilot Assistant the green text is updated to give the difference between the current heading and the target heading, which gradually reduces as the craft turns until it reaches zero when the autopilot levels out the craft. I suspect the error in Kramax lies in the fact that this value never changes and so never reaches zero.

As I said, I'm not a coder and wouldn't have a clue where to start looking in the code to create a fix, but I hope the description I've given will help you narrow down the culprit. I appreciate that you're looking after a lot of mods and don't consider this to be a critical issue, as I can happily use the "bank hold" setting until you have time to fix this.

Thank you for all you work,

IntoSpaceAgain

Link to comment
Share on other sites

I miss the feature to enter the absolute heading. Actually only the relative heading is embedded.

And a switch of speeds to knots or Mach would be also great.

And of course the actual waypoint should be set as flightplan "node" ... <- wishlist prio #1

btw what do IAF, FAF, RW mean?

RW = runway?

How can I calculate the runway heading of RSS runways?

Edited by Gordon Dry
Link to comment
Share on other sites

Could it be that this mod does not like Dynamic Deflection?
On each leg change the plane starts to climb again.

 

Generally:

And how can I avoid that the plane bumps upwards on touchdown when approaching on glideslope with a smooth angle?
Is the default suspension setup for the bucket?
It's like the suspension is filled with gunpowder ...

Edited by Gordon Dry
Link to comment
Share on other sites

I have noticed that odd nose dive just before wheels down.   I figured it was just a flaw in my design, so never worried too much about it.  I have used Dynamic deflection on all my saves as well, so this may be tied into it?  I have never given it much thought as I assumed it was all my fault.  but any way, other than the Heading Hold issue, that is the only real problem I have seen with this mod.

 

And as @PmThay requested.  are there other flight plans we can DL somewhere?  or instructions on how to make new ones?  I have looked (very briefly) at the files in the mod folder but nothing jumped out and screamed at me "look here I am a flight plan file."

 

EDIT: oh, and I have not seen the problem with the climb at the beginning of each new leg.  not saying it is not happening on my end, I have just never noticed it.   this mod usually works so well, that the small bugs and minor glitch I just over look, as nothing has been game breaking yet.  the heading hold I just use the bank hold function and the plus and minus keys etc.  and the nose dive and resulting bounce on touchdown has not crashed any planes yet, so ya...  I have sort of just over looked all the little things.   I guess I should pay more attention and add them to the bug list.

Edited by Bit Fiddler
Link to comment
Share on other sites

1 minute ago, Dux Aquila said:

@PmThay @Bit Fiddler : Never fear, Smith is here!!

https://www.dropbox.com/s/x30jd3x513d3z67/FlightPlans.cfg?dl=0

I hope this will help, they are not all to complete Kerbin. If anyone is encouraged to do some more...

I'll try to remember to add these to the OP tomorrow, and maybe include thin in the mod.

Thanks

Link to comment
Share on other sites

On 6/14/2017 at 0:12 AM, Bit Fiddler said:

or instructions on how to make new ones?  I have looked (very briefly) at the files in the mod folder but nothing jumped out and screamed at me "look here I am a flight plan file."

 

 

 

I've just discovered this mod, but if you look at "DefaultFlightPlans.cfg" in the KramaxAutoPilot folder it does have some basic instructions at the top. It doesn't look too complicated -- basically you just enter values for waypoints, but you'll have to figure out the waypoints yourself.

There are a bunch of examples given, which I'm hoping can be easily tweaked for personal use...

Edited by Mandella
Missed a "t".
Link to comment
Share on other sites

If you want to make your own flight plans, put your code in FlightPlans.cfg. Create the file if it doesn't exist. You can use the code from DefaultFlightPlans.cfg for reference. The biggest challenge is coming up with the latitude/longitude coordinates. The way I sometimes do that, is using Waypoint Manager, I fly my desired path, setting waypoints as I go. Then, by examining my savegame file, I can see the coordinates that I need to feed into my FlightPlans.cfg file. Another way, is once you have a satisfactory path at one location, you can mathematically convert to any other lat/long location coordinates. I use a spreadsheet for doing this.

Link to comment
Share on other sites

  • 2 weeks later...
On 22/06/2017 at 9:19 AM, Dux Aquila said:

In the next update, you can add a vertical scroll bar in the list of flight plans?, is that do not fit all in the computer screen. Thanks in advance

Yes *please*, I'm running with Kerbin Side GAP and the plans from there and I can't see all of the plans at all.

Link to comment
Share on other sites

I've got this problem as well, but I found a workaround:

Quote

Landing patterns and full routes are stored in the different files, so you can remove one that you don't need to save space in Kramax AutoPilot routes list. Files are located in <main game folder>\GameData\ContractPacks\KerbinSideGAP\Patches

One could always just accept some contracts, exit and reconfigure flight plans, and then load the game again.

I've got Kramax open in Visual Studio and am trying to get up to speed.  (I'm a professional C# dev of about 5 years but (a) I have very little Unity experience, and (b) my track record for home projects is really poor, as I seem to finish like 5% of the things I start.)  If anyone is familiar with the source, how would you recommend I go about changing the flight plan view to add a scroll bar, in twenty words or less?  I'll go fish for details and figure things out, but I'd prefer someone experienced recommend a starting point.

Link to comment
Share on other sites

58 minutes ago, mspencer said:

 If anyone is familiar with the source, how would you recommend I go about changing the flight plan view to add a scroll bar, in twenty words or less?  I'll go fish for details and figure things out, but I'd prefer someone experienced recommend a starting point.

I'm not familiar with this particular mod's source but since the mod is written using the old style immediate mode interface, it should be sufficient to wrap this block at the bottom of George.cs in a GUILayout.BeginScrollView()/GUILayout.EndScrollView() block with appropriate parameters (Unity docs). 

Edited by Aelfhe1m
qualifier
Link to comment
Share on other sites

Sorry for coming back with another question, but I think I've stumbled on a problem caused by the existing resize code.

So far I've basically just done what you said, stealing parameters from other uses of BeginScrollBar() in the same file:

Index: George.cs
===================================================================
--- George.cs	(revision 27)
+++ George.cs	(working copy)
@@ -3986,7 +3986,8 @@
                 GUILayout.Label(String.Format("<no flight plans for {0}>", planet.name));
             }
             else
-            {
+            {
+                GUILayout.BeginScrollView(Vector2.zero, GUIStyle.none, GeneralUI.UISkin.verticalScrollbar, GUILayout.Height(maxFlightPlanScrollbarHeight));
                 foreach (var fp in plans)
                 {
                     if (GUILayout.Button(new GUIContent(fp.name, fp.description),
@@ -3995,6 +3996,7 @@
                         ApplyPlan(fp);
                     }
                 }
+                GUILayout.EndScrollView();
             }
 
             if (Event.current.type == EventType.Repaint)

I end up with a reasonably-sized scroll bar, with a scroll button that correctly represents the ratio of visible buttons to total buttons -- but the scroll bar doesn't do anything.  If I double-click near the bottom of the scrollbar I get some very brief visible jumping of the scroll view contents.

My hunch is the drag-to-resize code is constantly rebuilding the GUI when I'm trying to operate the scrollbar.  Looking at George.cs lines 2881, 3050, 3189, and 3363, I think I need to stop dragId from being set non-zero if the horizontal position of the mouse on mouse-down appears to be in the flight plan list.  I can see from 1230 and 1232 the widths are 300 and 200 px, but (since it's so painful to recompile, load my mod-laden KSP, and retest) are those coordinates window-local or screen-local?  Sorry for being full of noob here...

 

Edited by mspencer
Removed some redundant questions/statements
Link to comment
Share on other sites

You may want to make a new install, just for your development work.

1 hour ago, mspencer said:

Sorry for coming back with another question, but I think I've stumbled on a problem caused by the existing resize code.

So far I've basically just done what you said, stealing parameters from other uses of BeginScrollBar() in the same file:


Index: George.cs
===================================================================
--- George.cs	(revision 27)
+++ George.cs	(working copy)
@@ -3986,7 +3986,8 @@
                 GUILayout.Label(String.Format("<no flight plans for {0}>", planet.name));
             }
             else
-            {
+            {
+                GUILayout.BeginScrollView(Vector2.zero, GUIStyle.none, GeneralUI.UISkin.verticalScrollbar, GUILayout.Height(maxFlightPlanScrollbarHeight));
                 foreach (var fp in plans)
                 {
                     if (GUILayout.Button(new GUIContent(fp.name, fp.description),
@@ -3995,6 +3996,7 @@
                         ApplyPlan(fp);
                     }
                 }
+                GUILayout.EndScrollView();
             }
 
             if (Event.current.type == EventType.Repaint)

I end up with a reasonably-sized scroll bar, with a scroll button that correctly represents the ratio of visible buttons to total buttons -- but the scroll bar doesn't do anything.  If I double-click near the bottom of the scrollbar I get some very brief visible jumping of the scroll view contents.

My hunch is the drag-to-resize code is constantly rebuilding the GUI when I'm trying to operate the scrollbar.  Looking at George.cs lines 2881, 3050, 3189, and 3363, I think I need to stop dragId from being set non-zero if the horizontal position of the mouse on mouse-down appears to be in the flight plan list.  I can see from 1230 and 1232 the widths are 300 and 200 px, but (since it's so painful to recompile, load my mod-laden KSP, and retest) are those coordinates window-local or screen-local?  Sorry for being full of noob here...

 

You aren't using the scroll view properly.

This is what you need to do:

Vector2 scrollPos = Vector2.Zero;

void method()

{

	scrollPos = BeginScrollView(scrollPos,  GUILayout.Width(WIN3_WIDTH - 15), GUILayout.Height(WIN3_HEIGHT - 10));
	foreach (var fp in plans) 
	{ 
		if (GUILayout.Button(new GUIContent(fp.name, fp.description))
		{
			// do something here
		}
	} 

	GUILayout.EndScrollView();
}

 

This link may help: https://docs.unity3d.com/ScriptReference/GUILayout.BeginScrollView.html

Link to comment
Share on other sites

Thanks -- I was assuming these were setup, like InitializeComponent() in a WinForms app.  It never occurred to me that the variable being passed in was state that might be changed.

This patch works for me, but there's no rush since I know you have a lot on your plate and you need to retest and tweak further.  Or would you prefer a pull request?  I could make an account for this.

Index: George.cs
===================================================================
--- George.cs	(revision 27)
+++ George.cs	(working copy)
@@ -1222,6 +1222,10 @@
         Vector2 FlightPlanScrollbar = Vector2.zero;
         public float flightPlanScrollHeight = 300;
         public static float maxFlightPlanScrollbarHeight = 300;
+        private Vector2 FlightPlanPresetScrollbar = Vector2.zero;
+        //Unused since preset window is not resizable
+        public float flightPlanPresetScrollHeight = 300;
+        public static float maxFlightPlanPresetScrollbarHeight = 300;
 
         float dragStart = 0;
         float dragID = 0; // 0 = inactive, 1 = hdg, 2 = vert, 3 = thrt
@@ -3986,7 +3990,8 @@
                 GUILayout.Label(String.Format("<no flight plans for {0}>", planet.name));
             }
             else
-            {
+            {
+                FlightPlanPresetScrollbar = GUILayout.BeginScrollView(FlightPlanPresetScrollbar, GUIStyle.none, GeneralUI.UISkin.verticalScrollbar, GUILayout.Height(Math.Min(flightPlanPresetScrollHeight, maxFlightPlanPresetScrollbarHeight)));
                 foreach (var fp in plans)
                 {
                     if (GUILayout.Button(new GUIContent(fp.name, fp.description),
@@ -3995,6 +4000,7 @@
                         ApplyPlan(fp);
                     }
                 }
+                GUILayout.EndScrollView();
             }
 
             if (Event.current.type == EventType.Repaint)

Thanks very much -- you guys literally did all the work for me.  I claim no credit here.

(To be fair, I think anyone could handle copying and pasting five or six lines of code by hand.  But I guess at work the job's not done until it's in source control, passes code review, and has been demoed -- "done, done, done" -- so I guess I had some silly anxiety about this not being in source control yet.)

Edited by mspencer
Statement about source control
Link to comment
Share on other sites

  • 3 weeks later...
On 6/15/2017 at 0:21 AM, Dux Aquila said:

Never fear, Smith is here!!

https://www.dropbox.com/s/x30jd3x513d3z67/FlightPlans.cfg?dl=0

I hope this will help, they are not all to complete Kerbin. If anyone is encouraged to do some more...

But it is necessary a vertical scroll bar in the list of flight plans

Great...

Just as i had finished my spreadsheet to do this and was looking for format info i find out it has been done.

LOL.....

Great work and many thanks.

this will make sure that i did my 'math' correctly....

cheers.

Link to comment
Share on other sites

So . . . I just created an RSS/RP-0 install, put my Kramax build with Aelfhe1m and linuxgugugamer's code changes, and found there's nothing for Earth.  And I have nothing to do today (until a 1 AM conference bridge because apparently I have to learn our ops procedures for prod servers, because whee devops) so I'm prepared to make something today if it doesn't exist.

First question: is this work already done?  Is there a .cfg ready for Kramax to ingest which adds runways and waypoints for Earth as well as Kerbin?

Second question: if not, is there an existing source for Earth navigation info, other than NACO data?  (I don't have and won't be using Jeppesen charts)  Are there KerbinSide-like mods for adding extra airports to RSS Earth that I should look into?

Link to comment
Share on other sites

@mspencer I think that no file Kramax for RSS configuration, you have to add them manually, and Kerbinside is also not compatible with RSS, try KerbalKontructs to add new landing sites.
In addition to the issue of the vertical scroll bar, I do not understand anything about C, and so I ask you if you have a patch to share with those who do not know programming. Thanks in advance

Link to comment
Share on other sites

  • 2 weeks later...
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...