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

Question Help with my 6DOF RC Simulator Test not working properly.

Discussion in 'DIY Motion Simulator Projects' started by Kahala, Sep 22, 2021.

  1. Kahala

    Kahala New Member Gold Contributor

    Joined:
    Jan 28, 2021
    Messages:
    9
    Balance:
    18Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, Motion platform, 6DOF
    Hello everybody.
    My name is Håkan and I am a total beginner in building my own DIY simulator. I apologize if my English is not good but I hope you all can still understand what I am writing. I ask all of you who may answer that you use simple language and simple terms so that I have a chance to understand what you mean. I learn all the time ...

    I have managed to build a small 2DOF RC car simulator with the help of what I managed to read here and there on this forum. I enclose a picture of it and it works quite well. Have tested it on LFS and link is here:



    [​IMG][​IMG]


    For it I have used the following hardware:
    1 x Arduino UNO
    2 x XT Generig Mini Servo
    1 x 6VDC Power Adapter
    Some mixed RC stuff and some wires

    Now I want to take the next step and build a 6DOF RC simulator as a test before a real construction of a so-called Stewart platform. I have connected everything on my worktable with the same hardware as in 2DOF. The only difference is that the servos I use now are MG90S Metal Gear Mini Servo with the following specifications.

    Modulation: Analog
    Torque: 4.8V: 30.60 oz-in (2.20 kg-cm)
    6.0V: 34.70 oz-in (2.50 kg-cm)
    Speed: 4.8V: 0.11 sec / 60 °
    6.0V: 0.10 sec / 60 °
    Rotational Range: 180 °
    Pulse Cycle: 20 ms
    Pulse Width: 400-2400 µs

    The code I use which is slightly modified by me to be able to control 6 servos instead of two is further down here in this thread.

    In SimTools GameEngine I have the following settings. (Some pictures is attached)

    Interface Settings:
    ComPort: COM3
    BitsPerSecond: 9600
    Data Bits: 8
    Parity: None
    Stop Bits: 1
    Output-Bit-Range: 8
    Output Type. Decimal.
    Interface Output: A <Axis1a> B <Axis2a> C <Axis3a> D <Axis4a> E <Axis5a> F <Axis6a>

    I mainly have two problems that I do not understand.
    1. If in "Axis Assignments" I have a value higher than 20%, the servo jerks sharply when I in "Output Testing" pull the slider to a low value (to the left side of slider). The higher the%, the earlier the jerk comes.
    For example. if I set Axis1a to 22%, the jerk comes at -88% slider value. If I instead set Axis1a to 40%, the jerk will already be at -55% slider value. Positive values are not a problem. This phenomenon applies to all 6 axes, Axis1a to Axis6a.

    Why can I not enter a value higher than 20% without getting these twitches? The higher the percentage, the earlier the twitches come. With a low percentage, I also get a much smaller movement on the servo arm than the servo can handle and a simulator that moves much less than I want.

    [​IMG][​IMG]

    2. The servos start/neutral position that I set in the Arduino code (int actuatorPosition [kActuatorCount] = {90, 90, 90, 90, 90, 90}) is correct as long as the Arduino IDE controls UNO. But as soon as I click on "Turn On" in "Output Testing" all the servos move to some other position that is not in the neutral position and I do not know how or where to correct the neutral position so that it is in the correct starting position.
    What am I doing wrong or what do I not understand? Please, can someone guide me on the right path so I can get on with my 6DOF RC Simulator and learn all the settings in SimTools before I spend a lot of money on starting building a "real" motion platform.

    [​IMG]

    Please help me!
    Thanks

    The code I use, tweeked for my 6DOF RC Servo Sim

    //********************************************************************************************
    // RC Model Servo
    // Original code By EAOROBBIE (Robert Lindsay)
    // Completely mangled by aarondc
    // 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 = 6; // 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] = { 'R', 'L', 'F', 'V', 'M', 'N' };
    const char kActuatorName[kActuatorCount] = { 'A', 'B', 'C', 'D', 'E', 'F' };
    //const int kPins[kActuatorCount] = {2, 3, 4, 5, 6, 7}; // pins to which the Actuators are attached
    const int kPins[kActuatorCount] = {8, 9, 10, 11, 12, 13}; // pins to which the Actuators are attached
    const int kActuatorScale[kActuatorCount][2] = { { 0, 255 } , // 255 original Right Actuator scaling
    { 0, 255 } , // 255 original Left side Actuator scaling
    { 0, 255 } ,
    { 0, 255 } ,
    { 0, 255 } ,
    { 0, 255 }
    };
    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] = {90, 90, 90, 90, 90, 90};// 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.attach(kPins);

    // 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) {
    #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
    // scale the new position so the value is between 0 and 179
    actuatorPosition[currentActuator] = map(actuatorPosition[currentActuator], 0, 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) {
    actuatorSet[thisActuator].write(actuatorPosition[thisActuator]);
    }

    Attached Files:

  2. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    20,464
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    144,620Coins
    Ratings:
    +10,741 / 52 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
  3. Kahala

    Kahala New Member Gold Contributor

    Joined:
    Jan 28, 2021
    Messages:
    9
    Balance:
    18Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, Motion platform, 6DOF
    Thank's for the reply.

    I have read the manual v. 2.5 from top to bottom, over and over again, and tried most things but still can not understand my problem. That's why I'm asking for help here.

    If this is the case that the servos are downward in each DOF and not horizontal as I thought then how come the following?


    This setting of forces only gives movement on servo one when I move the sliders for Roll, Pitch and Yaw:

    upload_2021-9-23_14-53-38.png


    This setting of forces instead gives movement on servos one, two and three when I move the sliders for related force Roll, Pitch and Yaw:

    upload_2021-9-23_14-59-15.png

    I thought that Axis1a corresponds to servo one, Axis2a corresponds to servo two and so on. Is that completely wrong?

    My problem with twitches and incorrect neutral position as I described it in the beginning unfortunately remains ...

    Attached Files:

  4. misoswan

    misoswan Active Member

    Joined:
    Jun 27, 2014
    Messages:
    286
    Balance:
    1,000Coins
    Ratings:
    +72 / 1 / -0
    My Motion Simulator:
    3DOF, Arduino, JRK
    dof1 pitch ,pitch ... one dir the sign will light up in orange
    dof 2 roll ,roll.....THE SAME
    Last edited: Sep 23, 2021
  5. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    20,464
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    144,620Coins
    Ratings:
    +10,741 / 52 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    You need to repeat this format 6 times so each servo axis (Axis 1a, Axis 2a, Axis 3a, Axis 4a, Axis 5a, Axis 6a) is configured:

    [​IMG]
  6. Kahala

    Kahala New Member Gold Contributor

    Joined:
    Jan 28, 2021
    Messages:
    9
    Balance:
    18Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, Motion platform, 6DOF
    Ok, got it! It's completed now.
    But jerks, the wrong neutral position and less than 20% value remains. What to do about that?
  7. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    20,464
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    144,620Coins
    Ratings:
    +10,741 / 52 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    Can you please post pictures of all of your current settings.
  8. Kahala

    Kahala New Member Gold Contributor

    Joined:
    Jan 28, 2021
    Messages:
    9
    Balance:
    18Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, Motion platform, 6DOF

    Axis Assignments:

    Axis1a: Roll +10 / Pitch +15 / Heave -15 / Yaw -15 / Sway -15 / Surge +15
    Axis2a: Roll -15 / Pitch 0 / Heave +15 / Yaw -15 / Sway 0 / Surge +15
    Axis3a: Roll +10 / Pitch -15 / Heave -15 / Yaw -15 / Sway -15 / Surge +15
    Axis4a: Roll +10 / Pitch +15 / Heave +15 / Yaw -15 / Sway -15 / Surge -15
    Axis5a: Roll -15 / Pitch 0 / Heave -15 / Yaw -15 / Sway 0 / Surge -15
    Axis6a: Roll +10 / Pitch +15 / Heave +15 / Yaw -15 / Sway -15 / Surge -15

    Interface Settings:
    Serial / COM20 / 9600 BPS / 8 DB / None P / 1 SB / 10 O-BR / Decimal O-Type

    Startup - Output: [A<128>][B<128>][C<128>][D<128>][E<128>][F<128>] 10ms
    Interface - Output: [A<Axis1a>][B<Axis2a>][C<Axis3a>][D<Axis4a>][E<Axis5a>][F<Axis6a>] 10ms
    Shutdown - Output: [A<128>][B<128>][C<128>][D<128>][E<128>][F<128>] 10ms

    Axis Limiting:
    100% for all axis
  9. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    20,464
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    144,620Coins
    Ratings:
    +10,741 / 52 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    Can you please post pictures of ALL of your current settings.
  10. Kahala

    Kahala New Member Gold Contributor

    Joined:
    Jan 28, 2021
    Messages:
    9
    Balance:
    18Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, Motion platform, 6DOF
  11. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    20,464
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    144,620Coins
    Ratings:
    +10,741 / 52 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    Unless you have modified it with @eaorobbie's code the traditional Interface convention is A<Axis1a>~B<Axis2a>~C<Axis3a>~D<Axis4a>~E<Axis5a>~F<Axis6a>~

    Bit Range is normally 8.
  12. Kahala

    Kahala New Member Gold Contributor

    Joined:
    Jan 28, 2021
    Messages:
    9
    Balance:
    18Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, Motion platform, 6DOF
    Thank's noorbeast for your efforts to help!

    If I change the Bit Range to 8, absolutely nothing happens when I test if it works in the Output Testing window.

    It also does not matter if I write,
    [A <Axis1a>] [B <Axis2a>]. . .
    or
    A <Axis1a> ~ B <Axis2a> ~. . .

    But by changing Startup - Output to:
    A<128>~B<128>~C<128>~D<128>~E<128>~F<128>~
    The wrong neutral position is gone. But unfortunately the jerks at high or low % amount still remains when output testing.
  13. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    20,464
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    144,620Coins
    Ratings:
    +10,741 / 52 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    Do not add additional spaces like you have here: A <Axis1a> ~ B <Axis2a> ~
    There should be no spaces: A<Axis1a>~B<Axis2a>~C<Axis3a>~D<Axis4a>~E<Axis5a>~F<Axis6a>~
  14. Kahala

    Kahala New Member Gold Contributor

    Joined:
    Jan 28, 2021
    Messages:
    9
    Balance:
    18Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    2DOF, DC motor, Arduino, Motion platform, 6DOF
    I have no extra spaces, must have happened when I copied and pasted the text from simtool to here.
    Sorry for that.