Jump to content

Keith Young

Members
  • Posts

    55
  • Joined

  • Last visited

Posts posted by Keith Young

  1. 8 hours ago, PeteWasEre said:

    So i made some progress on landing guidance. if anyone else would like it here it is. It sets up lines either side of the runway at 4 (red), 5 (white) and 6 (yellow) deg slope for 20km from runway 09 threshold. 3.5 degrees, as per an airliner, did not seem kerbal enough so i went for a military 5. A shuttle 21 deg approach could be interesting too for an unpowered craft.

    The only shame is that it is hard coded. I cant find a way to calculate them directly, which would be nice so you can tune slope / distance. I used a test rig comprising a Mk1 cockpit on the front of a T frame of girders with some more girders for legs so i know the rig will sit as flat and straight as possible. This was important as it lets me use the vessels reference frame as a runway reference frame. 

    I could then define the start and end position for each line in the 'runway reference frame'. The starts are simply (+/-30,0,0) and the ends are (+/-30, -length, -tan(slope)*length). Each of these points (2 start, 6 end) are transformed into the kerbin reference frame using space_center.transform_position() and pasted into the code.

    To get the other end you just need to rinse/repeat with a vessel at the other threshold, but make sure it sits dead flat (pitch and roll).

    
    import krpc
    
    conn = krpc.connect(name='blah')
    vessel = conn.space_center.active_vessel
    
    conn.space_center.clear_drawing()
    
    v1_start = (158095.3939033646, -478.99761794020907, -578869.7132278137)
    v2_start = (158094.96184479096, -538.996063121335, -578869.7134211722)
    v1l_end = (139184.84695719907, -342.79930986318584, -585527.6834731719)
    v1m_end = (139278.06869656406, -343.45641409607947, -585866.255670956)
    v1h_end = (139371.60232570115, -344.14248819162003, -586205.9386240399)
    v2l_end = (139184.35853335817, -402.79511157271287, -585527.523517651)
    v2m_end = (139277.66372229127, -403.45750069248425, -585866.328863767)
    v2h_end = (139371.1656752824, -404.1432818151327, -586205.927123417)
    
    
    l_col = (255,0,0)
    m_col = (255,255,255)
    h_col = (255,255,0)
    
    conn.space_center.draw_line(v1_start, v1l_end, vessel.orbit.body.reference_frame, l_col)
    conn.space_center.draw_line(v1_start, v1m_end, vessel.orbit.body.reference_frame, m_col)
    conn.space_center.draw_line(v1_start, v1h_end, vessel.orbit.body.reference_frame, h_col)
    conn.space_center.draw_line(v2_start, v2l_end, vessel.orbit.body.reference_frame, l_col)
    conn.space_center.draw_line(v2_start, v2m_end, vessel.orbit.body.reference_frame, m_col)
    conn.space_center.draw_line(v2_start, v2h_end, vessel.orbit.body.reference_frame, h_col)

     

    Pseudo code:

    if vessel.name == 'shuttle'
      slope = 21

    elif vessel.name == 'airliner'

      slope = 3

    Then set up vectors.

  2. I second the need for map view, moving camera, bringing up the menu, etc. I think you know the project I'm working on and it would help a TON. Also quicksave and quickload.

    One problem I notice, that I'm not sure if you're aware of, is to get target_pitch_and_heading to work, I have to stop and start the server between runs. Say I launch and revert, pretty much everything works except the rocket won't aim where I want it. Stopping and starting the server seems to fix this.

    Again, thanks a ton for such an amazing mod!!! I hope 1.1 doesn't break it too much :)

  3. I'm having some trouble getting this to work.

    I installed both Python 3.5 and 2.7. I can start a client and I can get KSP to recognize a program is trying to access KSP.

    When I try your Sub Orbital tutorial I get a bunch of red text in Shell, including:

    UnicideDecodeError: 'utf8' codec can't decode byte 0xbe in potion 97: 'utf8' codec can't decode byte 0xbe in potion 97:: invalid start byte in field: krpc.schema.Response.error

    I'm using 1.0.4 and I downloaded that version from Curse.

    Am I correct that I can just write a script, save it as a .py, and double click it while I have a vehicle on the launch pad? Or I can open it in IDLE and run>run module?

    Thanks a ton for making this. I can't wait to get it to work.

  4. My project has been on the backburner. I had everything working great.

    I try making things work today and I'm getting this:

    KSPSerialIO: Found 3 serial ports
     
    (Filename: C:/buildslave/unity/build/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 56)

    KSPSerialIO: trying default port COM5
     
    (Filename: C:/buildslave/unity/build/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 56)

    KSPSerialIO: KSP Display not found
     
    (Filename: C:/buildslave/unity/build/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 56)

    KSPSerialIO: trying port \Device\VCP0 - COM12
     
    (Filename: C:/buildslave/unity/build/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 56)

    Error opening serial port COM12: CreateFile Failed: 2
     
    (Filename: C:/buildslave/unity/build/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 56)

    KSPSerialIO: trying port \Device\VCP1 - COM5
     
    (Filename: C:/buildslave/unity/build/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 56)

    Error opening serial port COM5: Access to the requested resource is not authorized.

    It's very strange. I don't remember ever seeing this before. I did transfer my license to another computer for a bit and transfer back. But I don't see why it should be doing this.

    Any ideas for what would be causing "Access to the requested resource is not authorized", and "CreateFile Failed: 2"?

  5. I just found this and I'm beginning to dig in.

    I'm making a little simpit (simulator with physical switches for RCS etc).

    Do you think this will interface well with KSPIO?

    I want to be able to receive ship data such as Apogee, and send data such as buttons to control RCS, Autopilot modes, etc, maybe even some throttle values etc.

    Do you think it would be possible to control the ship with Python code written on a Raspberry Pi?

    Sorry for so many questions. Starting to read the documentation etc right now.

    THANKS! This looks awesome!

  6. 3 hours ago, zitronen said:

    Ah.. which version of the plugin are you using? I can recompile it for you or you can do it yourself. I don't intend on adding support for MJ or anything else because it's hard enough debugging hardware firmware and software problems over the interwebs. The best option is to try to fork the plugin to do you own thing, which a quite a few people have done.

    I'm currently using 1.04 but will be upgrading to 1.05 probably soon.

    I'm not sure but I think the problem is in the SerialPort.dll.

  7. Nope, I haven't tried that yet.

    My main computer is 8.1 but I'm looking to buy a new computer for my simpit since I want 3 monitors at 1080 and I currently only have a 2GB graphics card in my 8.1 machine.

    All these new XPS affordable rigs seem to be 10 these days. Unfortunately the sales on these to make them affordable are coming up in a few days.

    It's going to be crucial to get the ship data to the microcontroller.
  8. It does compile fine.

    The problem is when I try to make a fork of MechJeb. So I copy the MechJeb source, and put the cs files in from your mod.

    I add them as existing.

    I also bring in SerialPort.dll

    I include SerialPort.dll as a reference

    When I try to build my copy of MechJeb it says in the KSPIO.cs that on the line using OpenNETCF.IO.Ports; that OpenNETCF can't be found.

    It's very strange since I can even type Ope... which results in Visual Studio finding OpenNETCF so all I have to do is hit "." at which point it finds IO, so I hit "." again and it has Ports.

    So somehow Visual Studio is finding the namespace of OpenNETCF and yet when I build, it gives the error I copied in.

    I've had no problem with your code. This is outside something you caused. I just wonder if you know what might be causing this behavior. It seems strange that I'm including SerialPort.dll as a reference and it's still doing this.

    I was wondering if you had another step besides adding it as a reference in order to get the namespace of OpenNETCF to hold up when building.

    Basically what I'm trying to do is get Microcontroller buttons to launch MechJeb autopilot functions.

    Thanks for such an awesome mod! I couldn't make this simulator without it.
  9. I am trying to get this to work in a MechJeb fork. However using OpenNETCF.IO.Ports; isn't working.

    Error 9 The type or namespace name 'OpenNETCF' could not be found (are you missing a using directive or an assembly reference?)

    I copied SerialPort.dll over, and added as a reference.

    Was there a trick you did? For example I see a lot of references they don't have, such as System.Data.DataSetExtensions.

    Is there something in particular I need to do to get this to compile, based on this error?

    It's strange. I even opened SerialPort.dll in the browser, and copied OpenNETCF.IO.Ports in to the code.
  10. Hi Zitronen

    Thanks again for such an amazing mod. This is really helping me build my simpit.

    I am currently trying to make a better autopilot. I can already turn on my basic autopilot using your additional byte.

    To improve my autopilot I need to know the current available thrust of my vessel.

    I currently see this chunk of code:

    [CODE]
    // this recursive stage look up stuff stolen and modified from KOS and others
    public static List<Part> GetListOfActivatedEngines(Vessel vessel)
    {
    var retList = new List<Part>();

    foreach (var part in vessel.Parts)
    {
    foreach (PartModule module in part.Modules)
    {
    var engineModule = module as ModuleEngines;
    if (engineModule != null)
    {
    if (engineModule.getIgnitionState)
    {
    retList.Add(part);
    }
    }

    var engineModuleFx = module as ModuleEnginesFX;
    if (engineModuleFx != null)
    {
    var engineMod = engineModuleFx;
    if (engineModuleFx.getIgnitionState)
    {
    retList.Add(part);
    }
    }
    }
    }

    return retList;
    }
    [/CODE]

    And there are some other methods as well.

    I was wondering if you know how I can find the maximum available throttle? I don't think I see anywhere where you are utilizing retList. I'm pretty new to this, so I don't see where/how I can find the maximum available throttle, or the current mass flow, etc.

    Do you know how to do this? Is there something I'm overlooking in your code you can point me to?

    Thanks again!
×
×
  • Create New...