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 Mover

Discussion in 'FlyPt Mover' started by pmvcda, May 30, 2019.

  1. SeatTime

    SeatTime Well-Known Member

    Joined:
    Dec 27, 2013
    Messages:
    2,573
    Occupation:
    Retired
    Location:
    Brisbane Australia
    Balance:
    28,370Coins
    Ratings:
    +2,844 / 39 / -0
    My Motion Simulator:
    AC motor, Motion platform
    FI, even though I initially though it was OK, I cannot get a similar good response out of these filters with FS2020. Even the Vertical Speed does not work that well. Obviously the available data quality is having a great effect on this.
  2. GWiz

    GWiz Active Member

    Joined:
    May 12, 2019
    Messages:
    186
    Occupation:
    Dentist
    Location:
    Aberdeenshire, Scotland
    Balance:
    1,498Coins
    Ratings:
    +120 / 0 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
    I'm having some trouble getting Flypt Mover working correctly with some hobby servos. I'm using the arduino hobby servo sketch from EARobbie and have it working in Simtools.

    In Mover, I've setup a serial output and a 'Just Pose' Rig. I can get the first servo working as intended using A<Axis1b>] in the serial output but when I change this to A<Axis1b>]B<Axis2b>] Both servos will move but with a significant delay of around a second or so. I'm not sure if there is some incompatibility allowing the servo code to work on Simtools but not with Mover.

    Anyone got any ideas? Thanks
  3. pmvcda

    pmvcda aka FlyPT

    Joined:
    Nov 3, 2010
    Messages:
    2,115
    Location:
    Portugal
    Balance:
    15,011Coins
    Ratings:
    +2,509 / 17 / -0
    My Motion Simulator:
    6DOF
    Hi,

    by default, Mover sends data at 2ms.
    This might be the problem, try to increase the sending interval in the output to 5. This makes sends at 10ms
  4. GWiz

    GWiz Active Member

    Joined:
    May 12, 2019
    Messages:
    186
    Occupation:
    Dentist
    Location:
    Aberdeenshire, Scotland
    Balance:
    1,498Coins
    Ratings:
    +120 / 0 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
    Thanks for the reply. I increased the interval loops to 5 to give 10ms to match Simtools already, but it still has this behaviour. :(
  5. pmvcda

    pmvcda aka FlyPT

    Joined:
    Nov 3, 2010
    Messages:
    2,115
    Location:
    Portugal
    Balance:
    15,011Coins
    Ratings:
    +2,509 / 17 / -0
    My Motion Simulator:
    6DOF
    OK,
    I'm on the street. I will look at it better when I go back home.
    Will look at the sketch.
    • Friendly Friendly x 1
  6. GWiz

    GWiz Active Member

    Joined:
    May 12, 2019
    Messages:
    186
    Occupation:
    Dentist
    Location:
    Aberdeenshire, Scotland
    Balance:
    1,498Coins
    Ratings:
    +120 / 0 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
    Thankyou, much appreciated. Also thanks from the DIY simulator community for all the time and effort you have put into the Mover software, it's been a godsend for many! hug:
    • Like Like x 2
    • Agree Agree x 1
  7. pmvcda

    pmvcda aka FlyPT

    Joined:
    Nov 3, 2010
    Messages:
    2,115
    Location:
    Portugal
    Balance:
    15,011Coins
    Ratings:
    +2,509 / 17 / -0
    My Motion Simulator:
    6DOF
    @GWiz ,

    Can you point me to the sketch?
    I want to take a look.
  8. GWiz

    GWiz Active Member

    Joined:
    May 12, 2019
    Messages:
    186
    Occupation:
    Dentist
    Location:
    Aberdeenshire, Scotland
    Balance:
    1,498Coins
    Ratings:
    +120 / 0 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
    I'm using this one:

    Code:
    //********************************************************************************************
    // RC Model Servo
    // Original code By EAOROBBIE (Robert Lindsay)
    // Completely mangled by aarondc
    // Tweaked by Spit40 for G-seat with uplift only
    // For free use for Sim Tool Motion Software
    //********************************************************************************************
    #include <Servo.h>
    //#define DEBUG 1                                    // comment out this line to remove debuggin Serial.print lines
    const int kActuatorCount = 2;                       // how many Actuators we are handling
    
    // the letters ("names") sent from Sim Tools to identify each actuator
    // NB: the order of the letters here determines the order of the remaining constants kPins and kActuatorScale
    const char kActuatorName[kActuatorCount] = { 'A', 'B' };
    const int kPins[kActuatorCount] = {4, 5};                       // pins to which the Actuators are attached
    const int kActuatorScale[kActuatorCount][2] = { { 50, 110 } ,    // Right Actuator scaling - set for Spit40's seat
                                                    { 179, 0 }      // Left side Actuator scaling - not yet set
                                                   };    
    const char kEOL = ']';                              // End of Line - the delimiter for our acutator values
    const int kMaxCharCount = 3;                        // some insurance...
    Servo actuatorSet[kActuatorCount];                  // our array of Actuators
    int actuatorPosition[kActuatorCount] = {50, 50};    // current Actuator positions, initialised to 90
    int currentActuator;                                // keep track of the current Actuator being read in from serial port
    int valueCharCount = 0;                             // how many value characters have we read (must be less than kMaxCharCount!!
    
    // set up some states for our state machine
    // psReadActuator = next character from serial port tells us the Actuator
    // psReadValue = next 3 characters from serial port tells us the value
    enum TPortState { psReadActuator, psReadValue };  
    TPortState currentState = psReadActuator;
    
    void setup()
    {
        // attach the Actuators to the pins
        for (int i = 0; i < kActuatorCount; i++)
            actuatorSet[i].attach(kPins[i]);
       
        // initialise actuator position
        for (int i = 0; i < kActuatorCount; i++)
            updateActuator(i);
       
        Serial.begin(9600); // opens serial port at a baud rate of 9600
    }
     
    void loop()
    {
    
    }
    
    // this code only runs when we have serial data available. ie (Serial.available() > 0).
    void serialEvent() {
        char tmpChar;
        int tmpValue;
    
        while (Serial.available()) {
            // if we're waiting for a Actuator name, grab it here
            if (currentState == psReadActuator) {
                tmpChar = Serial.read();
                // look for our actuator in the array of actuator names we set up
    #ifdef DEBUG          
    Serial.print("read in ");          
    Serial.println(tmpChar);          
    #endif
                for (int i = 0; i < kActuatorCount; i++) {
                    if (tmpChar == kActuatorName[i]) {
    #ifdef DEBUG          
    Serial.print("which is actuator ");          
    Serial.println(i);          
    #endif
                        currentActuator = i;                        // remember which actuator we found
                        currentState = psReadValue;                 // start looking for the Actuator position
                        actuatorPosition[currentActuator] = 0;      // initialise the new position
                        valueCharCount = 0;                         // initialise number of value chars read in
                        break;
                    }
                }
            }
           
            // if we're ready to read in the current Actuator's position data
            if (currentState == psReadValue) {
                while ((valueCharCount < kMaxCharCount) && Serial.available()) {
                    tmpValue = Serial.read();
                    if (tmpValue != kEOL) {
                        tmpValue = tmpValue - 48;
                        if ((tmpValue < 0) || (tmpValue > 9)) tmpValue = 0;
                        actuatorPosition[currentActuator] = actuatorPosition[currentActuator] * 10 + tmpValue;
                        valueCharCount++;
                    }
                    else break;
                }
               
                // if we've read the value delimiter, update the Actuator and start looking for the next Actuator name
                if (tmpValue == kEOL || valueCharCount == kMaxCharCount) {
    #ifdef DEBUG          
    Serial.print("read in ");          
    Serial.println(actuatorPosition[currentActuator]);          
    #endif
                    //No -ve on G-seat : 128 = middle
                    if (actuatorPosition[currentActuator]<128) actuatorPosition[currentActuator]=128;
    
                    // scale the new position
                    // Range is now 128 - 255
                    // Maps between min and max
                    actuatorPosition[currentActuator] = map(actuatorPosition[currentActuator], 128, 255, kActuatorScale[currentActuator][0], kActuatorScale[currentActuator][1]);
                    //
    #ifdef DEBUG          
    Serial.print("scaled to ");          
    Serial.println(actuatorPosition[currentActuator]);          
    #endif
                    updateActuator(currentActuator);
                    currentState = psReadActuator;
                }
            }
        }
    }
    
    
    // write the current Actuator position to the passed in Actuator
    void updateActuator(int thisActuator) {
        int safePos;
        safePos=actuatorPosition[thisActuator];
      //  safePos=100;
        actuatorSet[thisActuator].write(safePos);
    }
    
  9. pmvcda

    pmvcda aka FlyPT

    Joined:
    Nov 3, 2010
    Messages:
    2,115
    Location:
    Portugal
    Balance:
    15,011Coins
    Ratings:
    +2,509 / 17 / -0
    My Motion Simulator:
    6DOF
    @GWiz ,

    Just to be sure:
    Are you using 9600 in the speed?
    Are you using decimal output?
    Are you using 8 bits in the rig/actuators? (from a fast look, it seems to use 1 byte to set the position)

    upload_2021-11-10_15-19-46.png
    Last edited: Nov 10, 2021
  10. GWiz

    GWiz Active Member

    Joined:
    May 12, 2019
    Messages:
    186
    Occupation:
    Dentist
    Location:
    Aberdeenshire, Scotland
    Balance:
    1,498Coins
    Ratings:
    +120 / 0 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
    Yes, that's correct; 9600 Serial Speed, 8 Data Bits in both the serial output and Position bit output and Decimal set as output in the serial output.
  11. pmvcda

    pmvcda aka FlyPT

    Joined:
    Nov 3, 2010
    Messages:
    2,115
    Location:
    Portugal
    Balance:
    15,011Coins
    Ratings:
    +2,509 / 17 / -0
    My Motion Simulator:
    6DOF
    And in the rig module?
    Did you change from 10 to 8bits?
    See attached image in the last post
  12. GWiz

    GWiz Active Member

    Joined:
    May 12, 2019
    Messages:
    186
    Occupation:
    Dentist
    Location:
    Aberdeenshire, Scotland
    Balance:
    1,498Coins
    Ratings:
    +120 / 0 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
    Yes I did, to give (0 to 255 in 1 byte)
  13. pmvcda

    pmvcda aka FlyPT

    Joined:
    Nov 3, 2010
    Messages:
    2,115
    Location:
    Portugal
    Balance:
    15,011Coins
    Ratings:
    +2,509 / 17 / -0
    My Motion Simulator:
    6DOF
    :thinkOk, then explain me what you see hapenning.
    I'm without ideas right now...
  14. pmvcda

    pmvcda aka FlyPT

    Joined:
    Nov 3, 2010
    Messages:
    2,115
    Location:
    Portugal
    Balance:
    15,011Coins
    Ratings:
    +2,509 / 17 / -0
    My Motion Simulator:
    6DOF
    @GWiz ,

    Wait, I have one idea.
    Please try to hide the actuators info:
    upload_2021-11-10_17-50-44.png
  15. GWiz

    GWiz Active Member

    Joined:
    May 12, 2019
    Messages:
    186
    Occupation:
    Dentist
    Location:
    Aberdeenshire, Scotland
    Balance:
    1,498Coins
    Ratings:
    +120 / 0 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
    I can hide the actuator info, but it doesn't seem to help.

    I have an idea that it might be due to the way my arduino code is set up, it expects a value such as A050B075 rather than A50B75. I wonder if the missing filler zeros are playing havoc when the output is less than 100? I had a similar issue when trying to setup a Wind sketch which wouldn't work below 100 and so the fans kept 100 as a minimum value. I botched my way around it by subtracting 100 in the sketch and remapping Mover for values from 100 to 255. (There's probably a more sensible way of doing this!)
  16. pmvcda

    pmvcda aka FlyPT

    Joined:
    Nov 3, 2010
    Messages:
    2,115
    Location:
    Portugal
    Balance:
    15,011Coins
    Ratings:
    +2,509 / 17 / -0
    My Motion Simulator:
    6DOF
    Oh, ok. Might be that.

    Mover is not sending the numeric values with zeros to make it a certain amount of digits.

    I made a fast sketch. Did not test, no idea if it works:

    Code:
    // Position of the servos is set from 0º to 180º degrees
    // We define the servos in Mover as 8bit servos, with a value from 0 to 255
    // So the values are mapped from the bit range to the angle range
    
    #include <Servo.h>
    
    // Initialize servos
    Servo servoA;
    Servo servoB;
    
    char lastReceivedLetter = '';
    string lastReceivedValue = "";
    
    // Serial speed to use
    const int serialSpeed = 9600;
    
    void setup()
    {
        // Select Arduino pins for each servo
        servoA.attach(4);
        servoB.attach(5);
      
        // Set servos to initial positions (min=0 max=180)
        servoA.write(90);
        servoB.write(90);
    
        // Open serial port
        Serial.begin(serialSpeed);
    }
    
    void loop()
    {
        while (Serial.available())
        {
            // Get byte from the serial
            var receivedByte = Serial.read();
            // Test if we received a number (numbers go from byte 48='0' to 57='9')
            if(receivedByte>=48 && receivedByte<=57)
            {
                lastReceivedValue += receivedByte;
            }
            // If we are here, we received a letter or something else
            else
            {
                if(lastReceivedLetter=='A')servoA.write(map(lastReceivedValue.toInt(),0,255,0,180);
                else if(lastReceivedLetter=='B')servoB.write(map(lastReceivedValue.toInt(),0,255,0,180);
                lastReceivedValue = "";
                lastReceivedLetter = receivedByte;
            }
        }
    }
    So this should use with the same settings, but the serial string should be:
    A<Axis1a>B<Axis1b>

    If you want to, please test. I can test it tomorrow and correct bugs. Not right now. Sorry.
    • Useful Useful x 1
    Last edited: Nov 10, 2021
  17. GWiz

    GWiz Active Member

    Joined:
    May 12, 2019
    Messages:
    186
    Occupation:
    Dentist
    Location:
    Aberdeenshire, Scotland
    Balance:
    1,498Coins
    Ratings:
    +120 / 0 / -0
    My Motion Simulator:
    DC motor, Arduino, 6DOF
    Thanks so much, my arduino coding is not good but I managed to get a variation of this code working more or less. I still need to play around with it a bit to get it 100%, but I'm no longer experiencing any strange or delayed movements so I'm fairly confident that my initial problem was due to values below 3 digits not being read correctly and the error being compounded with each additional servo I attached.

    Many thanks again for going above and beyond. :cheers
    • Like Like x 1
  18. Flymen

    Flymen Flymen Gold Contributor

    Joined:
    May 19, 2018
    Messages:
    336
    Location:
    Montreal, Canada
    Balance:
    2,423Coins
    Ratings:
    +191 / 2 / -0
    My Motion Simulator:
    DC motor, 6DOF
    Hi @pmvcda ,
    First , thanks a lot for your project and your Time . ( Sim and Program Mover ) .
    After two years with this project , my Sim ( with little changes ) Work Again perfecly !!! :cheers
    I do my best to learn all Filters from Mover but no easy!!! May be with some expériences and two years again will Yelp me to anderstand 50% from them:grin ! Thanks!
    hug:

    1- Now I know that my Rig Goes well .Can I do that :
    Q- When I close ( shut off) my Pc , I lost all set up with my Esp32 ( Calibration and OVRMC ) I need to do a new calibration of my rig and set up of OVRMC with open VR Motion on Steam VR . ( like 7-10 min of set up). Normaly my PC stay standby and I can skip this set up !!!
    But it's tiring!!!!:eek:
    Arduino uno have this option to stay live with a Adapter Power Supply - 9VDC 650mA and not ESP32 . Finaly i will try to find a adapter to fit 5-9 vdc on it !!!
    What do you think ?o_O
    2- I’m a new Rookie on Iracing , miss some data télémétrie for suspension , Is it normal ?
    Or I must use only noise data ?
    Thanks
    Last edited: Nov 12, 2021
  19. chandy21

    chandy21 New Member

    Joined:
    Jun 20, 2020
    Messages:
    13
    Occupation:
    Game Developer
    Location:
    Melbourne, Victoria, Australia
    Balance:
    162Coins
    Ratings:
    +11 / 0 / -0
    My Motion Simulator:
    3DOF
    I really like the idea of the Black Box Pose. I think it simplifies things to allow FlyPT Mover to be exposed to a larger audience like it deserves.

    I need some more time with it, but it sometimes gives motion I don't understand. I'm using DiRT Rally 2.0 as a source, and sometimes I get Pitch and Roll when I don't think my car is either tilted by the road or by surge or sway.

    I haven't been able to pinpoint what the car might be doing to cause it, but I will be tilted back and to the right and left there until I drive to cause enough movement.

    I know it's early days for it, but just wanted to give a little feedback.

    My "Pose :: From Motion" is working great, so I don't need this fixed to enjoy Mover, just mentioning in case it helps.
  20. VirtualObsession

    VirtualObsession Member Gold Contributor

    Joined:
    May 20, 2017
    Messages:
    61
    Occupation:
    IT developer
    Location:
    Hertfordshire, UK
    Balance:
    256Coins
    Ratings:
    +10 / 0 / -0
    My Motion Simulator:
    6DOF
    Is it possible to receive RPM telemetry from the DCS lua plugin? I'd like to simulate helicopter rotor blade vibrations. I think I may have seen RPM in the sources module, but this is always zero.