Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADDONS:TR:PLANNEDVEC is broken #2214

Closed
Efratror opened this issue Jan 8, 2018 · 3 comments
Closed

ADDONS:TR:PLANNEDVEC is broken #2214

Efratror opened this issue Jan 8, 2018 · 3 comments

Comments

@Efratror
Copy link
Contributor

Efratror commented Jan 8, 2018

When using this code:

IF ADDONS:TR:AVALABLE { IF ADDONS:TR:HASINPACT { PRINT ADDONS:TR:PLANNEDVEC.} } }

you get an exeption:

Exception has been thrown by the target of an invocation.

and this log entry:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object
at Trajectories.DescentProfile.GetAngleOfAttack (.CelestialBody body, Vector3d position, Vector3d velocity) [0x00000] in :0
at Trajectories.NavBallOverlay.GetPlannedDirection () [0x00000] in :0
at Trajectories.API.plannedDirection () [0x00000] in :0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in :0
--- End of inner exception stack trace ---
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in :0
at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in :0
at kOS.AddOns.TrajectoriesAddon.TRWrapper.PlannedDirection () [0x00000] in :0
at kOS.AddOns.TrajectoriesAddon.Addon.PlannedVector () [0x00000] in :0
at kOS.Safe.Encapsulation.Suffixes.Suffix`1[kOS.Suffixed.Vector].Get () [0x00000] in :0
at kOS.Safe.Encapsulation.Structure.GetSuffix (System.String suffixName) [0x00000] in :0
at kOS.Safe.Compilation.OpcodeGetMember.Execute (ICpu cpu) [0x00000] in :0
at kOS.Safe.Execution.CPU.ExecuteInstruction (IProgramContext context, Boolean doProfiling) [0x00000] in :0

I think it is a issue with the trajectories mod it self but I'm not sure so that's why i post it here also.

@PiezPiedPy
Copy link
Contributor

PiezPiedPy commented Jan 17, 2018

Hi, I'm a Collaborator for Trajectories, I've never used kOS before but looking at the docs some changes need to be made as noted below.

  • setTarget can be used regardless of a predicted trajectory calculated or not and thus a check for HasImpact is not required.

  • PlannedVector and CorrectedVector requires a valid target to be set before calling otherwise it will create an NRE (note: after the next Trajectories release an NRE will not be generated but the API plannedDirection and correctedDirection will return a null).
    Also for the next Trajectories release I have created an API function hasTarget so a check for a set Target can be coded into kOS, or a new kOS function could also be implemented, something like TRAddon:HasTarget

  • Also for the next Trajectories release API functions requiring an active vessel when called without an active vessel will return null

@PiezPiedPy
Copy link
Contributor

PiezPiedPy commented Jan 26, 2018

Pull-request #2220 has been submitted to offer kOS support for Trajectories v2.0.0 soon to be released.

@Dunbaratu
Copy link
Member

should be closed by #2747

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants