Jump to content

Fix SAS function


Recommended Posts

I have paid a lot of attention to it so even though I may be wrong about it I believe I am not.

The way SAS works today seems to be linear response to angular difference (graphs courtesy of Wolfram Alpha in no particular units)

32Lnjkx.png

F = -a.αd

This way of implementing the function is WRONG.

First, under ideal conditions it never stops regulating even the smallest angular difference because it leads to oscillating between maximum angular difference at zero angular velocity and zero angular difference at maximum angular velocity. The only reason why it works in KSP is because it is dampened by flexibility of part connections. But have a small light ship or just single command module with larger angular deviation and you can watch it oscillating for very long time.

Second, when the ship gets to uncontrollable spin, it acts evenly in all directions, not stopping the rotation at all because forces applied go evenly in all directions just as the angular difference is evenly spread all around -180..+180 degrees.

What SHOULD be done here is to take angular velocity into account as well:

qDgYL71.png

F = -a.αd - b.αv

This way it will act not just directly towards the zero angle, but in general to dampen the movement so that the angular velocity is zero at zero angle. When the ship gets in uncontrolled rotation, it will stop it as there will be always component of the force against this rotation.

Edited by Kasuha
Link to comment
Share on other sites

Eh, what version is this about?

.22 has a much refined SAS system, which as far as I could tell, eliminates most of these oscillation problems...

unless you do mean .22, then it'd be nice to get more info on what exactly you're experiencing there...

cheerz

Link to comment
Share on other sites

Yes, I do mean 0.22. And what I am experiencing are exactly things I am talking about in my post. Inability to stop violent spin, SAS undercompensating, oscillations, depletion of electric charge after a while running with SAS on even with no other forcing (engines off), corrective action clearly depending on angular difference and nothing else.

Edited by Kasuha
Link to comment
Share on other sites

I just launched a test ship and cranked it into a very fast spin, and with reaction wheels only it stopped it within 3 revolutions.

I perhaps found an intermittent bug - once I had to toggle SAS On, Off and then On again before the correction kicked it, but once it did, it dampened the rotation extremely fast.

It doesn't always dampen precisely and it can take a couple of cycles, but it reduces the error to zero

Link to comment
Share on other sites

I honestly think you may have built a very unstable rocket then. I've been very impressed with how far the SAS has come on. Perhaps if you can post some pictures of what you're experiencing we might be able to diagnose why it could be happening?

As far as I know, C7 did a lot of work on ensuring that it was looking both at directionality and total momentum, so it was tuning both the direction and amplitude of the forces applied.

Certainly, my spaceplanes fly straighter than ever now, so i'm happy!

Link to comment
Share on other sites

I have noticed spinning when under thrust from 5 SRBs on a rocket that admittedly was too small for 5 SRBs (barely made LKO). I don't know if the same happened in .21 because I wasn't restricted to one rocket and 1 SRB in .21 so didn't try these weird configurations.

And no, my rocket is not very unstable. It's as stable as you can make a 5-SRB rocket after unlocking the first unlockable tier. It's perfectly balanced for both mass and thrust, the only imbalances coming from the semirandomness of the game's floating point numbers.

Link to comment
Share on other sites

Okay I made a few experiments and it's more complicated.

Single skipper engine with some wobbly balast above it was behaving perfectly and even standed collision with launchpad clamp.

My two-stage rocket is getting into uncontrollable oscillations until I turn SAS off - after that it flies perfectly straight.

Half-done asparagus stage compensates exactly against what it should do - when getting near zero the force even adds to angular velocity instead of killing it.

Simple last stage (1-man pod, small fuel tank, engine) oscillated around middle value several minutes until it ran out of built-in power reserve.

These are all cases I have seen. But I have no saves or more details. I'm not sure anymore, it's hard to say. But for me, negative experience still outweighs positive. Maybe there's just small error in the implementation, reversion of the compensation in certain cases? I don't know.

Link to comment
Share on other sites

Ops, haven't seen this before I've opened a new topic today.

Anyway, in this topic the problem is presented wrong and the solution is random. I suggest you to read about PID controllers and you can join my topic if you want to discuss more about SAS problems and potential solutions (although I already gave a very good solution to the problem and I don't think it can be improved).

Link to comment
Share on other sites

For most craft the .22 SAS is great, but I did encounter some extreme wobble when I stacked 4 probes on top of each other. It was stable through launch because I strutted it down, but when I jettisoned the struts the SAS went nuts and shook the craft apart. Everything else I've launched has been rock solid though.

Link to comment
Share on other sites

For most craft the .22 SAS is great, but I did encounter some extreme wobble when I stacked 4 probes on top of each other. It was stable through launch because I strutted it down, but when I jettisoned the struts the SAS went nuts and shook the craft apart. Everything else I've launched has been rock solid though.

This sounds like it might be a bug that may or may not be related to SAS. I've seen this kind of thing happen sitting on the launchpad with SAS turned off. The craft just start shaking and shaking until it falls apart. It could be due to some kind of part clipping problem, or maybe some other bug, but it's definitely not the usual wobbliness that can happen on unstable designs.

It's hard to say if this the same thing happening to you without seeing it, but that could be the issue. One way to check is just to launch the same thing multiple times. When the shaking bug hits me I've found that it only happens some of the time; just saving and reloading is enough to fix it sometimes.

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