1. For downloading SimTools plugins you need a Download Package. Get it with virtual coins that you receive for forum activity or Buy Download Package - We have a zero Spam tolerance so read our forum rules first.

    Buy Download Package Now!
  2. Do not try to cheat our system and do not post an unnecessary amount of useless posts only to earn credits here. We have a zero spam tolerance policy and this will cause a ban of your user account. Otherwise we wish you a pleasant stay here! Read the forum rules
  3. We have a few rules which you need to read and accept before posting anything here! Following these rules will keep the forum clean and your stay pleasant here. Do not following these rules will lead to permanent exclusion from this website: Read the forum rules.

Writing a motion cueing software from scratch.

Discussion in 'DIY Motion Simulator Projects' started by Dirty, Feb 28, 2019.

  1. pmvcda

    pmvcda aka FlyPT

    Joined:
    Nov 3, 2010
    Messages:
    833
    Location:
    Portugal
    Balance:
    6,396Coins
    Ratings:
    +886 / 11 / -0
    My Motion Simulator:
    6DOF
    Yes, but instead of working in all the range with correct cues, you get different cues when reaching the limits.

    But I can try to make it.
    I think what you men is at actuator level. It would be simpler to make, because at pose level, it's almost impossible. We need forward kinematics for that.
    And at actuator level it could be an hardware (software) thing, but I can try to implement it in software.
    • Like Like x 1
  2. Trip Rodriguez

    Trip Rodriguez VR Pilot

    Joined:
    May 8, 2016
    Messages:
    508
    Location:
    Lake Ariel, Pennsylvania
    Balance:
    2,683Coins
    Ratings:
    +209 / 3 / -0
    My Motion Simulator:
    6DOF
    Ok, I don't know the terminology so when I saw filters like LP(LP)(LP) and LP(LP)(HP) I thought that was the third order filters you guys had been discussing. Anyway those I listed seem like they are going to work very well. I was able to achieve a ramp that looked gradual enough but once it gets going looks like it should still be fast enough. I haven't got far enough yet to know for sure.

    I found I have to use the one that ends in HP in order to have the cue wash out but I'm flying blind her just experimenting to figure out what the different options and values seem to do.

    Off topic, I've been reading some of the old posts here and you guys talking about X-Plane. X-Plane is sort of a sore point for me. They do SO MANY things better than pretty much everyone else, but some of the most basic stuff is broken or missing depending on how you want to look at it. Just to put things in perspective, XP11 is where I've spent the VAST majority of my flight hours the last two years. That's because it was the best overall VR/Motion experience.

    The main reason I'm moving back toward DCS though is the XP11 flight models. I mean, in every one of the XP11 aircraft I've tried (most of the default ones and several payware) you can't even really do a slip properly! Yeah it will slip a little, but nowhere near the way it should. How is that a flight sim!? That's fine for airliner simulation which is a very popular segment, but in light aircraft that just takes all the fun out of flying IMO.

    DCS is sorta opposite. Slips are perfect, spins and stalls generally work right, etc. It does great with aerobatics and such and the helicopter flight models (except Gazelle) are better than any others on the market by far, but as far as the overall quality of the telemetry output it seems far behind XP11. DCS scenery is also not super great. XP11 also has the best VR integration I've seen in any sim anywhere, while last I saw DCS is still pretty messy when it comes to VR interaction with cockpit controls. I love XP11's attitude toward modding too. I run Ortho myself.

    DCS Flight Model Physics: Some extreme stall/spin stuff in the Yak-52. I wanted to show something other than the trailer so this is just what I found via a couple minutes browsing youtube:



    This is why DCS has active aerobatics servers. =D Did have even long before the two fairly recent aerobatic oriented aircraft.
  3. hexpod

    hexpod http://heXpod.xyz

    Joined:
    Apr 18, 2016
    Messages:
    673
    Location:
    berlin
    Balance:
    4,427Coins
    Ratings:
    +194 / 2 / -0
    My Motion Simulator:
    DC motor, 6DOF
    Absolutely right ! On the actuator level
  4. hexpod

    hexpod http://heXpod.xyz

    Joined:
    Apr 18, 2016
    Messages:
    673
    Location:
    berlin
    Balance:
    4,427Coins
    Ratings:
    +194 / 2 / -0
    My Motion Simulator:
    DC motor, 6DOF
    Ok added on the 1.8.7

    E6EC01C2-82DB-4A07-B6A5-038DFA5281BE.jpeg

    Fourth from the bottom = second order EMA
    Second from the bottom = third order EMA

    I got it. Very good addition !
    • Like Like x 1
  5. Trip Rodriguez

    Trip Rodriguez VR Pilot

    Joined:
    May 8, 2016
    Messages:
    508
    Location:
    Lake Ariel, Pennsylvania
    Balance:
    2,683Coins
    Ratings:
    +209 / 3 / -0
    My Motion Simulator:
    6DOF
    Hey, I was accidentally correct!

    As I said though, as near as I have been able to figure out if I use third order LP(LP(LP)) I can't get the cues to wash out so I have to use the LP(LP(HP))
  6. pmvcda

    pmvcda aka FlyPT

    Joined:
    Nov 3, 2010
    Messages:
    833
    Location:
    Portugal
    Balance:
    6,396Coins
    Ratings:
    +886 / 11 / -0
    My Motion Simulator:
    6DOF
    Yes, you need a high pass to generate washout.
    • Informative Informative x 1
  7. hexpod

    hexpod http://heXpod.xyz

    Joined:
    Apr 18, 2016
    Messages:
    673
    Location:
    berlin
    Balance:
    4,427Coins
    Ratings:
    +194 / 2 / -0
    My Motion Simulator:
    DC motor, 6DOF
    If I am correct, you need to be able to apply LPF and HPF at the same time....inside Band Pass:

    Low pass of second or third order (smoothing) AND high pass of second order (return to center)
    • Like Like x 1
  8. hexpod

    hexpod http://heXpod.xyz

    Joined:
    Apr 18, 2016
    Messages:
    673
    Location:
    berlin
    Balance:
    4,427Coins
    Ratings:
    +194 / 2 / -0
    My Motion Simulator:
    DC motor, 6DOF
    In order to keep a low level of complexity, you can keep always a second order of HPF inside your BandPass.

    In this case we would need only two more band pass:

    1.)
    Single EMA LP second order + single EMA HP second order
    2.)
    Single EMA LP third order + single EMA HP second order
    • Like Like x 1
  9. hexpod

    hexpod http://heXpod.xyz

    Joined:
    Apr 18, 2016
    Messages:
    673
    Location:
    berlin
    Balance:
    4,427Coins
    Ratings:
    +194 / 2 / -0
    My Motion Simulator:
    DC motor, 6DOF
    To be clear:

    Heave, Surge, Sway and Yaw should be “Band passed”

    One exception for heave:

    In case you want separation, you leave heave unfiltered and you apply separate SimTools filtering on different effects for heave.

    Pitch and Roll should be “Low passed” eventually “Band passed” depending if you use positions or accelerations

    Tilt coordination should be “Low passed” with third order.

    I hope it’s clear and make sense to everybody.

    If not, ask questions.
    • Informative Informative x 1
  10. hexpod

    hexpod http://heXpod.xyz

    Joined:
    Apr 18, 2016
    Messages:
    673
    Location:
    berlin
    Balance:
    4,427Coins
    Ratings:
    +194 / 2 / -0
    My Motion Simulator:
    DC motor, 6DOF
    You can notice sustained lateral and longitudinal accelerations measured on the platform:

    Following the “Equivalence principle” we are tilting the platform to obtain thrust and cetrifugal effect.

    • Agree Agree x 1
    Last edited: Jun 23, 2019
  11. hexpod

    hexpod http://heXpod.xyz

    Joined:
    Apr 18, 2016
    Messages:
    673
    Location:
    berlin
    Balance:
    4,427Coins
    Ratings:
    +194 / 2 / -0
    My Motion Simulator:
    DC motor, 6DOF
    In order to maximize the workspace and improve the tilt algorithm, the center of rotation on main pitch and roll has to be dissociated from the pitch and roll for coordination tilt.

    For that I am planning to increase lateral and longitudinal dof range and lower the center of rotation to O.

    Still some tweaking is needed to get the best of this tiny workspace.
  12. Dirty

    Dirty Active Member Gold Contributor

    Joined:
    Oct 15, 2017
    Messages:
    310
    Occupation:
    All the way up front.
    Location:
    Germany
    Balance:
    3,364Coins
    Ratings:
    +296 / 1 / -0
    Yes, that's a third order lowpass as far as I understood :thumbs ...and I would put it on the tilt coordination channel.
    At some point, I plan on implementing a virtual accelerometer on the platform representation. That should show if those filters work as intended.
    • Like Like x 1
    Last edited: Jun 23, 2019
  13. Dirty

    Dirty Active Member Gold Contributor

    Joined:
    Oct 15, 2017
    Messages:
    310
    Occupation:
    All the way up front.
    Location:
    Germany
    Balance:
    3,364Coins
    Ratings:
    +296 / 1 / -0
    That sounds interesting!!! I actually have the option for different CoR implemented in my design, but have never thought about using it in THAT way. Might bring advantages. Let me think this through...
  14. Dirty

    Dirty Active Member Gold Contributor

    Joined:
    Oct 15, 2017
    Messages:
    310
    Occupation:
    All the way up front.
    Location:
    Germany
    Balance:
    3,364Coins
    Ratings:
    +296 / 1 / -0
    I have made a little beginner friendly instructional video, if someone wants to try out the software:


    New:
    - Force View
    - Soft Start/Stop
    • Like Like x 3
    • Winner Winner x 2
  15. hexpod

    hexpod http://heXpod.xyz

    Joined:
    Apr 18, 2016
    Messages:
    673
    Location:
    berlin
    Balance:
    4,427Coins
    Ratings:
    +194 / 2 / -0
    My Motion Simulator:
    DC motor, 6DOF
    Yea I am curious indeed if the assumption is correct.

    Center or rotation is nothing else as combination of pitch and surge. Am I wrong?

    The more surge in the combination, more you lift the CoR
  16. Dirty

    Dirty Active Member Gold Contributor

    Joined:
    Oct 15, 2017
    Messages:
    310
    Occupation:
    All the way up front.
    Location:
    Germany
    Balance:
    3,364Coins
    Ratings:
    +296 / 1 / -0
    Technically, that would be a somewhat correct approximation as long as we are only talking about small angles. I think up to 10° maybe.
  17. Dirty

    Dirty Active Member Gold Contributor

    Joined:
    Oct 15, 2017
    Messages:
    310
    Occupation:
    All the way up front.
    Location:
    Germany
    Balance:
    3,364Coins
    Ratings:
    +296 / 1 / -0
    I am undecided if I will implement something like this. You are right, the response of the rig would be non linear. That's the down side. On the upside you could pretty much get rid of clipping completely. Using the right function, you could keep a little bit of responsiveness no matter how close to the limit you get.

    I have played around with an ArcTAN function and got some nice results.

    ...the interesting point here is that you don't even specify a "limit" in the classical sense, but instead three points that are represented unaltered by the filter, and a compression coefficient (CC). The pictures show...

    CC = 0,1
    NoLimit.png

    CC = 1
    Softlimit_1.png

    CC = 2
    Softlimit_2.png

    CC = 3
    Softlimit_3.png

    Such a filter would increase responsiveness for small input values and decrease responsiveness for bigger values. I has the potential to address the issue that @Trip Rodriguez mentioned where his rig shows very little response in normal flight, and way too much during braking.


    On the question of where in the processing chain to apply those filters (if at all) I am just as clueless as you guys. Input-level, DOF-Level or Actuator-level...? No Idea!

    Dirty :)
    • Like Like x 2
    • Agree Agree x 1
  18. Dirty

    Dirty Active Member Gold Contributor

    Joined:
    Oct 15, 2017
    Messages:
    310
    Occupation:
    All the way up front.
    Location:
    Germany
    Balance:
    3,364Coins
    Ratings:
    +296 / 1 / -0
    In case someone wants to take a look into the code:
    Code:
    class StreamCompressor
    {
      
        float LargeInput = 10.0f;                        //Pick a typically "large Input"
        float Coefficient = 0.01f;                       //How much sensitivity do you want around zero? 0.01 = 100%, 1 = 126%, 5 = 363%
    
        float Input;
        float Utilisation;
        float Output;
    
        /////////////////////////////////////////////////////////////////////////
    
        void Compress()
        {
            Utilisation = Input / LargeInput;
            float Atan = Mathf.Atan(Utilisation * Coefficient) / (Mathf.PI / 2);
            float UncorrectedOutput = 2 * Atan * LargeInput;
    
            Output = UncorrectedOutput * Correction();
        }
    
        float Correction()
        {
            //This function calculates a correction value to stretch the curve back up, so that a "LargeInput" generates an equally "LargeOutput"
            float Atan = Mathf.Atan(Coefficient) / (Mathf.PI / 2);
            float UncorrectedOutput = 2 * Atan * LargeInput;
    
            return LargeInput / UncorrectedOutput;
        }
    }
    • Like Like x 1
  19. pmvcda

    pmvcda aka FlyPT

    Joined:
    Nov 3, 2010
    Messages:
    833
    Location:
    Portugal
    Balance:
    6,396Coins
    Ratings:
    +886 / 11 / -0
    My Motion Simulator:
    6DOF
    I was looking at it with logistic functions.
    Just to avoid the atan.
    But exponents might be equal in speed.
    A test I made in a spreadsheet: (you can see the formula) (between -50 to 50)

    Sem nome.jpg
    • Like Like x 1
  20. SeatTime

    SeatTime Well-Known Member

    Joined:
    Dec 27, 2013
    Messages:
    2,284
    Location:
    Newcastle Australia
    Balance:
    26,766Coins
    Ratings:
    +2,579 / 29 / -0
    My Motion Simulator:
    DC motor, Motion platform, 6DOF
    Great video and software :thumbs. We are really spoilt for choice. Must give this a try when I find some time. Looking at the video it just re-enforces how important G - Systems are to convey the forces being felt in a fast aircraft.
    • Agree Agree x 1
    Last edited: Jun 23, 2019