Skip to content

Commit a7e0fe8

Browse files
author
Warren Seymour
committed
Merge branch 'feature/maneuver-execution-timing' into develop
2 parents e39e0af + 3fe2e00 commit a7e0fe8

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/RemoteTech2/FlightComputer/Commands/ManeuverCommand.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,12 @@ public override bool Execute(FlightComputer f, FlightCtrlState fcs)
8282

8383
public static ManeuverCommand WithNode(ManeuverNode node, FlightComputer f)
8484
{
85-
double burnLength = node.DeltaV.magnitude / (FlightCore.GetTotalThrust(f.Vessel) / f.Vessel.GetTotalMass());
85+
double thrust = FlightCore.GetTotalThrust(f.Vessel);
86+
double advance = f.Delay;
87+
88+
if (thrust > 0) {
89+
advance += (node.DeltaV.magnitude / (thrust / f.Vessel.GetTotalMass())) / 2;
90+
}
8691

8792
var newNode = new ManeuverCommand()
8893
{
@@ -96,7 +101,7 @@ public static ManeuverCommand WithNode(ManeuverNode node, FlightComputer f)
96101
UT = node.UT,
97102
nodeRotation = node.nodeRotation,
98103
},
99-
TimeStamp = node.UT - (burnLength / 2),
104+
TimeStamp = node.UT - advance,
100105
};
101106
return newNode;
102107
}

0 commit comments

Comments
 (0)