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

FlyPT 6DOF/Stewart/Hexapod Interface for linear and rotating actuators

Discussion in 'FlyPt Mover' started by pmvcda, Jan 2, 2019.

  1. pmvcda

    pmvcda aka FlyPT

    Joined:
    Nov 3, 2010
    Messages:
    2,158
    Location:
    Portugal
    Balance:
    15,264Coins
    Ratings:
    +2,532 / 17 / -0
    My Motion Simulator:
    6DOF
    No, the equation calculates the angle to achieve the position we want for the top joint.
    Just uploaded a new version.
    Will explain in next post.
  2. pmvcda

    pmvcda aka FlyPT

    Joined:
    Nov 3, 2010
    Messages:
    2,158
    Location:
    Portugal
    Balance:
    15,264Coins
    Ratings:
    +2,532 / 17 / -0
    My Motion Simulator:
    6DOF
    Version 1.8.5

    In the first post for download

    No major changes.
    Corrected bugs to show actuators in red when out of range (both rotating and linear).
    This happens only when you have "stay in last possible pose unchecked".
    The rotating actuators have two distinct out of range situations:

    - One where the crank is red, means the necessary angle is beyond the range specified in the rig dimensions
    -The other where the rod is red, means there's no solution in the equation. There's no angle that allows to produce the position we want for the top joint.
    The top joint is to far or to close to have an angle that allows to produce that position.
    In this situation, the angle shown is in red followed by "!", And the value shown is the last angle calculated.

    In the figure we can see actuators in that kind of situations:
    Sem nome.jpg

    Note: Calibration is shown in menu, but not in the build (hidden). It's not working yet.
    Also actuator 5 as both out of range situations, but ! is not shown in the angle value... some if somewhere...
    • Like Like x 2
  3. pmvcda

    pmvcda aka FlyPT

    Joined:
    Nov 3, 2010
    Messages:
    2,158
    Location:
    Portugal
    Balance:
    15,264Coins
    Ratings:
    +2,532 / 17 / -0
    My Motion Simulator:
    6DOF
    The equation I use to calculate the angle on rotating actuators is really simple and there's no need for more than this.
    It's calculated in real 3D space.
    It's based on the sum of the vectors:

    Sem nome.jpg

    Now solve it in order to A and you have the angle.
    If there's a division by zero or there's no result, what we want is to far away or to close...

    In code (simplified to post here):
    Code:
            public void calculateAngle(....)
            {
                double x = topJoint.x - bottomJoint.x;
                double y = topJoint.y - bottomJoint.y;
                double z = topJoint.z - bottomJoint.z;
    
                double a1 = 2 * crank * x * verticalAngleCOS;
                double a2 = 2 * crank * y * verticalAngleSIN;
                double a3 = crank * crank - rod * rod + x * x + y * y + z * z;
                double a4 = a1 + a2 + a3;
                pretendedAngle = 2 * (Math.Atan((2 * crank * z - 0.5 * Math.Sqrt(16 * crank * crank * z * z - 4 * (-a1 - a2 + a3) * (a4))) / (a4)));
             
      
                // AND WE HAVE THE ANGLE
                // NEXT IS JUST TO SHOW THE JOINT IN 3D AND SEE IF IT'S OUT OF RANGE
    
                if (!double.IsNaN(pretendedAngle)) // IF IT'S A NUMBER, THEN THERE'S A RESULT
                {
                    outOfRange = false;
                    rodCrankJoint.x = crank * Math.Cos(pretendedAngle);
                    rodCrankJoint.y = bottomJoint.y + rodCrankJoint.x * verticalAngleSIN;
                    rodCrankJoint.x *= verticalAngleCOS;
                    rodCrankJoint.x += bottomJoint.x;
                    rodCrankJoint.z = bottomJoint.z + crank * Math.Sin(pretendedAngle);
    
                    // RAD to DEGREES
                    pretendedAngle *= RAD_TO_DEG;
                    pretendedAngle -= middleAngle;
    
                    if (!swapSwapped && swapped) pretendedAngle = -pretendedAngle;
                }
                else
                {
                    outOfRange = true; // CALCULATION GIVES AN ERROR! THERE'S NO POSSIBLE SOLUTION
                }
            }
    
    The code is "optimised", so repeated calculations are calculated one time and reused.
    Sin and Cos used are calculated when you define the rig, so there's only one atan and one sqrt with many + and *.
    Could be faster, maybe it's possible to remove the SQRT.

    In the first builds, I made a simplified lookup table thinking it could be faster. But to achieve good speed and precision we need an huge lookup table eating to much memory.
    Processors are fast enough for the formula right now.
    • Informative Informative x 1
    Last edited: Apr 4, 2019
  4. SilentChill

    SilentChill Problem Maker

    Joined:
    Jul 19, 2014
    Messages:
    2,643
    Occupation:
    Railway Maintenance
    Location:
    Morecambe, Lancashire, England
    Balance:
    20,560Coins
    Ratings:
    +3,488 / 34 / -0
    My Motion Simulator:
    DC motor, Arduino, Motion platform, 6DOF
    Yeah I as gonna mention this before but knew you would work it out :confused::eek: :grin
    • Funny Funny x 2
  5. Gabor Pittner

    Gabor Pittner Active Member

    Joined:
    Oct 25, 2018
    Messages:
    195
    Location:
    Szekesfehervar Hungary
    Balance:
    1,337Coins
    Ratings:
    +85 / 0 / -0
    My Motion Simulator:
    6DOF
    I have to say FlyPT is an amazing 6dof interface, and it gets better and better. Now it has some solution that I haven't even dreamt before. Thank you so much @pmvcda every movments are so clear and precise. Surge and sway movements are straight as they should be.
    Thanks for have a solution to disable "stay in last position" my rig does not clipp anymore. When I used hexpod I had to reduce ranges to avoid clipping. I know when a crank stops on the limit, but the others move onward the movements would be fake a bit. But much better than stop position, and clipping when moves come back.
    • Like Like x 1
    • Agree Agree x 1
  6. Gabor Pittner

    Gabor Pittner Active Member

    Joined:
    Oct 25, 2018
    Messages:
    195
    Location:
    Szekesfehervar Hungary
    Balance:
    1,337Coins
    Ratings:
    +85 / 0 / -0
    My Motion Simulator:
    6DOF
    "The forces generated can completely neutralise the rotations that come from "position", but the final rotation is already a result of the "position"+rotation due to acceleration"
    That's exactly what a was talking about before. All simtools plugins are bad because of this, even the flysim plugins too. When an airplane turns left the roll tilts left its OK, but when I pull the joy up to turn fast it occurs more G force but the roll keeps left as before.
    • Like Like x 1
  7. 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
    @Gabor Pittner

    It seems you missed that you have a similar feature in HeXpod under “fake kinematics” name.

    C5FF1609-4ED6-43DB-A1FD-E9DB39779181.jpeg

    If someone likes to drive his platform with false vectors it’s his own choice.

    Especially for rotary rigs which are more sensible to collisions, before using this option, I would advise first to understand what you are doing and empiricaly test every possible combination so you don’t get bad surprises.

    Assuming that it acts in a similar way like in HeXpod, Personally I will never recommend to use this feature.
  8. 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 issue was discussed since a while with @Dirty and @value1 (the plugin writer)

    If you want to try my experimental version of x-plane plugin where we get rid of angular positions and using instead Austin’s “motion platform stats” drop me a message.
  9. Gabor Pittner

    Gabor Pittner Active Member

    Joined:
    Oct 25, 2018
    Messages:
    195
    Location:
    Szekesfehervar Hungary
    Balance:
    1,337Coins
    Ratings:
    +85 / 0 / -0
    My Motion Simulator:
    6DOF
    You are right, I missed that. I will try it too, thanks!
  10. Gabor Pittner

    Gabor Pittner Active Member

    Joined:
    Oct 25, 2018
    Messages:
    195
    Location:
    Szekesfehervar Hungary
    Balance:
    1,337Coins
    Ratings:
    +85 / 0 / -0
    My Motion Simulator:
    6DOF
    I use DCS to fly only. Don't you have an experimental version of that? :roll
  11. Gabor Pittner

    Gabor Pittner Active Member

    Joined:
    Oct 25, 2018
    Messages:
    195
    Location:
    Szekesfehervar Hungary
    Balance:
    1,337Coins
    Ratings:
    +85 / 0 / -0
    My Motion Simulator:
    6DOF
    Can you point me the topic of that? I searched some conversation on this forum, but haven't found a topic.
  12. 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
    No idea about DCS.

    Talk to @value1 for that. For sure @Dirty and @pmvcda knows what telemetry options are available there as well.

    What and how it needs to be used can be discussed.
  13. 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
    • Useful Useful x 1
  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
    @Gabor Pittner

    I don’t want to disappoint you but I have the feeling that you are trying to “compensate” the lack of power of your motors by using the “fake kinematics” feature.

    The design of a Stewart platform (ratio of upper/lower platform, angle of attack of haim joints if such are in use , the length of the legs and the length of the crank arm) plays a fundamental role in the displacement capabilitiy

    I am not sure that willing go out of the geometrical workspace is a good thing to do.

    Cheers
  15. 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
    Thanks for out of pose fix.

    In my environment once I disconnect from comport, it’s hard to reconnect.

    May I ask for a simple button to disconnect hardware without disconnecting the comport ?
    • Agree Agree x 1
  16. wannabeaflyer2

    wannabeaflyer2 Well-Known Member

    Joined:
    Jun 12, 2015
    Messages:
    724
    Location:
    london uk
    Balance:
    8,310Coins
    Ratings:
    +953 / 7 / -0
    My Motion Simulator:
    2DOF, Arduino, Motion platform, 6DOF
    Hi @pmvcda im going to apologise upfront if this has already been asked for or discussed , During adventures setting up my platform I find it very useful to cycle each test actuator back and forth to access Speed and repeatability of movement positioning ,

    so the big ask is , don't mean to add to your massive workload here , but would it be possible to add an function (in manual Mode) that allows each actuator to be cycled back and forth ( as you would using the sliders ) but without operator intervention ...

    I guess im asking for a similar function to that found in the SMC utility which generates a sine wave or simulated Motion sequence to allow the operator see how each Actuator performs in terms of speed and Positional repeatability ...

    Maybe just attach a an up down loop and a linear travel input box to the slider, to automatically do this if the function is selected during system setup ... I don't underestimate the work involved and easy to ask not so easy to implement :) but tought it would be a useful Function ( selfishly LOL ) but may be of benefit to other users during system / Platform setup.. Cheers
    • Like Like x 1
    • Agree Agree x 1
  17. 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‘ve already made a similar request couple of weeks ago with a small difference:
    Instead to do it for single actuators you could imagine it for dofs.

    All we need is a setable speed/time between loops/ and amplitude.

    I developed such a thing in HeXpod and it’s great for testing servo accelerations and controller pid.

    Look here:



    If you want to test a single actuator you could unplug all others.
    • Like Like x 1
    Last edited: Apr 6, 2019
  18. Gabor Pittner

    Gabor Pittner Active Member

    Joined:
    Oct 25, 2018
    Messages:
    195
    Location:
    Szekesfehervar Hungary
    Balance:
    1,337Coins
    Ratings:
    +85 / 0 / -0
    My Motion Simulator:
    6DOF
    My motors are extremely strong and fast, much stronger than I imagined before. So I don't have a problem with that.
    I always tried to configure HeXpod and FlyPT interfaces to never reach the limit, because it occurs strange clipping, sometimes it hurts :D. So I want to avoid that. The good reason when I move the sliders to the end of all 6 forces all directions and the rig does not reach the limit. But I can use only 10°of roll peach yaw. and 80mm to heave, sway, and surge. With that configuration my rig never goes out to the limit. But lets see this video please. It works without clipping at all using 100mm range of heave sway surge , and 15° of roll peatch and yaw. uncheck stay last possible pose. In that case the arms never go out to the limit but the others can move towards and the rig doesn't stop, but moves fake a bit....:cool: much better than its clipping :)
    • Like Like x 2
    • Agree Agree x 1
    Last edited: Apr 6, 2019
  19. Gabor Pittner

    Gabor Pittner Active Member

    Joined:
    Oct 25, 2018
    Messages:
    195
    Location:
    Szekesfehervar Hungary
    Balance:
    1,337Coins
    Ratings:
    +85 / 0 / -0
    My Motion Simulator:
    6DOF
    But I have to say, I never recognise the fake movement when I drive a car in VR and forces are mixed.
    • Agree Agree x 1
  20. 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
    If they are strong increase you crank lever for better displacement.

    You vid looks very good.

    If you don’t want to change the crank length you can optimize your starting position. (If it’s not done yet)

    1.)
    Sometimes couple of degrees up or down can really make grow your rotational capability.
    2.)
    Try to washout the surge sway and yaw


    I would apply some positive pitch for your acceleration. You don’t like this approach?
    Last edited: Apr 6, 2019