MobiFlight Community Support

Welcome to the forum for MobiFlight! Feel free to reach out to the community in case you have questions, issues or just want to share great ideas or details about your latest home cockpit project.

You like MobiFlight? Donate via PayPal and support the MobiFlight development. Thanks! 

05/03/2024 - This forum is read-only

The community support for MobiFlight has moved exclusively over to our Discord server. Register for free and enjoy more interactive functions like image and video upload, voice chat. More than 7,000 registered users around the world make it a great experience!

See you on our MobiFlight Community Discord server.

A HUGE Thank You to everyone who participated in the forum, especially obviously to Pizman and Stephan who did an outstanding job over so many years providing an incredible service to the MobiFlight community.

The forum is still providing a lot of good content, hence we keep this information accessible.

icon
Avatar
djw4250
From: Napier, New Zealand
Posts: 30
Supporter
I have built my own dual rudder & brake control for my sim, which is running P3Dv5.3
I have used a sliding pot for the rudder and have also a sliding pot at each of the four pedals for the brakes.
These pots are all connected to a dedicated Arduino Mega.
MF has updated the firmware on this Mega and I have added all the analog devices in the MF Config Wizard.
Configuring the rudder I selected FSUIPC EventID and "use" AXIS-RUDDER_SET.
The suggested offset has a parameter of zero - and unsurprisingly, in the sim, the rudder of my Baron does not move.
The hint is given in the Wizard that @ is acceptable as an analog input variable to store the value input from the pot.
I expect that I need to invent a mathematical "transformation" to map the values of @ (60 to 1020) to the appropriate point on the range of values the sim expects for the rudder position. (As I understand things this range is from -16383 to +16383)
I have to confess that I cannot work out what this transform should be.
Has anyone else worked this out successfully?
[Last edited by djw4250, 2023-04-21 11:36]
D J Wilkinson
2023-04-16 10:47
Avatar
djw4250
From: Napier, New Zealand
Posts: 30
Supporter
No need to invent any "transformations", Mobiflight has already done it. :)
I found this entertaining tutorial by young Capt Bob.
https://www.youtube.com/watch?v=qd9VGcZ2Rcc

The question has now become "How do I adjust the sensitivity of the MF responses to the rudder pedals?"
D J Wilkinson
2023-04-20 10:45
Avatar
StephanHo
Moderator
From: EDDG, Germany
Posts: 1867
Supporter
Hi D.J.Wilkenson,

please try as follows:

So your potentiometer shows a range from 60 to 1020. However, the simulator expects values from -16383 to +16383.
This means that the number range from 960 (potentiometer) and 32766 (sim) can be covered or calculated.

Let's first divide the 960 by a factor of 2. That would be 480. So all values of the potentiometer below 480 are negative, all values above it are positive.
now the sim values have to be assigned accordingly. 32766 / 960 is 34.13125.

So we have the two ranges: 480 x 34.13125 = 16383. If the potentiometer value is less than 480, the potentiometer value only has to be multiplied by -1.

Assuming the pot value is 237, MF would multiply the value 237 by 34.13125. That would be 8089.1. But since the potentiometer value is less than 480, it must be multiplied by -1, which then results in the value 8.089.1, which is sent to the sim.
Assuming the pot value is 800, MF would multiply the 800 pot value by 34.13125, which would be 27305. Since the value is greater than 480, it does not need to be multiplied by -1.

So much for the theory.

In Mobiflight it would look like this:

The following formula had to be in Transform: if(@<480,(@*34.13125)*-1,@*34.13125)
This formula reads as follows: If the value of the pot (@) is less than 480, then (@*34.13125)*-1, otherwise @*34.13125.

Please report your experiences
Grüße,
Stephan (Time: UTC+2)
2023-04-20 15:27
Avatar
djw4250
From: Napier, New Zealand
Posts: 30
Supporter
Hi there Stephan,
Thank you for your response, it got my thinking focused and got my old mathematics teacher brain going again.
This is where my thinking went:-

At full left deflection my pot is evaluated by MobiFlight @ as 1016.
At full right deflection @ is shown as 50.

This means that the range of @ is 966 units and that each 1-unit change of @ corresponds to a 32766/966 = 33.91925 change for the offset's (0x0BBA) parameter value.

So, as I move my pedals from full left deflection to the neutral position (rudder bars all equal) @ will decrease by 483 units from 1016 to 533; then as I continue to press the rudders through to full right deflection @ will continue to decrease by a further 483 units down to 50.

As I see it then,
1. 50<=@<533 must send positive values to the Sim rudder offset.
2. @=533 should send "0" to the sim.
3. 533<@ <=1016 must send negative values.

To map the sequence of numbers (we're calling this value @) that range from 50 to 1016 to values of the Parameter (which I'll call P) that range from 16383 down to -16383 we need to use a linear equation of the form y = mx +c.

In this case it looks like P = m@ + c.

If we were to draw a graph of this, m would be the slope of the line and c is where the line would be if @ could get down to zero (actually, it's the P axis intercept)

We can calculate the slope of the line by (Change in P) / (change in @); so m = -32766/966 = -33.9193;

So now we can write the equation as P = -33.9193x@ + c

To calculate the correct value for the constant term 'c' we can use either of the two points we already have. For example, we know that when @ = 50, P = 16383.

These values can be substituted into our equation like this 16383 = -33.9193 x 50 + c

Thus, by rearranging this equation to make c the subject we have c = 16383 + 33.9193 x 50 = 18078.9627

So, at this point we have the mapping function looking like this

P = 18078.9627 - (33.9193 x @)

I have tested this in Excel and it works, even giving zero when @ = 533. As it should.

This should be entered into the MobiFlight "Transform" box as
18078.9627-(33.9193*@)

I am happy to report that it now works perfectly!
[Last edited by djw4250, 2023-04-22 22:46]
D J Wilkinson
2023-04-21 11:24
Avatar
StephanHo
Moderator
From: EDDG, Germany
Posts: 1867
Supporter
Congratulations for the excellent draft!!
Grüße,
Stephan (Time: UTC+2)
2023-04-24 12:18
icon