Outerra forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Outerra Tech Demo download. Help with graphics driver issues

Author Topic: Extended controls  (Read 5776 times)

bomber

  • Hero Member
  • *****
  • Posts: 510
  • newbie
Extended controls
« on: July 22, 2014, 02:23:55 pm »

Hi there,

Actually this is a question I have to ask and I mean keyboard binding...

I need to be able to extend the control of jsbsim 'systems' using the keyboard... there's more to a plane that throttle and joystick.. I have fuel, hydraulics, pneumatics etc systems that use keyboard button presses as commands...

For instance on a 4 engined plane, you might need to be select the outside engine port engine only and turn it off, and then feather, or select the fire extinguisher for that engine.

I also need to be able to bind keyboard based on the current camera selection...so if I'm in the pilots seat my joystick and keyboard controls the functions that a pilot uses only... when I jump to the navigators position I expect the plane to be automatically be put on autopilot pre-sets and for the keyboard and joystick to now operate the navigators functions, same for the bombaimer and gunners etc.

Please give it some thought... it's not an urgent thing but it might be something you want to think about.

Regards

Simon
« Last Edit: July 22, 2014, 02:26:12 pm by bomber »
Logged
"If anyone ever tells you anything about an aeroplane which is so bloody complicated you can't understand it, take it from me - it's all balls" - R J Mitchell

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6663
  • Pegs is clever, but tae hain’t a touch sentimental
    • outerra.com
Re: Extended controls
« Reply #1 on: July 22, 2014, 04:27:36 pm »

Extra keyboard/joystick bindings will be possible by two things: a global configuration file with bindings of custom action names to input events (from keyboard, joysticks or input plugins), and by allowing to register for actions in aircraft/vehicle scripts.

Engine already internally supports action groups, that can get activated whenever you want, so you'll be able to activate groups you want based on changing the seat, for example, or anything else from the script.
Logged

bomber

  • Hero Member
  • *****
  • Posts: 510
  • newbie
Re: Extended controls
« Reply #2 on: July 22, 2014, 07:05:33 pm »

Sounds good...
Logged
"If anyone ever tells you anything about an aeroplane which is so bloody complicated you can't understand it, take it from me - it's all balls" - R J Mitchell

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6663
  • Pegs is clever, but tae hain’t a touch sentimental
    • outerra.com
Re: Extended controls
« Reply #3 on: August 17, 2014, 04:02:52 pm »

Is there a list of universal control actions for aircraft that we could use?

Current aircraft controls are listed in iomap.cfg in section "plane". Each action is identified by a name, which is an arbitrary string, and can have multiple bindings to keyboard buttons or joystick buttons/axes. From inside the engine, an action is identified as section/action, e.g "plane/elevator_up". Right now the existing actions are coupled to JSBSim on the background, but this should be handled in a script (possibly by a universal/compiled script, included from model scripts for simplicity, but overridable).

Extended controls will be in a separate config file, listing all the generic aircraft controls. It can be also possible to have special actions for individual aircraft models, listed in a cfg file inside the model's package, but obviously this should be kept at minimum and only for some non-standard things.

So the question is - can we come up with a base control actions list, which will contain all common action names (and possibly the default bindings as well), that can be then bound and handled in the aircraft scripts? Scripts will register for actions they want to receive, using the action names, binding them to script methods.
Logged

bongodriver

  • Full Member
  • ***
  • Posts: 106
  • newbie
Re: Extended controls
« Reply #4 on: August 17, 2014, 07:36:03 pm »

This sounds good, as a real life pilot I hope I can help out with ideas for a decent set of control options.
Logged

bomber

  • Hero Member
  • *****
  • Posts: 510
  • newbie
extended controls
« Reply #5 on: August 18, 2014, 09:59:11 am »

Logged
"If anyone ever tells you anything about an aeroplane which is so bloody complicated you can't understand it, take it from me - it's all balls" - R J Mitchell

Mossie

  • Jr. Member
  • *
  • Posts: 22
  • newbie
Re: Extended controls
« Reply #6 on: August 18, 2014, 10:09:57 am »

Should add out keyboard definition set, as stated in http://forum.outerra.com/index.php?topic=2798.msg29398#msg29398

Could be a good starting point, some of the items could change, such as positions, gunner to positions, role. Etc.
Logged

bomber

  • Hero Member
  • *****
  • Posts: 510
  • newbie
Re: Extended controls
« Reply #7 on: August 18, 2014, 11:09:53 am »

I think that's a point of like to see made, that the currently ocuppied position within a vehicle determines which configuration file for the camera/joystick/keyboard/mouse is being used.
Logged
"If anyone ever tells you anything about an aeroplane which is so bloody complicated you can't understand it, take it from me - it's all balls" - R J Mitchell

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6663
  • Pegs is clever, but tae hain’t a touch sentimental
    • outerra.com
Re: Extended controls
« Reply #8 on: August 18, 2014, 12:16:06 pm »

Event groups are made for that, that can get activated/deactivated from script. If the actions can be arranged into groups by seat (or by a named camera position), then script can enable the ones it wants for given position.
Logged

bomber

  • Hero Member
  • *****
  • Posts: 510
  • newbie
Re: Extended controls
« Reply #9 on: August 18, 2014, 02:02:27 pm »

You're almost there with the iomap.default.cfg file.... just need to have one for each position (not a single file with it all in, I'm a modular guy) that overwrites the previous values from the previous position.

If given something like flightgears keyboard.xml then we can do everything wanted...

http://target4today.com/_posted_images_/2014-08/keyboard.xml

right click save as




Logged
"If anyone ever tells you anything about an aeroplane which is so bloody complicated you can't understand it, take it from me - it's all balls" - R J Mitchell

bomber

  • Hero Member
  • *****
  • Posts: 510
  • newbie
Re: Extended controls
« Reply #10 on: August 18, 2014, 02:46:48 pm »

Just wanted to show you this as well.... this is what I have in the FG's equivalent of those Comet space ships...

Code: [Select]
<input>
<keyboard>
<!--  ANTI-GRAVITY   -->
<key n="103">
<name>g</name>
<desc>Toggle anti-gravity</desc>
<binding>
<command>property-toggle</command>
<property>/fdm/jsbsim/anti-gravity/system-isolator</property>
</binding>
</key>
<!--  BOUANCY   -->
<key n="98">
<name>b</name>
<desc>Toggle bouancy</desc>
<binding>
<command>property-toggle</command>
<property>/fdm/jsbsim/anti-gravity/bouancy-selector</property>
</binding>
</key>
</keyboard>
</input>

This short overwrite of the standard keyboard functionality gives me control of the anti-gravity and buoyancy systems within the JSBsim systems code...

Easily could have an auto-pilot system to be turned on and off , or fuel pumps, hydraulics, pneumatics etc All done in the JSBsim environment..

And yes the code for it can look strange to those using a OO language.
Logged
"If anyone ever tells you anything about an aeroplane which is so bloody complicated you can't understand it, take it from me - it's all balls" - R J Mitchell

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6663
  • Pegs is clever, but tae hain’t a touch sentimental
    • outerra.com
Re: Extended controls
« Reply #11 on: August 18, 2014, 04:35:51 pm »

So that's just for the keyboard, and directly maps keys to JSBSim properties?

It's a bit different in OT, iomap files define the keyboard, joystick or custom input addon bindings for actions, what the actions map to for the user. Actions listed there do not have any relation to a particular simulation engine.

Scripts then determine how the actions are handled for that particular vehicle. There will be common scripts that implement action handling for JSBSim aircraft, so that implementing a typical action handling will reduce to call of a library function. But it's always on the vehicle script to tell what action handling it wants to use, since there are multiple physics cores for different vehicle types, and even multiple simulator cores for the same type. Vehicle script can also handle the actions individually.

The scripts also determine what subset of actions is active at given time, depending on whatever condition is deemed important for it, be it a camera position or anything else.

Default iomap files provide templates for the user mappings on first use. If a vehicle script requires an unknown action, it could be simply added to user's cfg file, so that the user can bind it to a key or joystick button etc.

So what I'm looking for here is a list of common actions to be added into the default aircraft iomap file (or multiple files divided by seats), that would cover the most common actions in use.
Logged

bomber

  • Hero Member
  • *****
  • Posts: 510
  • newbie
Re: Extended controls
« Reply #12 on: August 18, 2014, 05:17:39 pm »

no it doesn't directly map keys to jsbsim properties... it does other stuff like runs a script

Code: [Select]
  <name>Ctrl-A</name>
  <desc>Toggle autopilot altitude lock</desc>
  <binding>
   <command>nasal</command>
   <script>
     var node = props.globals.getNode("/autopilot/locks/altitude", 1);
     if ( node.getValue() == "altitude-hold" ) {
       node.setValue( "" );
     } else {
       node.setValue( "altitude-hold" );
     }
   </script>
  </binding>
 </key>

Adjusts a property value by a defined amount..

Code: [Select]
<key n="13"> <!-- PLIB -->
  <name>Enter</name>
  <desc>Move rudder right</desc>
  <repeatable type="bool">true</repeatable>
  <binding>
   <command>property-adjust</command>
   <property>/controls/flight/rudder</property>
   <step type="double">0.05</step>
  </binding>
 </key>

Applies a value to the brake script when the keys presses and another value when not pressed

Code: [Select]
<key n="44">
  <name>,</name>
  <desc>Left brake</desc>
  <binding>
   <command>nasal</command>
   <script>controls.applyBrakes(1, -1)</script>
  </binding>
  <mod-up>
   <binding>
    <command>nasal</command>
    <script>controls.applyBrakes(0, -1)</script>
   </binding>
  </mod-up>
 </key>

Does different things depending upon if the shift key is pressed or not

Code: [Select]
<key n="52">
  <name>4</name>
  <desc>Move aileron left (or adjust AP heading.)</desc>
  <repeatable type="bool">true</repeatable>
  <binding>
   <command>nasal</command>
   <script>
     controls.incAileron(-0.05, -1.0)
   </script>
  </binding>
  <mod-shift>
   <desc>Look left</desc>
   <binding>
    <command>property-assign</command>
    <property>/sim/current-view/goal-heading-offset-deg</property>
    <property>/sim/view/config/left-direction-deg</property>
   </binding>
  </mod-shift>
 </key>

But to answer your question I'll have a stab...

On a prop engined plane...

Engine 1 2 3 4 5 etc select with the throttle, prop blade angle, starter, controlling only those engines selected.

Someone else tag team for me as I've been on gliders for the last 2 years, and I seem to have forgotten how to control a multi-engined plane... :)

Simon
Logged
"If anyone ever tells you anything about an aeroplane which is so bloody complicated you can't understand it, take it from me - it's all balls" - R J Mitchell