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

Getting real time data for custom motion simulator

Discussion in 'DIY Motion Simulator Projects' started by Fontys, Sep 18, 2013.

  1. Fontys

    Fontys New Member

    Joined:
    Sep 18, 2013
    Messages:
    11
    Location:
    Helmond, The Netherlands
    Balance:
    15Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    Motion platform
    Hi, hopefully this is in the right place...
    We've got a full car cockpit mounted on a 6DOF hydraulic motion platform that currently works with Live For Speed and we want to get it working with rF2.
    We currently use outsim and outgage with LFS to make it send UDP packets to our hydraulics computer which then uses the sent acceleration and speed on 3 axes to move the platform.
    The information regarding speed/revs/etc. is also sent via the CAN bus of the original car to have the car display the game speed/revs/etc., which is also done with a few lines in a configuration file.
    We want to do the same with rF2. I notice that there's a number of software packages available for USB systems etc. which is probably simpler for most people, but we just want the raw data sent in real time, which I have yet to find a solution to.
    I take it this would be best done with a plugin? I have some experience with C and C++ but am at a complete loss when it comes to compiling dll files (I couldn't even get the source files in the example plugin to compile!), so any help, whether it be direct help or just a link to a tutorial (which I looked for, but seemed unable to find) for the basics of writing a plugin.
    Thanks! Even just pointing me towards a different forum if there's another which would be more appropriate to post this question in...
    Let me know if you need any more info!
    tl;dr Is there an outsim/outgage equivalent in rFactor 2?
  2. RacingMat

    RacingMat Well-Known Member Gold Contributor

    Joined:
    Feb 22, 2013
    Messages:
    2,236
    Location:
    Marseille - FRANCE
    Balance:
    20,975Coins
    Ratings:
    +2,089 / 21 / -2
    My Motion Simulator:
    2DOF, DC motor, Arduino
    Hello Fontys,

    To compile ISI example plugin : you have to download Visual Studio C++ 2010 Express (from Microsoft, it's free and large : 300Mo !)

    Once done, unzip the ExamplePlugin : in "VC7" sub-directory, you double click on the file "ExamplePlugin.vcproj".
    Visual Studio will open the sources and convert it to newest version .vcxproj.

    Once done, you compile it as a .dll in the options of the projet.

    These are the first steps ;)
    Mat
  3. Historiker

    Historiker Dramamine Adict Gold Contributor

    Joined:
    Dec 16, 2010
    Messages:
    2,161
    Occupation:
    Retired
    Location:
    Michigan USA
    Balance:
    9,201Coins
    Ratings:
    +2,164 / 19 / -1
    My Motion Simulator:
    3DOF, DC motor, Arduino, Motion platform, 6DOF
    Mat, Thanks! I too have been trying to work with the sample plugins but no luck so far. I did install Visual Studio Express (2012 a 5 gb download!!) but did not know where to put the sample files. I will give that a try.

    Fontys, Welcome to the XSimulator.net community! I do hope you find the information that you need here and I personally would love to see more information on your build.
  4. bsft

    bsft

    Balance:
    Coins
    Ratings:
    +0 / 0 / -0
    Yes Fontys, welcome. Answers should come soon enough for your project.
    People are friendly and helpful here.
    • Like Like x 1
  5. Fontys

    Fontys New Member

    Joined:
    Sep 18, 2013
    Messages:
    11
    Location:
    Helmond, The Netherlands
    Balance:
    15Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    Motion platform
    Thanks guys, that's helpful, though I don't consider those big files as I've got a 100mbps connection :p
    Managed to compile everything fine, but still have little idea what I do next.

    I notice that you're all SimTools beta testers; would that be any help for me, or is that more focussed on electric actuators directly controlled by the PC?
    Due to my C++ skills being limited, it would definitely be better if I could just use something existing such as how you can use Outsim and Outgage in Live For Speed to output those signals via UDP or even a more detailed tutorial on how to get started.


    @Historiker
    The setup has the shell of a Mitsubishi Colt mounted on a hydraulic hexapod controlled by a separate hydraulics computer. It uses the original internal fixings (including wheel, pedals etc.) to control the game. It also uses the original power steering motor for force feedback purposes (though I've also been having some problems with that lately). All this is connected and controlled primarily by a PC/104 running a simulink model in real time. :)
    Last edited: Sep 18, 2013
  6. value1

    value1 Nerd SimAxe Beta Tester SimTools Developer Gold Contributor

    Joined:
    Jan 9, 2011
    Messages:
    2,184
    Location:
    Zug, Switzerland
    Balance:
    14,797Coins
    Ratings:
    +3,322 / 11 / -1
    My Motion Simulator:
    2DOF, DC motor, JRK, Joyrider
    Hi Fontys
    Attached a zip file including all the necessary files to compile your own plugin with Visual C++ 201x Express
    The dll collects pitch, roll, yaw and surge-, sway- and heave-acceleration and sends them out to UDP port 10815.
    rFactor2 starts sending data out only about 5 sec after the start. This is an issue of rFactor2 and not of the dll/UDP server/client ;)
    I have stripped out all the unnecessary stuff, so its nice and clean for whatever you want to change.

    How to send the data to a CAN bus I have no experience.
    rFactor2_dll.zip

    PS: A picture of your simulator would be nice :D
    • Like Like x 3
    Last edited: Sep 18, 2013
  7. Historiker

    Historiker Dramamine Adict Gold Contributor

    Joined:
    Dec 16, 2010
    Messages:
    2,161
    Occupation:
    Retired
    Location:
    Michigan USA
    Balance:
    9,201Coins
    Ratings:
    +2,164 / 19 / -1
    My Motion Simulator:
    3DOF, DC motor, Arduino, Motion platform, 6DOF
    Yes, pictures....:cool:
  8. Fontys

    Fontys New Member

    Joined:
    Sep 18, 2013
    Messages:
    11
    Location:
    Helmond, The Netherlands
    Balance:
    15Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    Motion platform
    Wow, thanks. That seems great. I'll probably have more questions soon, but that gets me off to a start at least. THANK YOU.
    I'll try and post some pictures tomorrow :)
  9. Historiker

    Historiker Dramamine Adict Gold Contributor

    Joined:
    Dec 16, 2010
    Messages:
    2,161
    Occupation:
    Retired
    Location:
    Michigan USA
    Balance:
    9,201Coins
    Ratings:
    +2,164 / 19 / -1
    My Motion Simulator:
    3DOF, DC motor, Arduino, Motion platform, 6DOF
    You will find that this is an incredibly supportive community, I have.

    I look forward to the pictures! :)
  10. RaceRay

    RaceRay Administrator Staff Member SimAxe Beta Tester

    Joined:
    Nov 8, 2006
    Messages:
    4,656
    Occupation:
    Self-employed | Web and application development
    Location:
    Hamburg, Germany
    Balance:
    23,864Coins
    Ratings:
    +2,007 / 13 / -0
    My Motion Simulator:
    2DOF, DC motor, SimAxe, SimforceGT
    6DO ... What? Pictures please!!!:D
  11. Fontys

    Fontys New Member

    Joined:
    Sep 18, 2013
    Messages:
    11
    Location:
    Helmond, The Netherlands
    Balance:
    15Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    Motion platform
    Pictures :) p.s. Stupid dropbox; they showed fine for me.
    2013-09-19 10.43.12.jpg
    2013-09-19 10.47.53.jpg
    2013-09-19 10.51.28.jpg
    2013-09-19 10.55.14.jpg
    • Like Like x 1
  12. RaceRay

    RaceRay Administrator Staff Member SimAxe Beta Tester

    Joined:
    Nov 8, 2006
    Messages:
    4,656
    Occupation:
    Self-employed | Web and application development
    Location:
    Hamburg, Germany
    Balance:
    23,864Coins
    Ratings:
    +2,007 / 13 / -0
    My Motion Simulator:
    2DOF, DC motor, SimAxe, SimforceGT
    Dropbox does not allow hotlinking. So please download the pictures to your computer and than use the forum upload function:)
  13. value1

    value1 Nerd SimAxe Beta Tester SimTools Developer Gold Contributor

    Joined:
    Jan 9, 2011
    Messages:
    2,184
    Location:
    Zug, Switzerland
    Balance:
    14,797Coins
    Ratings:
    +3,322 / 11 / -1
    My Motion Simulator:
    2DOF, DC motor, JRK, Joyrider
    Wow! Impressive! :cool:
    The next time I'm in Eindhoven I'll come visiting you and you have to offer me a ride on your simulator! :D
  14. RaceRay

    RaceRay Administrator Staff Member SimAxe Beta Tester

    Joined:
    Nov 8, 2006
    Messages:
    4,656
    Occupation:
    Self-employed | Web and application development
    Location:
    Hamburg, Germany
    Balance:
    23,864Coins
    Ratings:
    +2,007 / 13 / -0
    My Motion Simulator:
    2DOF, DC motor, SimAxe, SimforceGT
    Absolutely impressive!!! Its funny to see that the pure 6DOF mechanic is smaller than the most home motion simulators here:D
  15. Fontys

    Fontys New Member

    Joined:
    Sep 18, 2013
    Messages:
    11
    Location:
    Helmond, The Netherlands
    Balance:
    15Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    Motion platform
    Being able to have a direct connection between the bottom frame and the platform instead of needing moment arms surely helps that fact. Well, that and the fact that there's a 0.5m cube hydraulics cabinet out of sight ;)
  16. Historiker

    Historiker Dramamine Adict Gold Contributor

    Joined:
    Dec 16, 2010
    Messages:
    2,161
    Occupation:
    Retired
    Location:
    Michigan USA
    Balance:
    9,201Coins
    Ratings:
    +2,164 / 19 / -1
    My Motion Simulator:
    3DOF, DC motor, Arduino, Motion platform, 6DOF
    HOLY......CRUD!

    I WANT ONE!!!! :)

    Absolutely well done! Inspiring!

    I showed this to my wife and received "that look" and a one word response: "No". :D
    • Like Like x 1
  17. Fontys

    Fontys New Member

    Joined:
    Sep 18, 2013
    Messages:
    11
    Location:
    Helmond, The Netherlands
    Balance:
    15Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    Motion platform
    Hi @value1,
    For sending gauge data to the car via CAN, the part from simulink to CAN is done and works right now. I need to get the relevant data out of rFactor 2 however, and to change my simulink model to unpack both the gauge and sim info from one packet.
    The values our platform need are actually angular velocity and x,y,z accelerations, so I had to change the cpp file a bit to get that right (I hope).
    I also added more values to the UDP packet for rpm etc. Can you please check it for me? I'll also attach a excel file with what the LFS UDP packets contain and (or what I think at least are) corresponding values for rF2.
    I have also attached a wireshark log of me driving out of the pits, turning around and then driving to the end of the straight and crashing into the wall.
    Thanks again!

    Attached Files:

  18. value1

    value1 Nerd SimAxe Beta Tester SimTools Developer Gold Contributor

    Joined:
    Jan 9, 2011
    Messages:
    2,184
    Location:
    Zug, Switzerland
    Balance:
    14,797Coins
    Ratings:
    +3,322 / 11 / -1
    My Motion Simulator:
    2DOF, DC motor, JRK, Joyrider
    Hi Fontys
    Good progress!
    Your .cpp looks fine. Just for clarification: You are aware that mLocalRotAccel is pitch/roll/yaw acceleration [rad/s²] rather than angular velocity (which is mLocalRot in [rad/s].
    Also -mLocalVel.z is just the speed in z-direction; "proper" speed would be sqrt{(mLocalVel.x)² +(mLocalVel.y)²+(mLocalVel.z)²}.
    AFAIK the output of LFS is in world coordinates, while the mLocal... variables in rFactor are in (obviously) local coordinates. Check, what is really expected by your controller.

    Also check the direction of the coordinates. In LFS X is forward, Y is left, Z is up while in rFactor
    // The local vehicle coordinate system is as follows:
    // +x points out the left side of the car (from the driver's perspective)
    // +y points out the roof
    // +z points out the back of the car
    // Rotations are as follows:
    // +x pitches up
    // +y yaws to the right
    // +z rolls to the right

    (see InternalsPlugin.hpp)

    BTW: Have you considered using rFactor? There are many nice road (rather than racing) tracks available for your Mitsubishi.


    :)
    Last edited: Sep 20, 2013
  19. Fontys

    Fontys New Member

    Joined:
    Sep 18, 2013
    Messages:
    11
    Location:
    Helmond, The Netherlands
    Balance:
    15Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    Motion platform
    Hi value1
    Yeah, I don't know why I used mLocalRotAccel when what I want is velocity... The things you miss when staring straight at a problem, eh?
    For the speed, is the "proper" speed what I want to use? The speed given at the end of the line of code is just for outputting to to speedometer, so it doesn't really matter that much. Is it still worth using the "proper" speed in your opinion?
    I do know I need to check the coordinates all work well today. I believe I compensated properly for the different coordinate systems between LFS and rF2.

    I actually installed rFactor first, but when rF2 worked well too it just seemed better to use the newer software. Is it easy to use the same plugin for motion etc. with rFactor? Where does one find these road tracks, as that sounds like something to look into (sorry if that's a stupid question, I'm somewhat new to all this).
  20. value1

    value1 Nerd SimAxe Beta Tester SimTools Developer Gold Contributor

    Joined:
    Jan 9, 2011
    Messages:
    2,184
    Location:
    Zug, Switzerland
    Balance:
    14,797Coins
    Ratings:
    +3,322 / 11 / -1
    My Motion Simulator:
    2DOF, DC motor, JRK, Joyrider
    Four eyes see more than two ;)
    If it's only for the speedometer and because you'll try to stay on the road anyway, it's probably not important. On the other hand, it's also no big deal calculate it correctly.
    Just make sure everything is in line.
    For rFactor you'll need a slightly different plugin. You can find the source in the Mod/Dev Corner under rFactor internals plugin. Either of these versions V1 - V3 should work for you.
    You can find many tracks and cars at rFactorCentral. For some you will have to dig a little deeper; e.g. Bollenbachtal, Göstling-Hochkar, Hemberg, Homburg, Klausenpass, Linz, Lückendorf, Mickhausen, Oberhallau, Osnabrück, Rueschegg, Solitude, Spa-Francorchamps 1967, St. Ursanne, Trier, Unterfranken, Wolsfeld. These are all temporary road tracks – you might find some others nearby your location!