c172p icon indicating copy to clipboard operation
c172p copied to clipboard

Amphibious : gears no longer retract

Open dany93 opened this issue 3 years ago • 9 comments

With the amphibious set, the landing gears no longer retract. Pressing g, G, does nothing.

dany93 avatar May 03 '22 15:05 dany93

Worse: neither it works with the install/flightgear/fgdata version.

dany93 avatar May 03 '22 16:05 dany93

If I press the "G" key, controls/gear/gear-down (=true) briefly toggles, but it immediately comes back to true.

If I press Ctrl+Click on controls/gear/gear-down-command, everything works, the gears retract and extend. Is there an issue in electrical.nas (line 476) ?

I just realized (rather didn't remember) that Clicking on the (amphibious) gear lever makes everything work. It may be on purpose. Only controlled by the gear lever. In this case, sorry for the disturbance

dany93 avatar May 04 '22 09:05 dany93

I think I should take a looked an see why the g key doesn't work. As far as I am aware it should. Do you know if it works on the Cub amphibious?

wlbragg avatar May 10 '22 14:05 wlbragg

Hi, @wlbragg

On the J3Cub amphibious, the G key (g or G) does nothing either. The gear lever (mouse click) works.

dany93 avatar May 10 '22 14:05 dany93

I want to check the key mappings an make sure I didn't simply overlook making one. I can't think of any reason not to have the gear bound to g. Do you know, in standard aircraft with gear, is it a lower or upper or both toggle up/down, or g/G for up and down? Brake used b/B I think. I would hope it to be consistent.

wlbragg avatar May 10 '22 16:05 wlbragg

From Keyboard bindings,

G | Gear up (that is: g)

⇧ Shift+G | Gear down (that is: G)


B | Apply all brakes

⇧ Shift+B | Toggle parking brake(s)

dany93 avatar May 10 '22 17:05 dany93

Thanks @dany93 Hum, so it looks like it should be working. I'll take a look and see if I can figure out what's wrong.

wlbragg avatar May 11 '22 04:05 wlbragg

@dany93 wrote

If I press the "G" key, controls/gear/gear-down (=true) briefly toggles, but it immediately comes back to true.

It seems that the lever position overwrites the G / g key action at every frame.

Normally, per default in FG and without any gear lever code or animation, g / G on the keyboard should make the gears retract or extend.

What I think is that:

  • mouse clicking on the gear lever (toggle action for changing the gear lever position) should send the same code as the default keyboard g / G,

(fgdata/keyboard.xml)

 <key n="71">
  <name>G</name>
  <desc>Gear down</desc>
  <binding>
   <command>nasal</command>
   <script>controls.gearDown(1)</script>
  </binding>
  <mod-up>
   <binding>
    <command>nasal</command>
    <script>controls.gearDown(0)</script>
   </binding>
  </mod-up>
 </key>

 <key n="103">
  <name>g</name>
  <desc>Gear Up</desc>
  <binding>
   <command>nasal</command>
   <script>controls.gearDown(-1)</script>
  </binding>
  <mod-up>
   <binding>
    <command>nasal</command>
    <script>controls.gearDown(0)</script>
   </binding>
  </mod-up>
 </key>
  • the gear lever position should follow the gear position (not control it). I'm wondering if the important is not <script>controls.gearDown(0)</script> for not preventing the control by keyboard.

The magnetos, parking brake, flap controls probably work like this (no overwriting at every frame).

Not sure I've seen everything well...

dany93 avatar May 11 '22 08:05 dany93

@wlbragg Maybe you could use controls.gearToggle() ? (see fgdata/nasal/controls.nas, line 356). (not sure, I'm too close from my limits in nasal)

dany93 avatar May 15 '22 14:05 dany93

@dany93 I saw this was left unresolved and decided to finish our discussion. I don't know the ramifications of not using an FG default like controls.gearDown(0). The c172p code is using /controls/gear/gear-down-command which in effect appears to be overriding /controls/gear/gear-down, which is what controls.gearDown(0) is mapped to or controlling. We have logic that maps /controls/gear/gear-down-command to /controls/gear/gear-down for the damage system. I don't know if that may be why I did it this way. I am concerned that a user expecting a mapping to /controls/gear/gear-down, say for a joystick, isn't going to work correctly. But an easy fix to get the keyboard G/g working is to map those keys to what we use, which is /controls/gear/gear-down-command. I also notice throughout the files we do try to set /controls/gear/gear-down. We do it in the mooring code, the checklists and the tutorials. But I am not sure it is even working as we also have that property being overridden by the following. So you really can't set it.

    <logic>
        <name>Amphibious Gear Hydraulic Damage</name>
        <input>
            <and>
                <equals>
                    <property>fdm/jsbsim/pontoon-damage/left-pontoon</property>
                    <value>0</value>
                </equals>
                <equals>
                    <property>fdm/jsbsim/pontoon-damage/right-pontoon</property>
                    <value>0</value>
                </equals>
                <property>controls/gear/gear-down-command</property>
            </and>
        </input>
        <output>
            <property>controls/gear/gear-down</property>
        </output>
    </logic>

I am under the weather at the moment with Covid and my brain is just not processing thing as it should. So I really need to keep this open and see if we can't remap everything to /controls/gear/gear-down instead of /controls/gear/gear-down-command. There should be no reason not to use the FG default for gear control.

I'm posting this now so as to refresh my memory as to what is going on with this code until I can get back to it.

@legoboyvdlp maybe you have something to say about this?

wlbragg avatar Oct 28 '22 20:10 wlbragg

@dany93 I took another look and added the key bindings for this. As far as I can tell this should be good to merge. If you have the time to test that would be great. I'll post the merge request here shortly.

wlbragg avatar Jan 31 '23 00:01 wlbragg