• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

FSX Programming a damper

Messages
95
Country
malta
Hi all,

So I decided to override the rudder input with simconnect. Now I need to program a damper so that when the RzAxis is released, the rudder won't slam to the centre but instead, move gradually.

I though maybe I have to include time.h in order to accomplish this but what do you think? Should it be time based?

Regards
 
Hi,

I didn't try it myself, but it seems that the SimConnect_MapinputEventToClientEvent will allow you to read the rudder movements (= joystick). After this, you can program what you need.
See the SimConnect Joystick Control sample in the SDK doc.

Kind regards.

Patrick.
 
I've done that, but obviously, time and some form of exponentially decaying graph should be introduced since a damper is a function of velocity, which in turn, is a function of time.

Thanks for the reply though.
 
Hi,

On programming a damping I would suggest something like this :

Double rudder = 100.0 ;
Double k = 0.9 ;
while (true)
{
rudder = rudder * k ;
SendRudderToSimConnect(rudder) ;
if ( rudder < 1.0 )
{
rudder = 0 ;
break ;
}
Sleep(100) ;
}

It will spawn rudder changes from 100 to 0 with an exponential damper. By tunning the value of k and the Sleep time, you can adjust the result.

Well, this is just a general idea, you have to adapt it to your program and wishes.

Patrick.
 
Hi, thanks a lot for your reply.

Can you please explain to me what do you mean by this line?

Code:
SendRudderToSimConnect(rudder) ;

thanks again
 
quote : Can you please explain to me what do you mean by this line?

Oh, it is just that I was too lazy to write the exact instruction ! So I supposed you know how to send a variable to FSX thru SimConnect.

Actualy, you have to use the function SimConnect_SetDataOnSimObject(...).
Samples can be found in the SDK doc.

Sorry to have teased you.

Patrick.
 
OK, thanks a lot for your help. The Sleep function proved to be helpful. Now I'll see how I can further improve on this since I need to put a variable in a loop that is coming from elsewhere.

Guess I need to use a pointer right?

regards
 
Remember that if you're programming this to be time related, you need to take into account the simulation rate if it's to respond appropriately if the user opts to speed up time. (Not that I think many people really do this.) you can get the sim rate via a simulation variable.

I've done similar things to apply lag and hydraulic boosts into control inputs and it works well.

Si
 
Back
Top