Jump to content

[1.3] Pilot Assistant: Atmospheric piloting aids - 1.13.2 (May 28)


Crzyrndm

Recommended Posts

I found a 'bug' or maybe just a 'possible unintended behavior'. This is an edge case so I'm not really sure what it would take to fix or if you'll even care, but here's the scenario:

60B131B69D907BF762B7CA8DCED3DD47E07912BD

There is the cockpit up front and a crew cabin in the back. If you transfer the pilot to the back cabin the autopilot ... freezes? Then when you return to the cockpit, depending on how much time has passed, it kicks back in with a scary vengeance. As far as I can tell the steps to reproduce are simple, move all the pilots out of the cockpit into a non-command container, wait, the move one back. The way to fix it quickly is to turn it off and back on again because you still have no control authority (or not much depending on what's enabled) because the system still thinks its running, and even if you try to set your targets again it continues on it's path.

Link to comment
Share on other sites

Just guessing here, but that sounds like the fairly common problem of controller 'wind-up' in RL, where the controller is still active but is unable to produce any change in the process state.

Many RL PLCs have built-in code to detect this, which often doesn't work very well. I tend to insert various error checking (is this valve responding etc.) blocks anyway, in case someone turns off something they shouldn't ;), or, ya know, some wires escape...

Since KSP disallows any kind of control without a pilot / probe core it might be worth shutting down the the autopilot / putting the PID controller to sleep if the pilot goes AWOL, as counter-intuitive as this sounds.

Edited by steve_v
Link to comment
Share on other sites

Since KSP disallows any kind of control without a pilot / probe core it might be worth shutting down the the autopilot / putting the PID controller to sleep if the pilot goes AWOL, as counter-intuitive as this sounds.

Almost guaranteed to be exactly as you have stated, and now that I know the issue exists it's not a difficult one to resolve either (I already have a condition for ignoring the integral while landed, I'l just make it landed or uncontrollable)

EDIT

Fixed, .dll on github if you really need it. Otherwise it'll be in the next release (better get a move on with this GUI...)

EDIT2

Added the PID spreadsheet and some links about PID controllers to the first post. If you find some good readings/watchings for beginners (preferably without the Laplace transfer functions...) then just throw me a link

Edited by Crzyrndm
Link to comment
Share on other sites

Crzyrndm: You'll like this. :cool:

I recently used one of these...

screenshot373_zpsef10e1d3.jpg

...to take a laboratory station segment to orbit. As it was just a simple delivery run, I'd stripped the crew back to just a single pilot.

Unfortunately, I didn't notice that the "pilot" was actually a scientist. This didn't matter on the way up, as the lab had a full-featured probe core on it. But as soon as I undocked from the lab, no more SAS.

Now, the Kerbodyne Titan 8 is a perfectly well behaved ship under normal conditions, but it's not the sort of thing you want to bring through reentry with empty tanks and no SAS. I considered leaving it in orbit and sending up a real pilot, but then inspiration struck: Kerbal Pilot Assistant was on board!

It was a bit bumpy at times (haven't got the non-stock PID tuner set right, so there was a fair bit of hypersonic bucking and rolling as we hit the lower atmosphere), but the Titan and our stowaway scientist are now safely back at KSC. On the runway, smooth as silk, autopilot all the way. :)

- - - Updated - - -

BTW: are the stock SAS and Pilot Assistant PID values proportional to each other? I.e. if I usually cut kp values in stock SAS to 1/3rd of default and that works well, would you expect cutting the kp value in the Pilot Assistant to 1/3rd of default to have a similar effect?

Link to comment
Share on other sites

but then inspiration struck: Kerbal Pilot Assistant was on board!

You'll be happy to note that I have no current plans for any kerbal skill integration then :sticktongue: (PS: Since I know you like wing strength on the light side, the bucking and rolling can't have been *that* bad...)

Link to comment
Share on other sites

  • 2 weeks later...

Saw that once while I was halfway through building this 0.90 install, but only once. Love those bugs.

Not sure about PID tuning tutorials - most of them seem to leave derivative gain as some sort of afterthought whereas for aircraft it's absolutely critical.

BTW any chance of exporting gains from PA profile<->SSAS, or are they too different? I don't really use your SSAS because I'm usually fed up with tuning things :P

Link to comment
Share on other sites

Saw that once while I was halfway through building this 0.90 install, but only once. Love those bugs.

Not sure about PID tuning tutorials - most of them seem to leave derivative gain as some sort of afterthought whereas for aircraft it's absolutely critical.

BTW any chance of exporting gains from PA profile<->SSAS, or are they too different? I don't really use your SSAS because I'm usually fed up with tuning things :P

Derivative isn't used a whole lot outside of simulations because it suffers really badly from noise (measurement imperfections). That's probably why you won't find much on it.

PA and SAS structure is so entirely different that exporting one to another is not going to happen. SAS is only a single controller per axis while all of Pilot Assistant's control systems are running in a two stage cascade.

Link to comment
Share on other sites

I'm a good chunk of the way through setting up the preset loader to work on craft name, so barring any major disturbances that should be release ready by the end of the weekend.

It's taking a while to get here because I've been slowly rebuilding the code to make things a little less hacked together. The result of this is that several subsystems should perform more reliably, some minor optimisation, and a significant decrease in headscratching on my end.

If there are any issues/niggles lying around, now would be the time to be poking me with them :sticktongue:


I'm also considering writing/recording/drawing some comprehensive documentation/usage guidelines/PID tutorials. Past the obvious "this is what each number does", are there some systems that need more focus (I'm guessing KSP/PA tuning examples are going to be very high on that list, but past that I really don't know)

Link to comment
Share on other sites

I did find you can get PA into a state where it tries to re-enable itself every time you turn SAS *on*, but I forgot how I did it... some odd combo of SAS/SmartASS probably, SmartASS disables stock SAS quietly I guess.

I wonder if there's some sane way to detect regular long period oscillation...

Link to comment
Share on other sites

If there are any issues/niggles lying around, now would be the time to be poking me with them :sticktongue:

Weird bug: stock SAS PID tuning seems to like confusing my presets occasionally. My standard pitch/roll/yaw kp values are 5,000/3,000/5,000 and that's how I set up my preset. However, although it isn't all the time, quite often KPA will load them as 3,000/5,000/5,000.

No idea why.

I suspect that what's needed as much as a detailed PID tutorial is just some good-enough default settings for FAR, so that users have a base to start from before they start fiddling with the tuning. Doesn't have to be perfect, just has to be usable.

But some plain English functional tips (i.e. "lowering kp should reduce SAS overcorrection, but lowering too much will cause drift; lowering clamp should reduce the tendency to drift off target..." etc.) wouldn't hurt.

Link to comment
Share on other sites

@Van Disaster

I've been trying to squash that one ever since I introduced the "disable on SAS usage". If you ever find what makes it happen...

@Wanderfound

Can you just try one thing for me: Save a preset, load it, click update, and then load it again.

If it flips back to what it originally was, I know exactly what's caused it (and I could have sworn I squashed that one...)

I suspect that what's needed as much as a detailed PID tutorial is just some good-enough default settings for FAR, so that users have a base to start from before they start fiddling with the tuning. Doesn't have to be perfect, just has to be usable.

Default stock SAS settings for FAR => Increase Scalar by 50%

Assistant depends way too much on the plane

SSAS defaults *should* be fairly FAR compatible since I do most of my testing with FAR.

That does remind me though, I was going to move the defaults ot of the code...

Link to comment
Share on other sites

That doesn't seem to flip it. The problem is definitely still occuring, but I'm not sure what triggers it.

I don't know whether to say it's a relief or a headache inducing annoyance (it's not the old bug, but it's still a bug with no repro case...)

And a possibly interesting update, if you've used SSAS much, you'll probably have noticed that it locks it's target rather more quickly than stock SAS does (the instant you released the relevant input key for the axis to be exact...), which resulted in it always overshooting and then coming back after some control input. I had a bit of a lightbulb moment while I was cleaning that section of code and for once things worked perfectly straight out of the box. SSAS now uses a sliding engagement that feels almost exactly like the stock SAS system (a good thing in this case). My last major issue with SSAS functionality just dissapeared :D

Edited by Crzyrndm
Link to comment
Share on other sites

Aight, fairly finalised dev build on Github.

Functionally, SSAS now has it's nice sliding engagement (:cool:), presets are associated with a craft, and the PID defaults are available to change in a cfg (created after first run), plus a few other things that I can't remember. Now, the reason I'm not "releasing" this is because I have barely tested it, a good portion of the codebase has been restructured, and I need some sleep. If you're up for a (little) bit of risk, well here's v1.0 a day early

Link to comment
Share on other sites

Pilot Assistant v1.0 released

  • Large scale code overhaul
  • SSAS now uses a sliding engagement
  • Presets are now associated with a specific craft name
  • A "defaults.cfg" will be created on entering the flight scene for the first time. Change the tuning values here to alter your default settings
  • Fix for integral windup issues when craft is uncontrollable
  • Fix for incorrect SAS preset assignments

Craft Presets

Whenever you load a non-default preset onto a craft, that particular craft name gets linked to the preset you just loaded. Anytime you load the craft after that it should automatically reload the specific preset. If there is no available preset, then the relevant default will be used.

Defaults

I would suggest using module manager rather than hand edits if you want to make changes to these. If things do get out of hand, deleting the defaults config will reset everything.

SSAS

With the new sliding engagement I feel like there is very little reason to use stock SAS inside the atmosphere. The slide time may need a bit of tweaking yet (feedback on this would be appreciated), but thats trivial now it functions.

Link to comment
Share on other sites

That's extremely wierd, Pilot Assistant uses no persistent data outside it's own directory (and 0.9.6.2 only used the presets) so wiping it's directory should be more than enough to set everything right.

Is it only PA that's not working? Logs?

Link to comment
Share on other sites

Update v1.0.2

  • Squashed another nullref that was floating around
  • Removed unnecesary logging that wasn't intended to be included in a public build
  • Fixed Preset loader not triggering on inflight vessel switching
  • Fixed SSAS not supporting inflight vessel switching at all (Well and truly missed that one... :huh:)

Just a few more bugs I didn't catch this morning...

EDIT

Added a KerbalStuff download for v1.0 release

Edited by Crzyrndm
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...