Kerbal Engineer Redux

Kerbal Engineer Redux

2M Downloads

Incorrect Relative Velocity value

Keniamin opened this issue ยท 6 comments

commented

Hello!
Looks like after v1.1.4.7 or v1.1.4.8 Relative Velocity readout from the Rendezvous section shows incorrect values. Moreother, Relative Speed readout shows the same value in any situation.

Screenshot:
kerbal engineer redux velocity bug

commented

Thanks I'll take a look, the code that calculates all that changed significantly, not surprised a few are bugged.

commented

OK so I wasn't sure what the original intention of 'velocity' vs ' speed' was in this case. The original code was

RelativeVelocity = FlightGlobals.ship_tgtSpeed;
RelativeSpeed = FlightGlobals.ship_obtSpeed - targetOrbit.orbitalSpeed;

You'd think those would be the same but I guess not.

The code in my version is

RelativeSpeed = originOrbit.orbitalSpeed - targetOrbit.orbitalSpeed;
RelativeVelocity = RelativeSpeed;

So both my values should be the same as the old speed, and the old velocity is missing. Still dunno what that's actually calculating. What was your orbital speed in that screenshot? any idea?

Any suggestions for renaming these readouts to be clearer as to what they are? I personally never used them.

commented

Well, in-game description gives following help strings for these readouts.
RelativeVelocity: Shows the relative velocity between your vessel and the target object.
RelativeSpeed: Shows the difference in orbital speed between your vessel and the target object.

RelativeVelocity indeed was showed the same value as stock velocity gauge does in the "target" mode. But stock value is always formatted as m/s with 1 digit after dot, so when you see 0.0 m/s it may be both 0.049 and 0.001. KER readouts switch to mm/s at low values, so it's precision is much better. I used this readout when I needed to park vessels in the same orbit for a while without docking. Better precision allowed me to achive much more stable relative position (~50 meters difference per orbit period, compare with ~400 meters with stock gauges).

What about RelativeSpeed, I suppose it must give the same value on the orbits with equal inclination, but may be different in other cases. I mean for example two exact circle orbits with the same height. Orbital speed will be the same (RelativeSpeed = 0), but if inclination is different you would have RelativeVelocity != 0 wherever your vessels are. Although, I didn't use this readout too and cannot imagine proper use case for it.

commented

I agree the readout should show the stock target speed, the mm/s precision does sound useful. I'm looking at the code and still cannot figure out where the -111 m/s in your screenshot is coming from. You obviously have the same inclination as your target.

I will put rel. velocity back like it was (although it needs to be in a tracking station compatible manner) and investigate what the heck that speed value is and try to make it meaningful.

commented

See if this solves both your issues.
KerbalEngineer 11410test.zip

It seems like that weird value is some kind of timing issue. I parked 2 ships next to each other like you did and got the same large values, but after timewarping for a bit it... went away and read near 0 like it should... so maybe the value I was grabbing only updates once an orbit, or something?

In any case it's better now. I renamed Relative Speed to Relative Orbital Speed just for clarity. Rel Velocity is now magnitude(myV - theirV) and Rel Speed is magnitude(myV) - magnitude(thierV), which is what I think the intention was.

commented

See if this solves both your issues.

Confirming, looks like all is ok.
Thank you!