RemoteTechnologiesGroup / RemoteTech

Community developed continuation of Kerbal Space Program's RemoteTech mod.
http://remotetechnologiesgroup.github.io/RemoteTech
GNU General Public License v2.0
233 stars 102 forks source link

Flight Computer deletes wrong maneuver executions #729

Closed Alshain01 closed 7 years ago

Alshain01 commented 7 years ago

I mentioned this in the thread but I thought I should put it here. I've noticed a bug where if you have multiple planned maneuver executions on successive orbits (for example, your first satellite constellation) then after the first satellite finishes it's maneuver, RemoteTech deletes the planned executions for all of them, instead of just the one.

Screenshots, here you see I have 3 satellites, the launcher that put them there has already de-orbited and now they just have to circularize at the proper time as you see in KAC. The first one is just 2 minutes from it's burn.

aii7kaz

After the burn, satellites 2 and 3 decided I didn't really want them to ever circularize, just hold the maneuver node forever.

jhvyzny

Alshain01 commented 7 years ago

To clarify, this is 1 maneuver burn on 3 different crafts all planned in advance. I am not trying to execute multiple maneuvers on the same craft at once.

KSP-TaxiService commented 7 years ago

(Edited your first comment to embed your images directly instead of linking to an external image site)

Hey, thanks for noticing this bug.

On KSP 1.3.0 and latest RT dev, I verified that this bug is only reproducible if there is another vessel (don't need a burn command on the other vessel to trigger I think) close to the active vessel. Upon completing the burn, endless NullReferenceException spam comes

NullReferenceException
  at (wrapper managed-to-native) UnityEngine.Component:get_gameObject ()
  at PatchedConicSolver.RemoveManeuverNode (.ManeuverNode node) [0x00000] in <filename unknown>:0 
  at ManeuverNode.RemoveSelf () [0x00000] in <filename unknown>:0 
  at RemoteTech.FlightComputer.Commands.ManeuverCommand.AbortManeuver (RemoteTech.FlightComputer.FlightComputer computer) [0x00022] in E:\GitHub\RemoteTech\src\RemoteTech\FlightComputer\Commands\ManeuverCommand.cs:85 
  at RemoteTech.FlightComputer.Commands.ManeuverCommand.Execute (RemoteTech.FlightComputer.FlightComputer computer, .FlightCtrlState ctrlState) [0x00022] in E:\GitHub\RemoteTech\src\RemoteTech\FlightComputer\Commands\ManeuverCommand.cs:110 
  at RemoteTech.FlightComputer.FlightComputer.OnFlyByWirePost (.FlightCtrlState fcs) [0x0006c] in E:\GitHub\RemoteTech\src\RemoteTech\FlightComputer\FlightComputer.cs:500 
  at (wrapper delegate-invoke) FlightInputCallback:invoke_void__this___FlightCtrlState (FlightCtrlState)
  at Vessel.FeedInputFeed () [0x00000] in <filename unknown>:0 
  at FlightInputHandler.FixedUpdate () [0x00000] in <filename unknown>:0 

(Filename: E:/GitHub/RemoteTech/src/RemoteTech/FlightComputer/Commands/ManeuverCommand.cs Line: 85)

After exiting the flight scene, the spam stops and another NullReferenceException spam takes a turn.

NullReferenceException: Object reference not set to an instance of an object
  at RemoteTech.FlightComputer.FlightCore.HoldAttitude (.FlightCtrlState fs, RemoteTech.FlightComputer.FlightComputer f, ReferenceFrame frame, FlightAttitude attitude, Quaternion extra) [0x000fc] in E:\GitHub\RemoteTech\src\RemoteTech\FlightComputer\FlightCore.cs:40 
  at RemoteTech.FlightComputer.Commands.AttitudeCommand.Execute (RemoteTech.FlightComputer.FlightComputer f, .FlightCtrlState fcs) [0x00061] in E:\GitHub\RemoteTech\src\RemoteTech\FlightComputer\Commands\AttitudeCommand.cs:138 
  at RemoteTech.FlightComputer.FlightComputer.OnFlyByWirePost (.FlightCtrlState fcs) [0x0006c] in E:\GitHub\RemoteTech\src\RemoteTech\FlightComputer\FlightComputer.cs:500 
  at (wrapper delegate-invoke) FlightInputCallback:invoke_void__this___FlightCtrlState (FlightCtrlState)
  at Vessel.FeedInputFeed () [0x00000] in <filename unknown>:0 
  at FlightInputHandler.FixedUpdate () [0x00000] in <filename unknown>:0 

(Filename: E:/GitHub/RemoteTech/src/RemoteTech/FlightComputer/FlightCore.cs Line: 40)
KSP-TaxiService commented 7 years ago

The root cause of FC deleting wrong maneuver commands is null state of the unloaded vessel's PatchedConicSolver within the physical range. Because of this, multiple functions, included loading and saving FC commands of the unloaded vessel, are impacted.