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

Data Format Question

Discussion in 'DIY Motion Simulator Building Q&A / FAQ' started by Kelly Cables, Jun 29, 2014.

  1. Kelly Cables

    Kelly Cables New Member

    Joined:
    Jun 28, 2014
    Messages:
    2
    Balance:
    244Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    6DOF
    How is the data that is sent over the serial connection to my simulator formatted? I have everything set up, but right now I just have my arduino uno handing out bytes arbitrarily to my servos, causing them to twitch randomly. So, I need to know how the sim data is sent so I can properly process it and send it to the right arduino. Any help with this?
    • Useful Useful x 1
  2. eaorobbie

    eaorobbie Well-Known Member SimTools Developer Gold Contributor

    Joined:
    May 26, 2009
    Messages:
    2,574
    Occupation:
    CAD Detailer
    Location:
    Ellenbrook, Western Australia
    Balance:
    20,440Coins
    Ratings:
    +1,684 / 23 / -2
    My Motion Simulator:
    2DOF, DC motor, JRK, SimforceGT, 6DOF
  3. Kelly Cables

    Kelly Cables New Member

    Joined:
    Jun 28, 2014
    Messages:
    2
    Balance:
    244Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    6DOF
    So, the first character read indicates which servo to move, with the following 3 being the angle I give to that servo?
  4. BlazinH

    BlazinH Well-Known Member

    Joined:
    Oct 19, 2013
    Messages:
    2,145
    Location:
    Oklahoma City, USA
    Balance:
    16,621Coins
    Ratings:
    +1,835 / 32 / -1
    I don’t know much about arduino coding, but the serial data out of simtools is formatted exactly how you tell it to be sent out. I believe a member has posted an app here somewhere that will allow you to see the strings of data that simtools is sending out to analyze them. I think there is a link in resources if I recall correctly. Yes, here it is http://www.xsimulator.net/community/marketplace/gameengine-output-testing-tool.88/
    • Informative Informative x 1
  5. eaorobbie

    eaorobbie Well-Known Member SimTools Developer Gold Contributor

    Joined:
    May 26, 2009
    Messages:
    2,574
    Occupation:
    CAD Detailer
    Location:
    Ellenbrook, Western Australia
    Balance:
    20,440Coins
    Ratings:
    +1,684 / 23 / -2
    My Motion Simulator:
    2DOF, DC motor, JRK, SimforceGT, 6DOF
    Ok the next 3 is a value that is sent by simtools that correlates the axis assignment that you have set and outputs them mapped to a bit rate that you have set in interface settings, like the above code will send a value of 0 - 255 then this is mapped within the Ard to 0-180 which is formatted into a deg so the Ard knows what angle to set the servo at. Nice and simple.
    • Useful Useful x 1
  6. CalSim

    CalSim building things

    Joined:
    Jul 24, 2014
    Messages:
    89
    Occupation:
    bacteriology analist
    Location:
    Spain
    Balance:
    1,310Coins
    Ratings:
    +41 / 0 / -0
    My Motion Simulator:
    DC motor, Arduino, JRK
    Yes, i have a problem with my servos: they work great to the right, they become crazy to the left. and i have found why:

    Simtools sends R255 for +100% axis testing bar( my config is R from Roll for axis1)
    Sends R127 for the 0% position ( 90 degrees )
    And Sends R0 for the -100% axis testing bar

    The problem comes when you put the bar at -18%, so the valur comes from R100 to R99

    When the value is R99, the servo comes crazy, cause there is a lack of a character. What we need is a line for the code that adds that exception and teaches the ard to read values <R100

    I'm completly newbie on programming, i've been in this 1 week i've learn all until now via reverse ingeniering :p
  7. eaorobbie

    eaorobbie Well-Known Member SimTools Developer Gold Contributor

    Joined:
    May 26, 2009
    Messages:
    2,574
    Occupation:
    CAD Detailer
    Location:
    Ellenbrook, Western Australia
    Balance:
    20,440Coins
    Ratings:
    +1,684 / 23 / -2
    My Motion Simulator:
    2DOF, DC motor, JRK, SimforceGT, 6DOF
    With my servo code it I use a ~ as an end of command is reached to compute the value.
    IE the Ard reads in at one value at a time, so R99~ reads in as R , code recognizes it now has a value for R Servo coming next so it then captures the next value 9, stores that and checks for another , if another is present it times the previous value by 10 so now its 90 and then reads the next value which is 9 and then adds them together to get 99 then carries on to read the next value and if its a ~ it knows to stop and use that value 99 to send to the servos after it remaps that value to 0-179 to get a degree for the servos and then sets its position before reading the next char and so on it goes.

    Then only issue it can have is timing sometimes requiring a slower baud rate depending on how fast or slow you are sending the data to it.
    • Winner Winner x 1
  8. CalSim

    CalSim building things

    Joined:
    Jul 24, 2014
    Messages:
    89
    Occupation:
    bacteriology analist
    Location:
    Spain
    Balance:
    1,310Coins
    Ratings:
    +41 / 0 / -0
    My Motion Simulator:
    DC motor, Arduino, JRK
    I was using 115200 bauds. I changed it to 9600 and worked fine
    • Agree Agree x 1
    • Winner Winner x 1