Jump to content

AmeliaEatyaheart

Members
  • Posts

    57
  • Joined

  • Last visited

Everything posted by AmeliaEatyaheart

  1. Thanks! Glad you like it I posted a while back with an overview of the 'flight computer', and a code snippet for how I worked out which celestial body the craft is orbiting; I've finialised that code, and it's a lot more foolproof http://forum.kerbalspaceprogram.com/threads/66393-Hardware-Plugin-Arduino-based-physical-display-serial-port-io-tutorial-%2808-Oct%29?p=1381446#post1381446 And by all means, borrow away!
  2. Thanks! I wanted something that almost looked professional, but still had that Kerbal humour I'm still working on the flight data readout panel, at the moment it's a bunch of LCD / LED readouts and a bunch of wires all over the desk
  3. So... I made a thing. Again, thankyou zitronen for this wonderful plugin! <3 Also, the insides... they're a bit... Kerbal
  4. Hey everyone In case other people are also wanting to work with the current SOI, I have worked out a way to calculate it. It's a bit... , but it works #define NoSOI -1 #define KerbolSOI 0 #define KerbinSOI 1 #define MunSOI 2 #define MinmusSOI 3 #define MohoSOI 4 #define EveSOI 5 #define DunaSOI 6 #define IkeSOI 7 #define JoolSOI 8 #define LaytheSOI 9 #define VallSOI 10 #define BopSOI 11 #define TyloSOI 12 #define GillySOI 13 #define PolSOI 14 #define DresSOI 15 #define EElooSOI 16 //same codes as in a savefile double Oldecc=-1;//keep value of orbital eccentricity for comparison next loop int currentSOI=-1; void UpdateDisplayOnNewPacket() { if (Oldecc==-1 || currentSOI==-1) currentSOI=resolveSOI();//force refresh if SOI unknown. else if (Oldecc<=1 && VData.e>1) currentSOI=resolveSOI();//force refresh of SOI if orbit jumps to hyperbolic (e.g. entering a smaller SOI) else if (Oldecc>=1 && VData.e<1) currentSOI=resolveSOI();//e.g. jumping to solar from planetary else if ( (VData.e>(Oldecc*1.05) ) || (VData.e<(Oldecc*0.95) ) ) currentSOI=resolveSOI(); //force refresh if the eccentricity 'jumps'; indicates an SOI change without a hyperbolic orbit (e.g. Laythe horseshoe orbit) //'resolveSOI' could be run every loop, but conditional states used to save some processor time. //add more display update code here ... Oldecc=VData.e; //preserve data for next run through loop } //--------// double resolveSOI() { //will attempt to find mu, and from that, figure out which world we're orbiting. //eqn: mu=v^2 / ( (2/OrbRad)-(1/SMA) ) for e<>1. //eqn: mu=(V^2 * OrbRad)/2 for e==1 aka parabolic orbit. //all distances in this function are expressed in km, not m, hence a lot of n/1000. //references- http://en.wikipedia.org/wiki/Hyperbolic_trajectory#Velocity //http://en.wikipedia.org/wiki/Orbital_mechanics#Formulae_for_free_orbits double SemiMajorKm=VData.SemiMajorAxis/1000; double mu=0; double _BodyRadius=0; if (VData.e>1 && SemiMajorKm>0) SemiMajorKm=-SemiMajorKm;//SMA must be a negative figure for e>1. //this is a catch-all - hyper orbits in KSP always have a -ive SMA. _BodyRadius=((SemiMajorKm*2)-(VData.AP/1000)-(VData.PE/1000))/2; double vsquared=(VData.VOrbit/1000)*(VData.VOrbit/1000); if (VData.e!=1) mu=(vsquared)/( (2/(VData.Alt/1000 + _BodyRadius))-(1/SemiMajorKm) ); else mu=(vsquared)*(2/(VData.Alt/1000 + _BodyRadius))/2; //value will be comparable to wiki mu values, divide 10^10 (conversion factor of m^3 -> km^3 if (mu<=0) return -1;//calculation error if ( (3531.6*0.95)<mu && mu<(3531.6*1.05) ) return KerbinSOI; else if ( (65.138398*0.95)<mu && mu<(65.138398*1.05) ) return MunSOI; else if ( (1.7658*0.95)<mu && mu<(1.7658*1.05) ) return MinmusSOI; else if ( (168.60938*0.95)<mu && mu<(168.60938*1.05) ) return MohoSOI; else if ( (8171.7302*0.95)<mu && mu<(8171.7302*1.05) ) return EveSOI; else if ( (301.36321*0.95)<mu && mu<(301.36321*1.05) ) return DunaSOI; else if ( (18.568369*0.95)<mu && mu<(18.568369*1.05) ) return IkeSOI; else if ( (282528*0.95)<mu && mu<(282528*1.05) ) return JoolSOI; else if ( (1962*0.95)<mu && mu<(1962*1.05) ) return LaytheSOI; else if ( (207.48150*0.95)<mu && mu<(207.48150*1.05) ) return VallSOI; else if ( (2.4868349*0.95)<mu && mu<(2.4868349*1.05) ) return BopSOI; else if ( (2825.2800*0.95)<mu && mu<(2825.2800*1.05) ) return TyloSOI; else if ( (0.0082894498*0.95)<mu && mu<(0.0082894498*1.05) ) return GillySOI; else if ( (0.72170208*0.95)<mu && mu<(0.72170208*1.05) ) return PolSOI; else if ( (21.484489*0.95)<mu && mu<(21.484489*1.05) ) return DresSOI; else if ( (74.410815*0.95)<mu && mu<(74.410815*1.05) ) return EElooSOI; else if ( (1172332800*0.95)<mu && mu<(1172332800*1.05) ) return KerbolSOI; return mu; //catch-all line - unknown value, returning calc result for analysis. } Limitations: Cannot calculate SOI unless orbit is closed aka eccentricity<1, however, that also provides an easy way to flush the old SOI when escaping or entering a planetary/lunar system, so this function does not need to be constantly scanned. Updated: Can now calculate SOI regardless of whether elliptical, parabolic, or hyperbolic aka escape trajectory. Also, I promised pics once I got them uploaded - I know photobucket's not the best, but it works So, once again, thankyou zitronen, for this wonderful plugin!
  5. Can't be stolen - it's borrowed... It's not plagiarism if it's properly referenced! Thankyou so much for the update, I'm gonna have a loooooooooooootta fun with this!
  6. Hi there! First, I want to thank you for this amazing plugin - I've been wanting to build a flight computer for a while! So thankyou for making that idea a reality! I was wondering how it might be possible to add more flight data into the plugin itself? I'm reasonably proficient with Arduinos, but know nothing of the PC side. I was thinking things like Horizontal land speed, What the current SOI is, and possibly the (many, many) variables that make up the navball? I am asking because I am hoping to make a complete cockpit without relying on any HUD on screen... I will post pics of my panel based on this plugin as well, once I can get them hosted, though at the moment half of it is breadboard and wires Thanks again! -Amelia Eatyaheart
  7. This is an amazing project, been loving watching it develop I have to ask though - how are you getting your yaw/pitch/roll values out of KSP? I'd love to make something like this (if I can) - I'm good with arduinos, but no clue on how to connect to the computer for the data!
×
×
  • Create New...