Jump to content

Cannon

Members
  • Posts

    203
  • Joined

  • Last visited

Posts posted by Cannon

  1. On 11/25/2021 at 11:50 PM, Goufalite said:

    I still didn't find the problem on my side but, I might have found something else: the config of existing parts (ore tanks,...) was persistent, I fixed this in my next version, can you take a look? (unfortunately it doesn't fix the "cursed jetpacks" problem described before, you still need to manually in the save change the reinit... field).

    New release v0.4.0.0

    • Remove energy from crafted electrical parts (thank to Github user MSchmoecker, more info)
    • Field non-persistance
    • Added a whitelist to the scrap module, leave "all" to scrap everything, or comma separated parts.
    • Added a "forceRefuel" for the EVA refueler module to roleplay resource drain if the EVA parts are somewhat already full

    Okay more details (and the wiki will be updated)

    In the patches folder there is a "oretotanksEvaOverride.txt" file. Rename it to cfg and it will add a scrap module and craft module to command pods but only for jetpacks and evacylinders. This will allow to "replace" EVA tanks with monoprop. The ratio can of course be changed in the cfg file and I'd appreciate feedback if a better ratio is more interesting.

    The "forceRefuel" in the EVARefueler module to true is a little tricky. What it does is it attemps to refuel ALL EVA parts in the inventory system (and kerbal inventory) with the available resource of the main part, even if the EVA parts are full ;) . Think of this as emptying completely your jetpack and refueling it.

    Sorry for a late reply, I've been away for a few months due to college and stuff. I tested it with your latest release and now it reduces ship's monopropellant properly when transfering it to jetpack. Good work :D

  2. I finally figured it out. The problem was, I was taking my ship's current orientation as a prograde value, but it's never perfectly facing prograde in-game, there are always some micro movements and variations, that's why I couldn't get exact vectors.
    Now I took the actual prograde vectors and converted them to heading and pitch like this:

    progradePitch = asin(-(progradeY))
    progradeHeading = atan2(progradeX, progradeZ)

    And then just used the formulas I mentioned in my last comment and got velocity vectors with 100% accuracy :D

  3. 9 hours ago, K^2 said:

    z = sin(pitch)

    Also, keep in mind that this assumes that you are using the local XYZ coordinates with respect to which pitch and heading are given. It will mean that your Y axis points North, X points East, and Z points to Zenith. This is fine, if these are the coordinates required, but might need to be adjusted for a different convention.

    If your coordinates are relative to SoI, however, with Z or Y always pointing along the planetary axis, then you'll have to adjust the transformation based on where you are located. It's significantly more math to transform from local pitch and heading to SoI XYZ coordinates, so @Cannon if that's the conversion you need, please reply or mention, and I'll give you the steps. It's just too much to type out if it's not what you're looking for. :sticktongue:

    Well, here's what I'm actually doing, I make the rocket that's about to go through reentry and eventually land, with its apoapsis at 85k and periapsis at 20k. So I orient it towards prograde and then I extract  heading and pitch once it's facing prograde, because I assume that is also the direction of velocity vectors. But then the tricky part seems to be in choosing the right reference frame just as you suggested. Before I explain any further, here's the explanation of what each reference frame means:

    sSW2Wcb.png
    BwX3fkj.png

    So, my velocity in the program matches the in-game velocity if I use celestial body orbital reference frame, but my pitch and heading will only match the in-game pitch and heading if I use vessel surface reference frame.
    I have tried to play around with those reference frames now, to see if I can get different results for my vectors. 

    If I extract pitch value using celestial body orbital reference frame and heading value using vessel surface reference frame I get 2 of the vectors very close to the correct values.
    Here's what I get:
     

    pitch=-10.908204  //It doesn't match the in-game pitch which is about -1 or 0 at most.
    heading=89.91391 //Matches the in-game heading value
    vMag=2219.828828308464 //Matches the in-game orbital velocity
    xx=3.2752230972366845
    yy=2179.717671720176
    zz=-420.07162662308826
    vectors=[-416.6260029541221, -2180.3798267286315, 2.5713511279416803]

    Notice how "zz" and "yy" values are very close to the first and second value of vectors, even though "yy" is lacking the negative sign. But the "xx" is still not that close to the third number.
    These are the formulas I used to get those results:
    xx=|vMagnitude| * (cos(heading) * cos(pitch))
    yy=|vMagnitude| * (sin(heading) * cos(pitch))
    zz=|vMagnitude| * (sin(pitch))

    Objectively, they're still not 100% accurate results, but are very close now. I'm running out of ideas what to try next though :D

  4. 1 hour ago, Nuke said:

    be sure to convert degrees to radians and vise versa as needed. most trig functions operate on radians.  

    also a vector cannot have a negative magnitude. so if you get one you might have a problem. 

    you need to compute each component separately. 

    x = sin(heading)
    y = cos(heading)

    i want to say z would be the sine of the pitch but im not 100% sure right now. 

     

    Yup, converted all to radians, but it still gives wrong numbers. 
    For example x=sin(heading) would be x=sin(90.389) or for radians x=sin(1.57), and the result of that is 0.99, doesn't match any of the extracted velocity vectors in  [-72.25886975259107, -2209.998264874299, 1.6282022342777325]

    Here's part of my code too, it might help if you notice any errors:

    Triplet<Double,Double,Double> velocity = vessel.flight(refDelta).getVelocity();
    System.out.println("vectors="+velocity); //Prints out  [-72.25886975259107, -2209.998264874299, 1.6282022342777325]
    
    double vMag = Math.sqrt(velocity.getValue0() * velocity.getValue0() + velocity.getValue1() * velocity.getValue1() + velocity.getValue2() * velocity.getValue2()); //Calculate magnitude of velocity
    float pitchA = vessel.flight(vessel.getSurfaceReferenceFrame()).getPitch();
    float headingA = vessel.flight(vessel.getOrbit().getBody().getReferenceFrame()).getHeading();
    System.out.println("pitch="+pitchA);
    System.out.println("heading="+headingA);
    pitchA *= (Math.PI/180); //Conversion to radians
    headingA *= (Math.PI/180); //Conversion to radians
    
    double radiusAlt = vessel.getOrbit().getBody().getEquatorialRadius() + vessel.flight(vessel.getOrbit().getBody().getReferenceFrame()).getMeanAltitude(); //Radius + Current Altitude
    double vLat = vessel.getOrbit().getBody().latitudeAtPosition(vessel.position(vessel.getOrbit().getBody().getReferenceFrame()), vessel.getOrbit().getBody().getReferenceFrame()); //Get Latitude
    double vLon = vessel.getOrbit().getBody().longitudeAtPosition(vessel.position(vessel.getOrbit().getBody().getReferenceFrame()), vessel.getOrbit().getBody().getReferenceFrame()); //Get Longitude
    
    vLat *= (Math.PI/180); //Conversion to radians
    vLon *= (Math.PI/180); //Conversion to radians
    
    //Formulas for x,y,z vector calculation (I've tried with previously mentioned formulas too, didn't work)
    double xxx = Math.abs(vMag)*((Math.cos(headingA)*Math.cos(pitchA))*vLat);
    double yyy = Math.abs(vMag)*((Math.sin(headingA)*Math.cos(pitchA))*vLon);
    double zzz = Math.abs(vMag)*((Math.sin(pitchA))*radiusAlt);
    double xyz = Math.abs(vMag)*((Math.cos(headingA)*Math.cos(pitchA))*vLat+(Math.sin(headingA)*Math.cos(pitchA))*vLon+(Math.sin(pitchA))*radiusAlt);
    
    System.out.println("pitch="+pitchA);
    System.out.println("heading="+headingA);
    System.out.println("xx="+xxx);
    System.out.println("yy="+yyy);
    System.out.println("zz="+zzz);
    System.out.println("xyz="+xyz);
    System.out.println("vLat="+vLat);
    System.out.println("vLon="+vLon);

     

  5. 25 minutes ago, cubinator said:

    Sounds like you have enough information to make a unit direction vector using the given angles, and multiply it by your magnitude. 

    I tried using those 2 formulas but it's not giving me the correct results

    X=(magnitude)*(cos(heading))
    OR
    X=(magnitude)*(cos(pitch))
    OR
    x=(magnitude)*sin(heading)*cos(heading)
    OR
    x=(magnitude)*sin(heading)*cos(pitch)
    OR
    x=(magnitude)*sin(pitch)*cos(heading)
    OR
    x=(magnitude)*sin(pitch)*cos(pitch)

    I've tried all of the above combinations and none of them produced any of the correct numbers  [-72.25886975259107, -2209.998264874299, 1.6282022342777325]

  6. Don't know if this is the right place to ask this, but I couldn't find any better.

    A spacecraft is travelling at given velocity. Velocity vectors are = [-72.25886975259107, -2209.998264874299, 1.6282022342777325]. When I calculate the magnitude of it, I get 2211.18m/s. That's easy to do. But what if I have to calculate all 3 vector components when I only have magnitude?

    Spacecraft bearing/heading is 90.389° so it's heading south-east, and its pitch is -1.725° which means it's going slightly "below the horizon"/towards the ground. I tried this formula: X=(magnitude)*(cos(heading)) to get one of the vectors but I know solution is incorrect because it's not equal to any of the vectors I wrote at the start. X=(2211.18)*(cos(90.389)=-15.01 .

    I also tried a formula from here which goes x=ρsinφcosθ.

    I used magnitude (2211.18m/s) as "ρ" value, and 90° for both θ and φ, since direction is 90° south of north pole, and 90° towards east too. So, x=2211.18*sin(90)*cos(90)*=-15,

    the result was -15, which still doesn't match any of the vector components [-72.25886975259107, -2209.998264874299, 1.6282022342777325]

    So how do I calculate it then?

    I'm trying to create something with krpc mod, and a certain function requires velocity vectors as input, instead of velocity's magnitude (2211.18m/s).

  7. 11 hours ago, Goufalite said:

    Great! What you can do now is change in the savefile all the reinitResourcesOnStoreInVessel to False so you won't have to send "uncursed" jetpacks to your kerbals ;)

    After looking at the KSP.log I find contradictory elements, sometimes it says the ModuleEvaRefueler doesn't have a RESOURCES_NEEDED node, sometimes it works... Can you put the content of the GameData/OreToParts/Patches/oretanks.cfg file here so I can see if there is something missing ?(I know there is a typo "}1" but it doesn't seem to block...)

    I'm preparing a debug heavy update so we can see what's wrong...

    EDIT : here it is : https://drive.google.com/file/d/1oJg6_IxxKCEUw6dphv-pnUeoLWYSjSmA/view?usp=sharing

    • replace the OreToParts.dll in the GameData/OreToParts/Plugins/ folder
    • pop the console (Alt-F12)
    • do the "refuel EVA fuel"
    • either put a screenshot of the console or a KSP.log after the refuel EVA action

    Alright, I changed all of reinitResourcesOnStoreInVessel to False and I fixed the typo in oretanks.cfg, and also replaced the OreToParts.dll.

    However, ship's monopropellant still doesn't get reduced after refuelling :(

    Here's the oretanks.cfg file and a console screenshot:

     

    agVG0TT.png

  8. For anyone trying to use LaunchOrbit java code from tutorials, there is a problem in every while loop. Basically lots of variables aren't declared as "volatile" which causes different threads to not be synchronized, and then your while loop keeps going on forever without doing anything. The reason for that is the JVM is allowed to assume that other threads do not change some of the variables during the loop. The proper fix would be to make them all "volatile", but you can also fix it more easily by adding the following at the start of every loop:

    System.out.print(".");
    System.out.print("\b");

    This will add a dot and then delete it every time, but what it does is force syncrhronization which makes the loop work properly.

  9. For anyone trying to use LaunchOrbit java code from tutorials, there is a problem in every while loop. Basically lots of variables aren't declared as "volatile" which causes different threads to not be synchronized, and then your while loop keeps going on forever without doing anything. The reason for that is the JVM is allowed to assume that other threads do not change some of the variables during the loop. The proper fix would be to make them all "volatile", but you can also fix it more easily by adding the following at the start of every loop:

    System.out.print(".");
    System.out.print("\b");

    This will add a dot and then delete it every time, but what it does is force syncrhronization which makes the loop work properly.

  10. 4 hours ago, Goufalite said:

    @Cannon

    Hello, thanks for the info and the testbench! 

    You have a lot of mods but I managed to reproduce the refueling behavior on the OLD save only with my mod  (and interestingly without Module Manager since I made a clean install to test :o).

    This is due to the fact that the savefile persisted the "reinitResourcesOnStoreInVessel" field on existing parts. What's wierd is that it happens on a brand new ship in the old save (even after completely replacing the jetpack in the VAB). I'm looking into this...

    I didn't have any problems pumping monoprop in the NEW save tho... Maybe it's a mod conflict (I see in the log you have KIS/KAS and your kerbals in the OLD save had electric charge). Can you put a readable mod list and eventually clone your KSP install and remove progressively "obvious" resource changing mods so we can find the culprit ? I'll test with KIS/KAS on my side.

    Alright, I'll try that.

    The list of mods is:

    -ClickThroughBlocker
    -ToolbarControl
    -Astronomers Visual Pack
    -Chatterer
    -Distant Object Enhancement
    -Engine Light Relit
    -Environmental Visual Enhancements
    -KAS
    -KIS
    -Kopernicus
    -Loading Screen Manager
    -Modular Flight Integrator
    -NASA Countdown Clock
    -Docking Port Alignment Indicator
    -Parallax
    -Planetary Base Systems
    -Planet Shine
    -Scatterer
    -SunflaresOfMaar
    -TAC Life Support
    -TUFX
    -Vapor Vent

    4 hours ago, Goufalite said:

    I didn't have any problems pumping monoprop in the NEW save tho... 

    I could also refuel the jetpacks in the new save BUT it still wasn't reducing the monopropellant of the ship, so I could refuel as many times as I want. I assume it should reduce the ship's monopropellant by an equal amount that the jetpack refueled with. And if ship has no monopropellant left, you should be unable to refuel.

    EDIT: Even after removing all mods (except this one) on the new save, the refueling still doesn't reduce ship's monopropellant.

    EDIT2: I managed to stop automatic refuel (upon entering the ship) in the old save without removing any mods, if I put a new jetpack in VAB. It still doesn't reduce ship's monopropellant when I click refuel though.

  11. 2 hours ago, Goufalite said:

    Can you provide more informations for me to investigate : 

    - where did you put the evafix.cfg file ? (it must be in the GameData folder)

    - on which gamemode are you playing (sandbox,...) ?

    - on which version are you playing and do you have the DLCs ?

    - can you provide the KSP.log and a savefile (a quicksave is fine).

    My mod doesn't refuel automatically, you need to click on "Refuel EVA fuel" in the command pod's PAW. Automatic refueling was made in the EVA Fuel mod (which is not up to date with 1.11)

    Thanks.

    -I put the evafix.cfg inside the CustomPatches which is in GameData folder

    -I'm playing the career mode

    -Version is 1.12.2.3167 and I do have breaking ground dlc (1.7.1)

    -Sure thing, here's ksp.log and quicksave .

    However, I've also tested with new save, I mean I started new career mode from scratch, just to try it out. In new save, the jetpack actually wasn't refilling automatically by itself (while it does in old save), so that part was working properly now. However, when I clicked on "refuel EVA fuel" it still wasn't taking/reducing the ship's monopropellant, but it did refuel the jetpack. So basically this still gives me infinite fuel because I can refuel in the ship infinite amount of times.

    I decided to include the quicksave of the new game too, here it is .
    I don't want to abandon my old save though, this was just to test it.

     

    EDIT: fixed the link for new save

  12. I did everything as you said, but jetpacks are still getting refueled upon entering the ship, without reducing the ship's monopropellant.

    I made a "CustomPatches" folder and then a file inside it called "evafix.cfg" and I put this in it:

    //Disable EVA jetpack infinite fuel
    @PART[evaJetpack]
    {
        @MODULE[ModuleCargoPart]
        {
            %reinitResourcesOnStoreInVessel = false
        }
    }
    
    @PART[evaCylinder]
    {
        @MODULE[ModuleCargoPart]
        {
            %reinitResourcesOnStoreInVessel = false
        }
    }

    and then I downloaded your mod and put the folder "OreToParts" into GameData. I also enabled "Persist kerbal inventory loadout" in difficulty settings.

    Why is it not working properly?

  13. 7 hours ago, Spricigo said:

     

     

    I checked that one out, and it seems nobody managed to get as close as I did (~45000km), I guess I did a pretty decent job then :D. Anyways, I'd still like to perform that orbital survey, not because of the science, I already have everything unlocked. I simply want to have the orbital surveys of every celestial body, including the sun, it's just fun to me. The other topic you posted suggested that static radiators do more harm than good, can anyone confirm that? I used the static ones too as I said, but I placed folding radiators on top of them as well.

  14. Has anyone ever managed to perform an orbital survey/scan of the sun successfully (without mods or cheats of course) ?
    It requires a polar orbit with apoapsis no higher than 26000km. I spent 6 hours burning my dawn ion engine in order to make such orbit, and when I got there, the probe exploded at ~45000km, I tried quickloading and still couldn't get any closer than that. The probe only had a battery attached to it and some science stuff with 4 solar panels. I covered it with small radiators on all sides, everywhere I could, and I attached the big radiator panels on top of those small static radiators. I also covered the whole thing with 10m heat shields, both on top and the bottom. So, is the orbital survey even possible without cheats then? If so, what am I missing?


     

  15. 6 hours ago, shaw said:

    C'mon is does nobody look a page or two back the thread? Now, I'm really tired of explaining it why it happens and how to fix it (no, there's no way to fix it without other adverse effects).

    Changing reflectionInterval to 1 didn't fix it for me. Is there any other fix? Can I disable reflections completely?
    EDIT: Disabled them (reflectionType = none; isVisorReflectionEnabled = false), still no difference. Lips shaking like they have parkinson's.

×
×
  • Create New...