Jump to content

[1.12.x] Trajectories v2.4.5 (2023-08-22) : atmospheric predictions


Kobymaru

Recommended Posts

Before posting feature requests or bug reports, please read the FAQ.

 

Download

Toolbar Controller and Click Through Blocker and SpaceTux Library  are now dependencies of the Trajectories mod. Please install them first.

Description

The mod displays trajectory predictions, accounting for atmospheric drag and lift. Works with the stock aerodynamic model, and with Ferram Aerospace Research (FAR).

With this mod, you can

  1. choose precisely the location where you'll crash. The typical precision is about 6km.
  2. Plan Aerobraking maneuvers that can, for example, put you on intersection trajectory with another body (see point 1 about what you can do from there)

Keep in mind that this software comes without warranty of any kind, and in particular that it may or may not help you survive, reach a specific target, or anything at all. But it usually helps :wink:

FAQ

  • Works with stock aerodynamics and FAR
  • Reportedly works with
    • deadly reentry
    • real solar system
    • Rescaled Kerbin
    • Outer Planets Mod
  • Compatible with Blizzy's toolbar
  • If you see weird spirals or other crazy lines everywhere, double-check you didn't enable "body-fixed mode" by mistake
  • If the predicted trajectory seems inaccurate, check that you set the correct orientation in the Descent profile (or checked Prograde or Retrograde), and that you keep that orientation all the time
  • It's not possible to predict a trajectory for a future stage. We know this is a highly requested feature, but unless we duplicate big parts of the KSP-internal code, we are limited to simulating the current state of the vessel.
  • Parachutes are not simulated (that's usually not a problem if you open it near the ground)

User manual

See your predicted trajectory

  • Open the map view
  • This is it ; trajectory display is enabled by default, you have nothing else to do
  • White is the trajectory in space, red is the trajectory in atmosphere, the red cross is your impact point (that takes the body rotation into account to show the impact point on the terrain, this is useful both for bodies with and without atmosphere)

Disable the trajectory display

  • Click on the Trajectories icon in the stock KSP toolbar (or Blizzy's toolbar if it's installed) to display the main UI
  • Click "Display trajectory" to toggle it on/off
  • Click "complete" to toggle display of the complete trajectory (including parts where it is superimposed with the stock KSP trajectory)

Set a target point (nav ball guidance)

  • Adjust your velocity so that the red cross is located where you want to go
  • Click "Set current impact as target" to enable the green cross
  • Alternatively, there is a button to set the target on the KSC (works on Kerbin only obviously), or you can enter longitude/latitude
  • Go back in flight view, and notice the two new indicators on the nav ball
  • The square indicator shows where you need to point your craft at if you were exactly following the predicted trajectory
  • The circle indicator is a hint about the direction you should go to adjust your actual trajectory to reach the target (this is not necessarily where you need to point, what's important is the direction between the square and the circle, and the distance between them indicates how far you are from the perfect trajectory)

Body-fixed mode

Use this toggle to switch between the regular mode (similar to stock KSP orbits), or body-fixed mode. In body-fixed mode, the trajectory is displayed relatively to the body frame, following the body rotation. This mode makes sense for atmospheric or low terrain fly-by, and also to adjust a geostationary orbit. However, for most high orbits, it will just look funny. This can help you keep occupied for those 2-year-long planetary transfers, but try not to burn up all the fuel to see how it can make funny curved lines.

Manoeuver nodes

You can plan aerobraking or re-entry after manoeuvers, just place your nodes as usual and see the predicted trajectory. Keep in mind that you always place nodes on the stock trajectory, that might be very different from the predicted one, so you may have to place nodes at a point that have an effect somewhere else on the predicted trajectory (especially when planning landing on a body without atmosphere with body-fixed mode). Also, atmospheric prediction can happen only for the body you are currently orbiting, so you can't plan a Kerbin re-entry while you're still arround the Mun.

Support and Bugs

If you have questions and feedback regarding a current release, feel free to post in this thread.

Please post bug reports on the GitHub bug tracker. If you don't know how, don't want to learn or are unsure it's a bug, you can ask in this thread.

Contributions

This mod is a community project! It was originally written by @Youen and is currently maintained by @linuxgurugamer
The following people have already contributed to this project (in approximate order of commits):

  • Youen (Github neuoy)
  • PiezPiedPy
  • Kobymaru (Github fat-lobyte)
  • atomicfury (Github sawyerap)
  • And many others.

You want to be part of this list? Contributions are very welcome! Read our Introduction for Contributors, fork the Repository on Github and have a go at the code!
When you feel that your changes are mature enough to be included, send us a pull request!

It's always best if you work on your "pet problem" - a bug that needs to be fixed or that you personally want to see implemented. Or you could just grab an issue from our Issue Tracker!

Change log

The changelog started with release v1.6.7. For the changes in versions older than that, please visit the GitHub releases page.

  Reveal hidden contents

License

This mod is under GPLv3 license, feel free to look at the source code: https://github.com/linuxgurugamer/KSPTrajectories/

Edited by Kobymaru
Version update
Link to comment
Share on other sites

@Kobymaru @Youen Hey, I'm having this issue with Trajectories in 1.2.2. I'm running the latest Trajectories version (updated through CKAN). The problem is that the trajectory prediction line is invisible unless time warp is turned on. There's just nothing, but if I turn on time warp (doesn't matter what magnitude), the lines re-appear. If this is not a known bug, let me know what information is needed to determine the cause, and I'll gladly provide it. For now, here's the log.

Link to comment
Share on other sites

  On 6/25/2017 at 8:51 PM, aluc24 said:

@Kobymaru @Youen Hey, I'm having this issue with Trajectories in 1.2.2. I'm running the latest Trajectories version (updated through CKAN). The problem is that the trajectory prediction line is invisible unless time warp is turned on. There's just nothing, but if I turn on time warp (doesn't matter what magnitude), the lines re-appear. If this is not a known bug, let me know what information is needed to determine the cause, and I'll gladly provide it. For now, here's the log.

Expand  

I have to admit that I haven't seen this kind of issue yet. However, you are running Trajecotires 1.6.6 with KSP 1.2.2, when the most recent versions are Trajectories 1.6.8 and KSP 1.3.0.

It doesn't make much sense to debug old versions, I'm afraid, so please try to reproduce this when you update and then report the issue again.

Link to comment
Share on other sites

  On 6/26/2017 at 7:52 AM, Kobymaru said:

I have to admit that I haven't seen this kind of issue yet. However, you are running Trajecotires 1.6.6 with KSP 1.2.2, when the most recent versions are Trajectories 1.6.8 and KSP 1.3.0.

It doesn't make much sense to debug old versions, I'm afraid, so please try to reproduce this when you update and then report the issue again.

Expand  

Okay, I will... But it might be a long time before that happens. Most of mods I'm using aren't updated to 1.3 yet.

Link to comment
Share on other sites

I'm about 75% sure this crash is caused by Trajectories.  It happened twice while landing at the Mun in Body Fixed mode.  I used the in-game UI to disable trajectories outright and landed just fine.  Time warping did occur during at least one of the crashes.  I suppose it could just be a big coincidence as well, I'm uncertain.  I am seeing a lot of null references from CC as well.

https://www.dropbox.com/s/7riphki2eqozgu6/output_log.txt?dl=0

Edited by Alshain
Link to comment
Share on other sites

  On 6/27/2017 at 2:19 PM, Alshain said:

I'm about 75% sure this crash is caused by Trajectories.  It happened twice while landing at the Mun in Body Fixed mode.  I used the in-game UI to disable trajectories outright and landed just fine.  Time warping did occur during at least one of the crashes.  I suppose it could just be a big coincidence as well, I'm uncertain.  I am seeing a lot of null references from CC as well.

Expand  

Can you make a quicksave and remove as many mods as possible, with the crash still occuring? Because you have got quite a mod list there and I wouldn't even know how to cause a game crash on purpose in C#.

Out of curiosity, how can you be "75% sure this crash is caused by Trajectories" when your mod list looks like this:

Mod DLLs found:
Stock assembly: Assembly-CSharp v0.0.0.0
ModuleManager.2.8.0 v2.8.0.0
000_AT_Utils v1.4.2.0
MiniAVC v1.0.3.2
USITools v1.0.0.0
ActionGroupManager v2.1.0.0
MiniAVC v1.0.3.2
AdvancedTweakablesButton v1.0.3.0
BULB v1.3.4.0
Astrogator v0.7.4.0
CITUtil v1.4.0.0 / v1.0.0.0
BAM v1.3.0.0 / v1.1.0.0
CollisionFX v4.0.0.0
CCK v2.0.1.0 / v2.0.1.0 for KSP 1.3
ContractConfigurator v1.0.0.0 / v1.23.1
RemoteTech v1.8.0.0 / v1.8.7
CC_RemoteTech v1.0.0.0 / v1.23.1
CustomBarnKit v1.1.12.0
DistantObject v1.9.0.10326
Atmosphere v1.2.2.1
CelestialShadows v1.2.2.1
CityLights v1.2.2.1
EVEManager v1.2.2.1
PartFX v1.2.2.1
PQSManager v1.2.2.1
ShaderLoader v1.2.2.1
Terrain v1.2.2.1
TextureConfig v1.2.2.1
Utils v1.2.2.1
_BuildManager v1.2.2.1
Launchpad v5.8.0.0 / v5.8.0
Firespitter v7.3.6354.39102
MiniAVC v1.0.3.2
Fusebox v0.1.11.0
GroundConstruction v1.1.2.1
OneTimeResourceConverter v1.0.0.0
KAS v0.6.3.0 / v0.6.3 for KSP 1.3
MiniAVC v1.0.3.1
KerbalEngineer v1.1.3.0
KerbalEngineer.Unity v1.0.0.0
MiniAVC v1.0.3.2
KIS v1.5.0.0 / v1.5.0 for KSP 1.3
KSPDev_Utils.0.23.0 v0.23.0.0 / v0.23.0 for KSP v1.2
MiniAVC v1.0.3.0
KSP-AVC v1.1.6.2
KSPWheel v0.0.0.0
BetterManeuvering v1.0.3.0 / v3.0
BetterManeuvering.Unity v1.0.3.0
MiniAVC v1.0.3.2
NavBallDockingAlignmentIndicatorCE v1.0.2.0 / v1.0.0.0
NavBallTextureChanger v1.0.0.0
DockingPortAlignmentIndicator v1.0.0.0
DPAI_RPM v1.0.0.0
MiniAVC v1.0.3.2
ModuleDockingNodeNamed v1.0.0.0
PlanetShine v1.0.6121.34655
ProceduralFairings v0.0.4.0
RCSBuildAid v0.9.1.34418
ReentryParticleEffect v1.2.0.0
SCANsat v1.7.8.0 / vv17.8
SCANsat.Unity v1.7.8.0
SmokeScreen v2.7.2.0
Stock assembly: KSPSteamCtrlr v0.0.1.35
Stock assembly: Steamworks.NET v9.0.0.0 / v9.0.0
MiniAVC v1.0.3.2
Strategia v1.0.0.0 / v1.6.0
TextureReplacer v2.6.0.0
Trajectories v1.6.8.0
KerbalAlarmClock v3.8.5.0
TransferWindowPlanner v1.6.2.0
Konstruction v0.0.0.0
USILifeSupport v1.0.0.0
KolonyTools v1.0.0.0
WaypointManager v1.0.0.0 / v2.6.2
MiniAVC v1.0.3.0
[x] Science! v5.7.6355.41035

 

Edited by Kobymaru
Link to comment
Share on other sites

  On 6/27/2017 at 2:34 PM, Kobymaru said:

Can you make a quicksave and remove as many mods as possible, with the crash still occuring? Because you have got quite a mod list there and I wouldn't even know how to cause a game crash in C#.

Expand  

Well, I can't remove all of RemoteTech because the probe has an antenna on it.  I could probably remove the DLL, I'll have to copy the whole save game to do it.  Fortunately I had 3 of those probes in orbit ready to land.

Link to comment
Share on other sites

  On 6/27/2017 at 2:38 PM, Alshain said:

Well, I can't remove all of RemoteTech because the probe has an antenna on it.  I could probably remove the DLL, I'll have to copy the whole save game to do it. 

Expand  

Of course, don't do it in your main save! Back up your main save and do a quicksave.

Yes, you can remove all Mods except for RemoteTech, but you can remove the DLL there. There's also KSPPartRemover, but first focus finding the conditions where the crash occurs.

Link to comment
Share on other sites

  On 6/27/2017 at 2:40 PM, Kobymaru said:

Of course, don't do it in your main save! Back up your main save and do a quicksave.

Yes, you can remove all Mods except for RemoteTech, but you can remove the DLL there. There's also KSPPartRemover, but first focus finding the conditions where the crash occurs.

Expand  

Well, I tried with Trajectories by itself and no crash.  I went back to the other games with trajectories turned on in the same way and landed my other two probes without a crash.  It's strange, it crashed twice in a row but when I want it to, nothing.

So... tests are inconclusive.  I guess we will have to see what Nightingale says about the nullrefs but I don't know what else to do here for right now.

Link to comment
Share on other sites

  On 6/27/2017 at 8:57 PM, Mystique said:

Checking "in-flight" button in map view causes immediate crash (even though vessel is in orbit, so nothing much to calculate). Any ideas where to dig?

Expand  

Which version of Trajectories, which version of KSP and which mods are involved?

Can you reproduce it consistently or does it occur sporadically?

Link to comment
Share on other sites

  On 6/28/2017 at 9:35 AM, Kobymaru said:

Which version of Trajectories, which version of KSP and which mods are involved?

Can you reproduce it consistently or does it occur sporadically?

Expand  

Trajectories v1.6.8

KSP: 1.3 (Win64) 

Other mods:

  Reveal hidden contents

Reproduction: create any new game, launch anything, go to map, check show trajectory, then check in-flight, crash.

Logs, if it helps:

on Dropbox

Edited by Mystique
Link to comment
Share on other sites

Edit:

I just see that on the FAR dev repo it says:

  Quote

FerramAerospaceResearch   -   Tryfix Trajectories creating phantom aerodynamic force arrows   -   3 days ago

Expand  

I use this version, but the arrow is still there.

Is this from Trajectories?
BZMTNq5.png

The blueish arrow. It disappears shortly after launch but comes back later for short periods of time then and when...

Later:
OdsfuBh.png

dLSgN9n.png

Edited by Gordon Dry
Link to comment
Share on other sites

  On 7/4/2017 at 3:33 PM, Gordon Dry said:

I use this version, but the arrow is still there.

Is this from Trajectories?

Expand  

I have not ever seen this in my life, but it looks kinda cool! Where can I get one of these? :wink:

 

  On 7/4/2017 at 9:43 PM, Gordon Dry said:

It also crashes for me when I enable it.

Expand  

This will be fixed in the next release.

Link to comment
Share on other sites

First off, I want to thank for an awesome mod, which accompanies me in all my KSP games since the moment I found it.

Now, I am myself really interested in simulating and predicting trajectories, but unfortunately I have no idea of C#, so I cannot really understand what the code does. Could you ((I mean the contributors, but anyone who can help is welcome to do so) maybe either explain or even just give me the sources of the maths and algorithms you use in this mod? I am currently working on an ascent trajectory tool and on a low TWR vacuum trajectory tool, both in JavaScript. They could play well with your mod if someone ported them to a KSP mod when I am done. It's the ascent one that needs the aerodynamics maths, but I am also interested in simply your approach to calculating the trajectory, which could be useful to both of them.

Link to comment
Share on other sites

  On 7/6/2017 at 3:19 PM, APlayer said:

First off, I want to thank for an awesome mod, which accompanies me in all my KSP games since the moment I found it.

Expand  

Don't forget to give Kudos to @Youen who created this awesome mod, I'm just the maintainer :wink:

 

  4 hours ago, APlayer said:

Now, I am myself really interested in simulating and predicting trajectories, but unfortunately I have no idea of C#, so I cannot really understand what the code does.

Expand  

Good point, I could probably write down what the code does.

 

  4 hours ago, APlayer said:

Could you ((I mean the contributors, but anyone who can help is welcome to do so) maybe either explain or even just give me the sources of the maths and algorithms you use in this mod?

Expand  

At its core, the math and the algorithms are actually kind of simple (it's just packed in a confusing way that's necessary for efficiency)

We use a mix of calls to original and duplicated KSP functions to figure out parameters for atmospheric density, temperature, reynolds number, mach, .... from altitude and velocity. We feed these values into the original KSP DragCube functions to calculate the forces on the ship for a given point in the future.

Then we simply aggregate these forces and calculate velocity and position. The "aggregation" part is important, because if you do it wrong (like simply adding up the velocity/position changes over time), you will end up with big errors. Currently this is done by "verlet integration", but I was hoping to implement Runge-Kutta 4 in the medium future.

If you want, I can look up the places of these calculations in the C# code.

  4 hours ago, APlayer said:

I am currently working on an ascent trajectory tool and on a low TWR vacuum trajectory tool, both in JavaScript. They could play well with your mod if someone ported them to a KSP mod when I am done. It's the ascent one that needs the aerodynamics maths, but I am also interested in simply your approach to calculating the trajectory, which could be useful to both of them.

Expand  

Sounds interesting, but the most difficult case here is to calculate the drag from aerodynamic parameters. KSP does all kinds of funny things with the "DragCube" system like occlusion and bonuses for pointiness and maluses for open stack nodes. Trajectories can get away by simply calling the functions inside KSP with the right parameters and interpreting the results.

I think it might be very hard to replicate all these systems in JavaScript, especially since you would have to dig in KSP code (which technically isn't even allowed).

If you have more questions, don't hesitate to ask!

Link to comment
Share on other sites

  On 7/6/2017 at 7:48 PM, Kobymaru said:

We use a mix of calls to original and duplicated KSP functions to figure out parameters for atmospheric density, temperature, reynolds number, mach, .... from altitude and velocity. We feed these values into the original KSP DragCube functions to calculate the forces on the ship for a given point in the future.

Expand  

I see - so you actually don't do any real aerodynamics maths, but rather use built in KSP functionality. This of course makes sense, but at the same time means I cannot reuse the maths. In this case, I will probably just approximate the drag force with a guess for the drag coefficient with the standard drag equation, which could be based off a basic description of the ship and later refined by the user, who may try the trajectory and check the results. And since my programs will largely simulate prograde burns, I will not really need to account for lift or other aerodynamic forces.

As for the implementation itself, I was helped a lot on the #kspacademia channel, and they indeed recommend using RK4. I may try to help you implement that, but only on the maths and "translating it to a machine" parts, because, as I said, I know no C#, and have only marginal knowledge of OOP. You are also welcome to view my low TWR tool's JS code on GitHub which tries to implement RK4, but do note that it currently fails to calculate anything and finishes with all variables set to NaN.

Thanks for the offered help! :-)

Link to comment
Share on other sites

  On 7/7/2017 at 12:50 PM, APlayer said:

so you actually don't do any real aerodynamics maths, but rather use built in KSP functionality.

Expand  

That is mostly correct. We try to re-use the KSP functions as much as possible.

 

  2 minutes ago, APlayer said:

And since my programs will largely simulate prograde burns, I will not really need to account for lift or other aerodynamic forces.

Expand  

Just so you know, the distinction between "drag" and "lift" is a bit silly, because as @Boris-Barboris likes to point out, drag and lift are just components of the same vector. That means you'll run into situations where ignoring "lift" will produce inaccurate results even when you're not classically "flying".

 

  2 minutes ago, APlayer said:

As for the implementation itself, I was helped a lot on the #kspacademia channel, and they indeed recommend using RK4. I may try to help you implement that, but only on the maths and "translating it to a machine" parts, because, as I said, I know no C#, and have only marginal knowledge of OOP. 

Expand  

Thanks for the tips! I think implementing RK4 is not that hard (I believe I did that in C++ once for a class), but integrating it (no pun intended :wink: ) into the mod is the difficult part.

Link to comment
Share on other sites

  On 7/7/2017 at 12:58 PM, Kobymaru said:

Just so you know, the distinction between "drag" and "lift" is a bit silly, because as @Boris-Barboris likes to point out, drag and lift are just components of the same vector. That means you'll run into situations where ignoring "lift" will produce inaccurate results even when you're not classically "flying".

 

Expand  

The problem here is, the lift calculation requires much more precise knowledge of the vessel shape while being a comparably small effect, and I don't think implementing that outside of KSP itself would be feasible and worth the trouble. What I could possibly do is create this tool in kOS rather than JavaScript, which could account for lift and be precise with drag, though. On second thought, this seems to be the only feasible way to do it, actually.

  On 7/7/2017 at 12:58 PM, Kobymaru said:

Thanks for the tips! I think implementing RK4 is not that hard (I believe I did that in C++ once for a class), but integrating it (no pun intended :wink: ) into the mod is the difficult part.

Expand  

I am sorry, but I don't think I can help with that. I will be glad to help if there is anything I can do, though! :-)

Link to comment
Share on other sites

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