Jump to content

Rotation and acceleration


thegreatgonz

Recommended Posts

[i can't quite figure out the best place to ask this. Please let me know if I should take it somewhere else]

I've been noticing that rotating a ship can actually accelerate it by substantial fractions of a m/s, which violates conservation of momentum. I see this in the velocities reported by KER and kOS, but it's not just a mod issue: you can see these accelerations changing your trajectory in base KSP (it's easiest to see in the movement of the apsides in a near-circular orbit). This isn't just an issue of torque producing phantom forces either: you can set a ship spinning, and then turn off all sources of torque, and the ship's velocity will continue to oscillate as long as it's rotating.

Does anyone have a good explanation for what's going on here? My best guess is that KSP is "measuring" the velocity somewhere other than the center of mass (either that or it's using something other than the center of mass as the center of rotation). I think that would explain everything I'm seeing. If that's right, does anyone know what point it's measuring at?

The specific reason I ask is that I have a kOS script that's getting fouled up by the accelerations created by its own steering actions, so I'd like to figure out a way to correct for the bogus accelerations and find the 'true' velocity of the ship.

Link to comment
Share on other sites

Well if you have rcs on then it is realistic.

When I said "turn off all sources of torque", that includes RCS. I've also reproduced the problem on ships with no RCS.

- - - Updated - - -

Depends. This video demonstrates how to exploit this:

I'm not sure what's shown in that video is what I'm talking about. The effect shown there is that when the ship's center of mass shifts relative to the structure, the structure stays fixed relative to the parent body, whereas in reality the center of mass should stay fixed while the structure moves. However, being able to move the COM within the structure is key to this effect: you only change velocity when you're pumping fuel. The issue I'm talking about can occur even when there's no mass movement at all within the ship, so its COM stays fixed relative to the structure.

Link to comment
Share on other sites

PhysX (the physics engine) doesn't simulate real physics. Instead it only calculates an approximation because of speed reasons.

My speculation:

I think it starts at the root part and cycles through the part tree applying forces to each part and calculating it's new position relative to the next part in the upper node of the part tree. When finished the moved parts will result in a moved CoM but the physic engine doesn't reposition the whole craft. That would need another run through the part tree leading to recalculation of everything. (It calculated with wrong positions leading to wrong force numbers.) If there's a second pass if will refine all numbers but still won't be completely accurate and so on.

So a small error is introduced which amplifies on every physics pass and the further down of the part tree a part is. This is also one of the sources of rapid unplanned disassemblies: The errors accumulate at the leafes of the tree producing phantom forces causing a vessel to spin out of control of ripping it apart in certain circumstances.

As I said it's only a speculation by me. Without a look at the code I don't know for sure.

Link to comment
Share on other sites

I think it's because the game calculates the orbits based on the movement of either the command pod or the root part of the vessel (not sure which) and so when you rotate it applies that sideways momentum to the orbit, because the root/command part is not the same as the center of mass. This means when the ship rotates (around the center of mass) the part for which the orbit is calculated spins around the CoM, changing the orbit. When you stop rotating, it stops moving "sideways" and the orbit settles down. The way to eliminate the wiggle would be to recalculate the trajectory yourself using the CoM as the calculation.

TL;DR: The orbit is predicted for a part other than the CoM

Link to comment
Share on other sites

You might be on to something.

When referring to the "Vessel" object in code for things such as position, rotation, etc., it is known that the "Vessel" object is simply a link to the current "Control From Here" part.

While I have not messed around with orbits, it would make sense to me that the same thing is happening there as well and a part that is off-center is being used for orbital calculations leading to weirdness.

D.

Link to comment
Share on other sites

Hmm. I'm doing some experiments in kOS, and the results I'm getting are consistent with this theory in terms of direction (the velocity changes are parallel to the tangential motion of the control-from part), but not in terms of magnitude: the changes in reported velocity are an order of magnitude or so smaller than the velocity of the control-from part.

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