Jump to content

Suggestion for Improving SAS Algorithm


Recommended Posts

My experience with model helicopters has given me an idea for a revised SAS algorithm. Heading-hold heli gyros use a PID loop with proportional gain, derivative gain, and integral gain to maintain attitude very precisely. The proportional gain corresponds to angular velocity, derivative gain corresponds to angular acceleration, and integral gain corresponds to the angle between the set point and the current orientation. I'm not sure if the game currently implements a PID loop, but I can say from experience that PID loops can hold a small heli dead strait on a gusty day. One important variable to consider in the analysis is the maximum angular acceleration of the spacecraft because SAS needs to know how quickly the ship responds in order to make sure it doesn't under/over compensate. Also, it would be good if SAS updated the attitude set point to the point where the ship should stop rotation when the controls are centered. This would prevent SAS from backtracking when you don't want it to. I would also highly recommend having SAS gains as tweakables, with d-gain and I-gain being advanced options because they usually don't need to be adjusted much for a stable ship.

I'm not sure if I'm explaining this perfectly, but here is what SAS could do if it were set up to operate with adjustable d-gain, p-gain, and I-gain, like a heli gyro does.

*Ships and aircraft would no longer wobble back and forth when SAS is engaged because the p-gain could be tweaked to stop this.

*Accurate heading-hold on aircraft. You won't have to constantly readjust your attitude to maintain level flight because the I-gain and d-gain would work together to do this.

*No more backtracking. You won't have to fiddle around with the controls to make small course changes because SAS won't try to return you to your previous position when you don't want it to.

*Improved atmospheric stabilization performance. D-gain will prevent you from being blown off course, even if wind is added to the game.

Link to comment
Share on other sites

Right after I installed 0.22 (clean install into a new directory) the SAS was clearly malfunctioning. And not just SAS, I was having all kinds of issues with the game, most prominent being severe audio issues.

After a few days things miraculously settled down and all issues are gone, including SAS issues, without me doing anything at all.

Perhaps the game needed some time to settle down? I have no clue.

Link to comment
Share on other sites

Right after I installed 0.22 (clean install into a new directory) the SAS was clearly malfunctioning. And not just SAS, I was having all kinds of issues with the game, most prominent being severe audio issues.

After a few days things miraculously settled down and all issues are gone, including SAS issues, without me doing anything at all.

Perhaps the game needed some time to settle down? I have no clue.

Yeah, I had the same exact problem the first few days after release. Whenever I would enable SAS, my ships would go bonkers! Without SAS, they would fly just fine. The problem disappeared for me after a few days, too. Huh, weird :huh:

The audio is still weird for me, though.

Link to comment
Share on other sites

Ahh, I see. I'll have to play around with the config files. However, taking into account the maximum angular acceleration of the ship and updating the set point to the point where the ship should stop is still something that I would recommend as a change. Also, when they implement tweakables, it would be nice to have gain as a tweakable to tailor SAS to each ship/aircraft without modding.

Link to comment
Share on other sites

I also believe that the Lazor mod (See "Lazor-guided Flight" feature) and Mechjeb have pages somewhere in their guts that allow twiddling with the values in flight. And then there is a possibly outdated mod, the Trimmable ASAS.

Further reading:

Mechjeb - How to make SASS chill out, stop wasting RCS, and shaking things apart. (9th September 2013, 15:12)

Link to comment
Share on other sites

Right after I installed 0.22 (clean install into a new directory) the SAS was clearly malfunctioning. And not just SAS, I was having all kinds of issues with the game, most prominent being severe audio issues.

After a few days things miraculously settled down and all issues are gone, including SAS issues, without me doing anything at all.

Perhaps the game needed some time to settle down? I have no clue.

Maybe the game has its own PID controller :D

The only issue I'm still finding with the SAS is that when a ship doesn't have a huge amount of control authority (ie: it's a 'laggy' turner), when you move the ship to a specific heading, the PID controller doesn't seem to take the point where you stop putting input in as the point that you wish to remain at, and seems to compensate back to a point somewhere between where it started and where you stopped inputting the controls. This is obviously only really an issue with big rockets which take some time to turn, but I thought I may as well bring it up here; everything else works like a charm, and it certainly seems to work broadly in the same way as the OP describes.

Link to comment
Share on other sites

Actually, I'm pretty sure the SAS is no longer a traditional PID controller... I'm not exactly sure what it is, but I remember C7 made a blog post about what he did, back around 0.19/0.20 (I forget which). I think he said he dropped the D and it's now a P2I controller, or whatever the heck that means. I'm not familiar with the logic of it and how it works :/

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...