1. Do not share user accounts! Any account that is shared by another person will be blocked and closed. This means: we will close not only the account that is shared, but also the main account of the user who uses another person's account. We have the ability to detect account sharing, so please do not try to cheat the system. This action will take place on 04/18/2023. Read all forum rules.
    Dismiss Notice
  2. 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 Now a Download Plan!
  3. 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
  4. 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. Do not follow these rules can lead to permanent exclusion from this website: Read the forum rules.
    Are you a company? Read our company rules

Writing a motion cueing software from scratch.

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

  1. Dirty

    Dirty Well-Known Member Gold Contributor

    Joined:
    Oct 15, 2017
    Messages:
    744
    Occupation:
    All the way up front.
    Location:
    Germany
    Balance:
    7,905Coins
    Ratings:
    +877 / 3 / -0
    Oh,.... I SOOOOO DO!!!! :) And it's great to see someone else having the same considerations :) Few months ago I was exactly where you are. I went through the same pain of having to revise my assumptions and premises.

    Think about this:
    Is the "pitch" really what's pushing you into the seat? ... or is it the thrust of the propulsion system? What if you climb like a rocket at 500Kts, and then pull the power back to idle, extend the speed brakes. You will be hanging in your shoulder harnesses as if you were braking on the runway. Only the resulting force vector of G_Norm, G_Lat and G_Axial will determine where you will hanging towards :)

    Don't take my word for it,... you will go the same path I took, I promise you! From everything I read from you so far, you are an epiphany waiting to happen!
    Last edited: Mar 18, 2019
  2. hexpod

    hexpod http://heXpod.xyz

    Joined:
    Apr 18, 2016
    Messages:
    1,185
    Location:
    berlin
    Balance:
    7,636Coins
    Ratings:
    +369 / 5 / -0
    My Motion Simulator:
    DC motor, 6DOF
    @Dirty
    The flight recorder data syncronized with cockpit camera in some fancy conditions would bring almost all answers.

    Does such a thing (flight recorder) exist in acrobatic planes like extra 300 or others ?

    That would be a gold mine
  3. value1

    value1 Nerd SimAxe Beta Tester SimTools Developer Gold Contributor

    Joined:
    Jan 9, 2011
    Messages:
    2,184
    Location:
    Zug, Switzerland
    Balance:
    14,751Coins
    Ratings:
    +3,322 / 11 / -1
    My Motion Simulator:
    2DOF, DC motor, JRK, Joyrider
    Let me take you on a roundabout then:
    upload_2019-3-19_8-45-55.png
    You will feel, if the roundabout is turning at constant °/s or not.
    I agree it's not a picky, semantic question but there is an important consequence:
    Constant rotation [°/s] can occure for a long time (e.g. curve) while typically rotation acceleration [°/s²] only is constant for short periods.
    This means that the platform would need to generate rotation cues for a . . l o n g . . time – which is not possible.
    (And we simulate it by applying sway instead [by tilting the platform].)
  4. Dirty

    Dirty Well-Known Member Gold Contributor

    Joined:
    Oct 15, 2017
    Messages:
    744
    Occupation:
    All the way up front.
    Location:
    Germany
    Balance:
    7,905Coins
    Ratings:
    +877 / 3 / -0
    OK, this is something we clearly disagree on, and not just on a semantic level. It's definitely worth sorting this out. :)

    Your space analogy is actually an excellent example for that:
    Imagine you are an astronaut, hovering in outer space. Blind and deaf. You only have your vestibular system and your haptic receptors (skin, bowels). You would not feel anything if you are just hovering there. Now I come along and give you a little spin. Moderate, let' s say 30°/s. Of course you'd feel this impulse when I start to push you, but as soon as I let go of you and allow you to spin freely, you'd be back in sensory deprivation. No way for you to tell rotational rates [°/s]. And if you think that 30°/s is too slow: That's already twice the angular rate any airliner will ever experience. Even F1 cars will not exceed 30°/s in every turn.

    Concessions I am willling to make:
    1. If angular velocity is high enough, you will feel that different parts of your body will be pulled away from your center of gravity in different directions, but what you feel will be forces, not rotation rates.
    2. Coriolis force might be perceivable (if you move parts of your body relative to the axis of rotation). Again, you might feel forces, or the resulting angular accelerations, not rotation rates themselves.
    3. Stability considerations of non uniformly shaped objects might come into play. I'm thinking of the infamous T-handle spinnig in space.
    ...all these points will eventually lead to forces or angular acceleration, but rotation rate is not perceivable by humans directly.

    The example with the roundabout is also nice:
    - You will feel centrifugal force
    - You will feel coriolis force
    - You will feel the force vector pointing in different directions on different parts of your body.
    - You will also feel the vibration coming from the bearings.
    - You will feel the wind from the rotation
    - You will hear the sounds of the environment coming from different directions as you turn.
    - You will even be able to deduct logically that if you were still once and someone gave you a rotational impulse, that you must be spinnig now.

    ...but all those are not direct sensations of rotation rates. Your brain combines all of those into a perception of self motion, but if I were to deprive you from those inputs, you'd have no way to tell. And depriving humans of information is at the core of motion simulation!

    I really don't want to be picky or start a flamewar here, but this must be perfectly clear: Motion simulation is fooling the human brain into perceiving something that is clearly not happening. In order to be able to do that, we must have a clear image of what humans can and cannot perceive.

    I hope you don't see this as me stumping my feet on the ground saying: "..but I wanna be right, right, right!!!" In fact I'd love to be proven wrong! I don't want to persuade anyone, I want to convince you!

    Let me play the (proverbial) ball back to you with a few questions:
    If you could perceive angular rate,...
    1. What's the perception threshold?
    2. What organ would you perceive it with?
    3. How would that organ react to a constant rotation rate?
    4. How would that organ be able to tell the difference between clockwise and a counterclockwise direction?
    5. What axis of rotation does this organ sense?
    I am sure you're thinking about the vestibular system. Take a close look at what this actually is. It's not a gyro :) It's liquids in a tube :) that's all.


    In everything I have written in this thread so far, I have barely scratched the surface of the simplest of all available motion cueing algorithms. The "classical" washout filter based MCA. I really think that we can take DIY motion simulation where it belongs: From classical --> adaptive cueing --> predictive cueing --> model predictive cueing --> [This is where I wanna get]

    Dirty:)
    • Like Like x 1
    Last edited: Mar 19, 2019
  5. Dirty

    Dirty Well-Known Member Gold Contributor

    Joined:
    Oct 15, 2017
    Messages:
    744
    Occupation:
    All the way up front.
    Location:
    Germany
    Balance:
    7,905Coins
    Ratings:
    +877 / 3 / -0
    OK, it is a kinda change of subject, but maybe interesting still: :)

    Motion Elements

    I would like to introduce the concept of a „motion element“. Let’s say a motion element is a very short event (~1 sec) in the motion of the vehicle that occurs often and can be considered typical for the operation of that vehicle. I give you a couple of examples:

    Car:
    • Accelerating the car from a stand still
    • Braking the car to a full stop
    • Entering a corner at high speed
    • Hitting a curb
    • S-turns at medium speeds
    • Changes from acceleration to deceleration and v.v.
    • Driving through compressions/extensions
    • Traction loss

    Aircraft:
    • Commencing TakeOff roll
    • Coming to a full stop
    • Acceleration/deceleration in flight.
    • S-turns
    • Steep turns
    • Barrel rolls
    • Snap rolls
    • Spins
    • Taxi turns
    • Touchdown ‚bump’


    The idea is, to have an algorithm that is able to handle those typical elements. Everything else is basically just filling in the voids between. I wondered how I could structure this problem to understand it better and I came up with…


    The Presentability-Perceptibility-Diagram :)

    For every motion element, every acceleration, every roll rate - or every change of acceleration (jerk) and every change in any of the angular rates of the vehicle you can ask yourself the question:

    Where would I locate this element on the Presentability-Perceptibility-Diagram?
    Bildschirmfoto 2019-03-11 um 13.32.46.png
    Yea, yea,… I know ‚unconventional approach‘ and all… I can literally hear people shout „WITCH!!!!“ …but bear with me here :)

    <Disclaimer> This is NOT standard first semester curriculum in Motionsimulatorology. I don’t know if someone already gave a catchy name to this method but for me personally plotting out stuff in two dimensions (that are somewhat descriptive of the subject you are thinking about) is a great tool to bring my thoughts into order. </Disclaimer>

    Whenever I thought about how I would implement a motion cueing algorithm, two major considerations dominated:
    1. Can a human feel this motion element in the vehicle?
    2. Can a Stewart platform present this motion element to the user?
    It greatly clarified my mental image of the problem when I drew this diagram. Just the coordinate system alone gave structure to my thought process, because it immediately showed me, if what I thought made any sense at all.

    I divided it up into four major regions:
    • The Trashcan: Motion elements that cannot be felt and cannot be displayed live here. Actually a lot more than you think will live here.
    • The Bitter-Pill region: Motion elements that can be felt, but the platform is unable to display (properly) go here.
    • The Amusement Park: That’s where the fun stuff happens! The motion elements that humans can feel in the vehicle and the platform can display :)
    • The Illusionist: There are motion elements that the platform can perform, but humans are unable to perceive. We can use those to fool the user or prepare the rig for future action. Gently returning the platform towards the center for example is happening here.
    …and then there is the :eek: Graveyard!!! That’s the motion elements that the platform displays opposite to the real thing! That’s a first class immersion breaker! There should be pretty much nothing in here as it will ruin your simulation experience. I’d rather have a motion element not represented at all, than have it represented opposite.
    Bildschirmfoto 2019-03-10 um 09.36.09.png


    Now, if you think that you should cramp as much as possible into the amusement park, you’re wrong. Motion simulation is at least as much about avoiding false cues as it is about creating correct cues. Here’s a path I took for pretty much every motion element:
    Bildschirmfoto 2019-03-10 um 09.36.09 Kopie.png
    1. Do I even need this?
    2. Let’s display it to the user!
    3. Does it have side effects?
    4. Can I do anything about them?


    OK, so to be clear: This is not scientific! This is not the „must-understand“ of motion simulation, but it helped me greatly to understand what the problem is. It helped me to sort out the stuff I don’t need to worry about. It helped me to focus on what I really want to show to the user. It helped me to identify false cues. And it helped me become aware as to what I could do about them.

    If it helps you,.. great! If not, ignore it :)

    Dirty :D
    • Like Like x 1
    Last edited: Mar 19, 2019
  6. Dirty

    Dirty Well-Known Member Gold Contributor

    Joined:
    Oct 15, 2017
    Messages:
    744
    Occupation:
    All the way up front.
    Location:
    Germany
    Balance:
    7,905Coins
    Ratings:
    +877 / 3 / -0
    I said I would try to illustrate. :)

    Here are bank angle, angular rate, and angular acceleration for the situation described by @hexpod above: Aircraft rolls into a 30° bank turn. Holds the turn and then rolls out to wings level. (The first 10 seconds are just for stabilisation, trimming and setting thrust)
    Bildschirmfoto 2019-03-19 um 11.14.02.png

    Dirty :)
    Last edited: Mar 19, 2019
  7. Dirty

    Dirty Well-Known Member Gold Contributor

    Joined:
    Oct 15, 2017
    Messages:
    744
    Occupation:
    All the way up front.
    Location:
    Germany
    Balance:
    7,905Coins
    Ratings:
    +877 / 3 / -0
    Awesome idea! If you can get the motion stream and the video stream to be synchronous (time matches) and boresighted (directions match) then I'd say this can be an awesome experience! Basically all you need is XYZ accelerations and rotation rates and you're good to go. Both can be recorded with a cheap breakout board from Adafruit. easily. Watch this video!
    Whether Simtools can do something for you, I don't know, but if you're writing something yourself, this should totally work.

    Filtering signals in an Arduino (general)
    EMA Filter
    DEMA filter

    And if you would write your own VR player, you might even be able to do motion cancellation directly in the player?!? Just a thought!
    Last edited: Mar 19, 2019
  8. BlazinH

    BlazinH Well-Known Member

    Joined:
    Oct 19, 2013
    Messages:
    2,145
    Location:
    Oklahoma City, USA
    Balance:
    16,614Coins
    Ratings:
    +1,835 / 32 / -1
    This is over my head for the most part and I don't really care to understand it. But you keep giving thought experiments in space when are rigs are always used with gravity. So while pitch/sec is a constant rotation are rigs only move a short distance and stop which sounds like the same thing you are saying. However are rigs stay at that angle until the event in over or changes. I think the only difference in what you are saying is the rig should immediately start a washout back to center at the stop point since that is whats required for our rigs to go back to simulating a static state in a gravity environment.
    Last edited: Mar 19, 2019
  9. hexpod

    hexpod http://heXpod.xyz

    Joined:
    Apr 18, 2016
    Messages:
    1,185
    Location:
    berlin
    Balance:
    7,636Coins
    Ratings:
    +369 / 5 / -0
    My Motion Simulator:
    DC motor, 6DOF
    Simple question,

    Let me take you back to our planes... ;-)))

    We agreed that in coordinated turn at 30 deg (without any changing rates or variations) the pilot doesn’t feel any lateral forces. Banking the platform in this case would produce an irrealistic feeling.

    Now let’s take the example of fighter jet or acrobatic extra 300.

    They can without problem fly a straight ligne banked at 90 deg. Right?

    We agree that if you wouldn’t be attached to your seat, due to gravity, you could finish with your face on the “lateral window”. In this case, do you want to keep your platform also flat or it would be better to use its maximal roll tilt ability ? (around 30deg)

    Which variable exactly will produce the roll ???
    Last edited: Mar 19, 2019
  10. hexpod

    hexpod http://heXpod.xyz

    Joined:
    Apr 18, 2016
    Messages:
    1,185
    Location:
    berlin
    Balance:
    7,636Coins
    Ratings:
    +369 / 5 / -0
    My Motion Simulator:
    DC motor, 6DOF
    The graph comes from xplane or its a real flight recorder?
  11. Dirty

    Dirty Well-Known Member Gold Contributor

    Joined:
    Oct 15, 2017
    Messages:
    744
    Occupation:
    All the way up front.
    Location:
    Germany
    Balance:
    7,905Coins
    Ratings:
    +877 / 3 / -0
    Yes, some very high performance aircraft can do "knife edge flight".

    The resulting force-vector would be
    - minimal G_axial (yes, "minimal". Not zero)
    - no G_normal
    - almost 1 G_lateral (yes, "almost". Not 1)

    The resulting rotation vector would be
    - no agular_rate_axial-
    - no agular_rate_normal
    - no agular_rate_lateral

    As long as we are talking about a steady state, a 6DOF rig should represent this by
    - no yaw
    - minimal tilt (yes, minimal. Not zero)
    - max roll (I guess that's what you were looking for :)
    - no sway
    - no heave
    - no surge

    There are a hundred different forces and moments acting on the vehicle, but in the end the simulator (planes and cars alike) adds them all up to...
    1. Sum of all forces = Force vector (XYZ)
    2. Sum of all moments (integrated over time) = Rotation vector(QPR)

    that's all you need to describe the motion of the vehicle. Everything else we do in motion simulation can be deducted from there.

    I highly encourage anyone interested in this to think about why I said "minimal G_axial" and "almost 1 G_lateral".
    Last edited: Mar 19, 2019
  12. Dirty

    Dirty Well-Known Member Gold Contributor

    Joined:
    Oct 15, 2017
    Messages:
    744
    Occupation:
    All the way up front.
    Location:
    Germany
    Balance:
    7,905Coins
    Ratings:
    +877 / 3 / -0
    It comes out of DCS World. But X-plane is no different. In fact every simulator I know gives the same results. :)
  13. Dirty

    Dirty Well-Known Member Gold Contributor

    Joined:
    Oct 15, 2017
    Messages:
    744
    Occupation:
    All the way up front.
    Location:
    Germany
    Balance:
    7,905Coins
    Ratings:
    +877 / 3 / -0
    Thought experiments in space can be tremendously helpful, because they strip the problem naked to its bare basic structure. :)

    Yes that's right. :thumbs I wouldn't want the platform to stay tilted unless there is a persistent lateral or axial acceleration. Using a lowpass filter can assure that only long lasting acceleration components will effect tilt (pitch and roll). The high frequency components of the accelerations shall go to sway, surge and heave. The high frequency components of the angular rates go on top of the (already present) yaw, pitch and roll channels.

    Only remaining question is how we best stack the reference systems for those transformations. I will talk about this in a separate post.

    Dirty :)
    Last edited: Mar 19, 2019
  14. hexpod

    hexpod http://heXpod.xyz

    Joined:
    Apr 18, 2016
    Messages:
    1,185
    Location:
    berlin
    Balance:
    7,636Coins
    Ratings:
    +369 / 5 / -0
    My Motion Simulator:
    DC motor, 6DOF
    I like your systematic approach willing to classify different forces and motion with diagrams.

    The pure theory or a pure empirisme can lead into bad motion which is worse than no motion at all.

    Your diagram is very Interesting
    • Agree Agree x 1
  15. Dirty

    Dirty Well-Known Member Gold Contributor

    Joined:
    Oct 15, 2017
    Messages:
    744
    Occupation:
    All the way up front.
    Location:
    Germany
    Balance:
    7,905Coins
    Ratings:
    +877 / 3 / -0
    Fully agree! :thumbs

    Theory and empiry will eventually need to go hand in hand. They are two sides of the same coin.
    There's one catch with empiry though: It can be very deceitful. Especially when the very thing we are trying to do is deceive people. :grin
  16. hexpod

    hexpod http://heXpod.xyz

    Joined:
    Apr 18, 2016
    Messages:
    1,185
    Location:
    berlin
    Balance:
    7,636Coins
    Ratings:
    +369 / 5 / -0
    My Motion Simulator:
    DC motor, 6DOF
    @Dirty
    Because I am right in this moment in the discussion with God himself (Austin) about his friction ground model which produces strange lateral and longitudinal cues while braking in xplane, you could maybe briefly explain b.t.w. what is the difference between angular velocity and angular moments?

    70FEC980-97ED-4601-817D-B16B49CF23DF.jpeg
  17. Dirty

    Dirty Well-Known Member Gold Contributor

    Joined:
    Oct 15, 2017
    Messages:
    744
    Occupation:
    All the way up front.
    Location:
    Germany
    Balance:
    7,905Coins
    Ratings:
    +877 / 3 / -0
    Thanks for the video (PM) I will try to replicate it.

    Austin is someone who wants to get things right, for sure! And he knows his sh*t!! AND he knows how to explain things without leaving relevant aspects out. Even to mere mortals like ourselves.

    The jitter:
    My first thought was: "Just filter it out with a lowpass filter" but I guess you already did that (and found that it creates a dealy :)
    It might indeed be the way friction is modeled.

    The side load:
    Could this be P-factor?

    ...I will have to replicate. Have you tried to make the force vectors visible?
  18. hexpod

    hexpod http://heXpod.xyz

    Joined:
    Apr 18, 2016
    Messages:
    1,185
    Location:
    berlin
    Balance:
    7,636Coins
    Ratings:
    +369 / 5 / -0
    My Motion Simulator:
    DC motor, 6DOF
    Did you saw the amount and the aggresivity of those?
    You have to put a ridiculous amount of smoothing to attenuate it. It’s not a solution.

    P-factor so big and so abrupt? It cannot be I think
    B1FD327B-10E3-4CB8-8656-51DAD11B0DEF.jpeg

    That’s the last second before the Cessna stops with a very little amount of braking. 0.8G longitudinal and 0.6G side. Ridiculous.

    You can see the Cessna compas shaking accordingly.

    The compas shakes but not the aircraft body

    On the top of it it’s a bit erratic.

    Austin have sent me already a custom build which is a bit better but we are not yet there.

    If you could reproduce it with the last 11.32r2 it would be cool
    Last edited: Mar 19, 2019
  19. hexpod

    hexpod http://heXpod.xyz

    Joined:
    Apr 18, 2016
    Messages:
    1,185
    Location:
    berlin
    Balance:
    7,636Coins
    Ratings:
    +369 / 5 / -0
    My Motion Simulator:
    DC motor, 6DOF
    It’s literally mind blowing to explore and compare all this data with their different characteristics thinking what could bring better results.
    It’s just pity we don’t have more extras to output them at once and experiment with them on the fly.

    Each time you have to modify and compile the plugin. That’s time consuming and doesn’t alow direct comparison.

    The structure of sintools and all plugins should be adapted to allow more extras according to @yobuddy . To bad.

    Already did some tests with the M component from “Aerodynamic Forces” on the yaw. It’s great in my opinion. Interesting...very interesting.

    30159C9F-91E6-4074-8846-471B2FC95451.jpeg
    Last edited: Mar 19, 2019
  20. Dirty

    Dirty Well-Known Member Gold Contributor

    Joined:
    Oct 15, 2017
    Messages:
    744
    Occupation:
    All the way up front.
    Location:
    Germany
    Balance:
    7,905Coins
    Ratings:
    +877 / 3 / -0
    I was able to reproduce it. Similar jitter, similar spikes.
    I tried increasing the flight model cycles per frame but that didn't help. I think it is neither a bug nor a feature. It's just an artefact of how X-Plane handles friction. I saw it only below ~5kt groundspeed. I will do more testing tomorrow.

    ....oh, and I see that Austin has this "Motion platform stats" section. Thats what you need!
    Use Q, P or R on Yaw. If possible with a highpass filter. Thats the angular rotation rates.
    M, L or N are the angular moments. Those need to be divided by the rotational moments of inertia to get angular accelerations. Then if you integrate those over time you will get Q P R. The sim does all that for you. Just use what you find under motion platform stats. Trust Austin,... and me :)

    In a nutshell: M will work, but different planes will react very differently. Using Q will make the values independent of vehicle type. Thats why MLN are flight-model relevant, QPR are motion-relevant.

    ...I know it sounds confusing, but the key here is imagination!

    "Mathematics requires a small dose, not of genius, but of an imaginative freedom which, in a larger dose, would be insanity." - Angus K. Rodgers