Welcome to Keen Software House Forums! Log in or Sign up to interact with the KSH community.
  1. You are currently browsing our forum as a guest. Create your own forum account to access all forum functionality.

IMyLandingGear "Ready To Lock"

Discussion in 'Programming Questions and Suggestions' started by Wicorel, Oct 15, 2016.

Thread Status:
This last post in this thread was made more than 31 days old.
  1. Wicorel Senior Engineer

    Messages:
    1,262
    What's the best way to detect if a landing gear is "Ready To Lock"?

    There doesn't seem to be a property for this..

    I currently have this code, but I think there should be something better...

     
  2. Elfi Wolfe Apprentice Engineer

    Messages:
    498
    I thought I had an answer... but I do not.
    I detected when landing pad gears are locked, and turn a light green. Not is ready to lock.
     
  3. Lynnux Junior Engineer

    Messages:
    881
    No, I didn't see that. There's not even a name for IsLocked to be used in the GetValueBool(string propertyId) method...
    Maybe time for KSH to whitelist the LockMode. It's very similar to the piston status so I don't see a reason why this shouldn't be available in the PB.
     
  4. d4rky1989 Apprentice Engineer

    Messages:
    332
    Can sensors detect ground? If yes, then build them somwhere near to the landing gears and configure the detection zone accordingly. Maybe this will be accurate enough
     
  5. Phoera Senior Engineer

    Messages:
    1,713
    you can read text from action.
     
  6. Gakhon Trainee Engineer

    Messages:
    87
    Not sure if this is the best solution, but the DetailedInfo property contains it in the form of a "Lock State: Ready To Lock" line in the returned string.

    I.e.:

    Code:
    public bool IsLandingGearReadyToLock(IMyLandingGear gear)
    {
        return gear.DetailedInfo.Contains("Ready To Lock");
    }
     
  7. Wicorel Senior Engineer

    Messages:
    1,262
    Yes. That's what the code I showed does.
     
  8. Wicorel Senior Engineer

    Messages:
    1,262
    With the additions in 1.172, there is now a way.

    Code becomes:

    Code:
    bool gearReadyToLock(IMyTerminalBlock block)
    {
    	IMyLandingGear lGear;
    	lGear = block as IMyLandingGear;
    	if (lGear == null) return false;
    
    	if (lGear.LockMode == LandingGearMode.ReadyToLock) return true; 
    	else return false;
    }
    
    
     
Thread Status:
This last post in this thread was made more than 31 days old.