Jump to content
The simFlight Network Forums

Recommended Posts

Posted (edited)

I have a Spitfire control column which has a single analog brake lever. I wish to combine the input from this single brake lever with the analog rudder input to provide a differential breaking.

Can this be achieved? 

Edited by Sandy R
spellchekc
Posted
On 11/12/2022 at 8:49 PM, Sandy R said:

I wish to combine the input from this single brake lever with the analog rudder input to provide a differential breaking.

What do you actually mean by this? Does the spitfire actually have/support differential braking?
For differential braking, you would usually just assign one axis to the left brake control , and the other to the right brake control. For anything more complicated, you can assign the axis to a free FSUIPC offset and pick up the offset values/changes in a lua script (using event.offset) and process the values there and sent on whatever you want to achieve to the FS.

John

Posted

The real world Supermarine Spitfire effectively had differential breaking that were operated pneumatically by using the single brake lever atop the control column in conjunction with the rudder pedals. The rudder pedals when not used in conjunction with the brake still act as a straightforward rudder.  I wish to simulate this in my flightsim cockpit.

From your description it sounds as if this is possible. Can you point me at a tutorial suitable for the barely computer literate or an example doing something similar that I can crib please.

Sandy

Posted

I am not sure there us a suitable example for this... You can take a look at the lua examples provided (there will be a zip file of examples in your FSUIPC Documents folder).
If you could explain further how the differential braking works using this brake lever and rudder, I could help you with this. However, I am quite busy at the moment (need to get an update out for SU11....), so this would be at the weekend or maybe next week. But if you can provide more details (or a reference), I can provide you with a lua script that you could then tune to your needs. I do have the Flying Iron Spitfire (although I haven't had much time to fly this yet....) so I can do some testing here...

John

Posted

Thankyou so much - I shall look into the examples first and if I get stuck may have to come back to this post. I shall update if I have a successful outcome. 

Posted

Did you get anywhere with this?

On 11/14/2022 at 8:20 PM, Sandy R said:

The real world Supermarine Spitfire effectively had differential breaking that were operated pneumatically by using the single brake lever atop the control column in conjunction with the rudder pedals.

By 'single brake lever', do you mean the parking brake? There is no other lever I can see on the control column...

According to the spitfire documentation, the aircraft already has differential braking via the toe brakes, although it also says that currently only rudder-linked steering is implemented due to SDK limitations:

Quote

Directional control is maintained by the rudder pedals (particularly when the engine is powered up and
producing propwash) but also by the differential brakes. Tight turns can be achieved by using the toe
brakes and maximum rudder deflection. The aircraft uses a free castoring tail-wheel*, and has no linkage

to the rudder for steering. ***NB: At present in the simulator the Spitfire has rudder-linked steering due
to limitations with the MSFS SDK. This will be addressed in an update when true free-castoring wheels
become available in MSFS, at present we have done our best to ‘fake’ a free castoring wheel.

 

With this limitation (i.e. steering only via rudder), I don't think it will be possible to achieve proper differential braking...

John

Posted

The toe brakes that are mentioned refer to Saitek or similar sim rudder pedals. Both the Airplane Heaven Mk1 spitfire implementation and the Flying Iron Mk IX spit allow the toe brakes on typical SIM rudder pedals to be used for differential braking.

On a real spitfire (which my homebuilt cockpit closely resembles), what looks like a handbrake on the control column (as can be seen in the cockpit view of the sim), is in actuality the only brake control that the real spitfire had. There was a screw-in locking mechanism that locked the brake in the on position - this was the 'handbrake', a pneumatic valve configuration linked in with the rudder pedals allowed this single lever on the control column to also effectively operate as a differential brake.

I have had a look at the sample scripts in the documentation folder and I am sorry to say could not make head nor tail of them - I am not a quitter - have started watching a Youtube series on LUA programing and once I have some basic understanding I will revisit. This may take me some time though! 

I console myself that I am not alone in my ignorance as the settled view on the Authentikit forum - a site dedicated to people like me building 'Spitfire and similar Warbird' cockpits seemed convinced this was not possible! I am fairly confident this is exactly the kind of challenge at which FSUIPC excels, and I hope to be able to present them with a solution sometime.

Posted

Ok, I understand what you are trying to achieve a lot better now.

13 minutes ago, Sandy R said:

There was a screw-in locking mechanism that locked the brake in the on position - this was the 'handbrake', a pneumatic valve configuration linked in with the rudder pedals allowed this single lever on the control column to also effectively operate as a differential brake.

Maybe if you could expand on this, and how you expect to achieve this either with two axis (handbrake axis and rudder axis) or  an axis (rudder) and a button/switch/trigger (handbrake), then I could provide you with a basic lua script to emulate this behavior which you could then tune. Maybe some simple use-cases would be helpful: e,g, to turn left I would move...and then/also push,  , to turn right I would...,  etc

 

Posted

My thoughts on this was to use the two 'analog' axis inputs. Brake Lever and Rudder:

Rudder Input is always passed through unchanged to Rudder Control

Left Brake Control = (2*((100-Rudder)-50)*(Rudder<50)*Brake/100

Right Brake Control = (2*(Rudder-50)*(Rudder>50))*Brake/100

The above formula assumes all units are percent and in the case of the rudder 0% is full left 50% is neutral and 100% is full right.

 

Thus:

Brake lever 0% and Rudder pedal 50% (ie neutral) gives control inputs =                    Left brake 0%, Right Brake 0%, Rudder 50%

Brake lever 100% and Rudder pedal 50% gives control input =                                     Left Brake 100%, Right Brake 100%, Rudder 50%

Brake lever 100% and Rudder pedal 0% (ie full left rudder) gives control input=                  Left Brake 100%, Right Brake 0%, Rudder 0%

Brake lever 100% and Rudder pedal 100% (ie full right Rudder) gives control input=           Left Brake 0%, Right Brake 100%, Rudder 100%  

Posted
18 hours ago, Sandy R said:

Left Brake Control = (2*((100-Rudder)-50)*(Rudder<50)*Brake/100

Right Brake Control = (2*(Rudder-50)*(Rudder>50))*Brake/100

The above formula assumes all units are percent and in the case of the rudder 0% is full left 50% is neutral and 100% is full right.

Those formulas don't make sense - how can you multiply by (Rudder<50) or (Rudder>50) - they are conditional tests...

But I understand toughly what you are trying to achieve - alter the %ages sent to the toe brakes depending on the rudder position....

I have attached a script that you can use as a starting point to tune. To use this, you need to first copy the lua file to your FSUIPC7 installation folder and then have it auto-started by adding it either to your [Auto] section or your profile-specific [Auto.xxx] section (where xxx is the name of the spitfire profile).

You then need to assign both your rudder and brake lever axis in FSUIPC7 using Send to FSUIPC Offset with Offset Dword Set. The script uses offset 0xA000 for the rudder axis and 0xA004 for the brake lever axis - use these or update the script to the ones that you use.

I suggest that you try this with the console window open so that you can see what is happening and tune the formulae for your needs.

Some notes:
   - once you are happy with the script, you can turn off the logging by setting enableLog to false
  
 - the brake axes used (AXIS_LEFT_BRAKE_SET and AXIS_RIGHT_BRAKE_SET) are not actually linear: from the documentation:

Quote

Sets the left brake position from an axis controller (e.g. joystick) to the value given as the parameter [0], from -16383 (0 braking) to +16383 (maximum braking). Note that this is on a non-linear scale:

  1. -16383 = 0%
  2. -8191 = 8%
  3. 0 = 27%
  4. +8191 = 53%
  5. +16383 = 100%

   There are linear axis controls (AXIS_LEFT/RIGHT_BRAKE_LINEAR_SET) but these have not yet been exposed to the SDK (I have raised this with Asobo).
   - the script assumes both the axis value ranges are from -16383 to +16383 - if your axes are not in this range, including reversing, then you will need to calibrate to this range in the script - I have commented where you need to do this
   - the brake lever is used just for the maximum brake value
  - it is not 100% clear to me how the actual brake axis values should be calibrated...the script is always using the full brake lever axis value for one of the axis, and then decreasing the other axis based upon the value of the rudder axis. I implemented this way as you have 100% of both axis values when rudder is at 50%, so I didn't want to decrease this maximum value when using differential braking.
   - I am not sure if this will actually work (or make much of a difference)in the Flying Iron Spitfire due to the MSFS SDK and this note in the documentation:

Quote

***NB: At present in the simulator the Spitfire has rudder-linked steering due
to limitations with the MSFS SDK. This will be addressed in an update when true free-castoring wheels
become available in MSFS, at present we have done our best to ‘fake’ a free castoring wheel.

Anyway, this should at least give you a starting point. Let me know how it goes or if you have any questions. Please also return the script if you update/change this (so others can use).

John

spitfireBrake.lua

 

Posted

Thank you so much, this is fantastic. I know what I will be doing over the weekend.

I had included the conditional tests in the formulae as many programming languages, (and interestingly excel), returns a '0' if such tests are false and a '1' if true - I thought that was an easy way to test for right or left rudder.

Posted
19 minutes ago, Sandy R said:

I had included the conditional tests in the formulae as many programming languages, (and interestingly excel), returns a '0' if such tests are false and a '1' if true - I thought that was an easy way to test for right or left rudder.

But even with that the formulae still don't make sense - if rudder < 50 then:
    Left Brake Control = 2*((100-Rudder)-50)*(Rudder<50)*Brake/100 === 2*((100-Rudder)-50)*1*Brake/100
    Right Brake Control = (2*(Rudder-50)*(Rudder>50))*Brake/100 === (2*(Rudder-50)*0)*Brake/100 === 0
and if rudder > 50:
    Left Brake Control = 2*((100-Rudder)-50)*(Rudder<50)*Brake/100 === 2*((100-Rudder)-50)*0*Brake/100 === 0
    Right Brake Control = (2*(Rudder-50)*(Rudder>50))*Brake/100 === (2*(Rudder-50)*1)*Brake/100 
i.e. one of the brakes is always zero!

Anyway, you can try different formulae by adjusting the calculations in the script (should be straightforward)- I would be interested to know what you finally use.
Note also a slight correction to the script - the lastBrakeValue should be initialised to off, i.e. change line 8 to
    local lastBrakeValue = -16383 -- initial value, no brakes

Regards,

John

Posted

So even had I been able to get to grips with the LUA scripting right away, I was probably on a hiding to nothing because my starting formula was wrong!

I am about to have a go with this. It's not a trivial exercise as I have to do any editing and downloading files etc. on my laptop before installing them on the flightsim PC proper. My flightsim only has projected (BIG) screens so doesn't lend itself well to text work like this.

When this is successful would you be happy if I shared the solution on the Authentikit forum?

I know there would be a good few people there who will jump at it. You will of course get all the credit. I doubt if it will result in many FSUIPC sales as any serious builders there should already have your software. 

Regards

Sandy

 

Posted
2 hours ago, Sandy R said:

When this is successful would you be happy if I shared the solution on the Authentikit forum?

Sure, no problem, Once you have tested this, and maybe tuned the script, I can also create a post un the User Contributions sub-forum and make the script available there.

Cheers,

John

Posted

I think I am still missing a trick here.

I made the change to line 8 as suggested.

I have copied the LUA script into the FSUIPC7 Installation folder.

I have assigned the Brake and Rudder to the xA0000 and xA0004 offsets.

On running the SIM -with the external view, I can see the rudder is not moving with the pedals and the internal cockpit brake pressure gauge suggests the Brake lever is non-functional too.

The logfile shows the requisite IPC OFFSET CONTROL messages when I move the rudder and brake lever, so I know at least the inputs are being processed.

I ticked the appropriate LOG selection to open a separate logfile for LUA activity, but nothing seems to be logging!

I notice the FSUIPC7.ini file does list spitfireBrake in the list of LUAs (as No 1)

Do I need to do anything else to make the LUA script run? There doesn't seem to be any menu options in the FSUIPC dialog to do so.

Posted
1 hour ago, Sandy R said:

I ticked the appropriate LOG selection to open a separate logfile for LUA activity, but nothing seems to be logging!

Don't do this! Just let the luas be logged to the standard log file (FSUIPC7.log) - you can then see the messages in real-time if you open the console window.

1 hour ago, Sandy R said:

Do I need to do anything else to make the LUA script run? There doesn't seem to be any menu options in the FSUIPC dialog to do so.

Yes, of course you do, as I previously said:

23 hours ago, John Dowson said:

To use this, you need to first copy the lua file to your FSUIPC7 installation folder and then have it auto-started by adding it either to your [Auto] section or your profile-specific [Auto.xxx] section (where xxx is the name of the spitfire profile).

Please see the section Automatic running of Macros and Lua plugins on page 39 of the Advanced User guide for further details.

John

Posted

Sorry I missed the bit about the autorun.

 

My reading of the LUA log suggests it only ran through the process once then terminated - should there be some sort of loopback there or does putting in in the Auto section keep it running?

 

 

Posted

Can you please turn off logging for both Lua Plugins and Log Lua Separately. If you want to show me a log file, I just want to see your FSUIPC7.log file, and also your FSUIPC7.ini file if you have issues. And, as I said, you should open the logging console (Log->Open Console) and monitor the output in real-time. I also suggest you re-read my previous posts to make sure that you have set everything up correctly. 

You are also using an extremely old and unsupported version of FSUIPC7 - 7.0.0-Beta from 19/8/2020. This is a very early version - please update to the latest (and ONLY supported) version which is 7.3.15.

John

Posted

August 2020 sounds about right for when I installed put the paid for version of FSUIPC on - getting all the bells and whistles working properly in the Spit Cockpit was my 'Lockdown Project' and FSUIPC was instrumental to that. 

Thank you for your perseverance - I will do all you've asked and let you know how I get on. Probably tomorrow or Monday now as I have other duties to attend. 

Posted
33 minutes ago, Sandy R said:

Thank you for your perseverance - I will do all you've asked and let you know how I get on. Probably tomorrow or Monday now as I have other duties to attend. 

No problem - and me too!

Posted

Great News!

I have installed the latest version of FSUIPC7 as suggested and this has made all the difference. Brake and rudder inputs are mixing as they should (minor issue the brake lever is reversed but I can sort that).

Let the tweeking commence!

 

 

Posted

Success!!!

After a bit of jiggery pokery with the LUA script, I now have it working quite nicely. No fundamental changes to the values or logic, just enough to get it working with my Brake Lever 'reversed'.

I am however concerned as to why my brake lever was reversed in the first place. I hadn't really questioned it before when all I had to do was tick the 'reversed' box in the dialog before binding the control. However, I now suspect that I may have reversed the polarity of one of the magnets when I was assembling the Hall Sensor units. This means that if I were to share the script on the Authentikit forum, it's only going to work for people who've made the same stupid mistake as I when building their control columns. I think I will go back and redo this fix 'mechanically'* (ie reverse the magnet), and then verify that the original script works ok.

 

Sandy

*This does of course mean I will have to track down my 'good' reading glasses, Jewlers screwdrivers and tweezers. I'm pretty sure the Elves nicked them 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.