1. 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!
  2. 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
  3. 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

Robotic equations - 2DOF - Unity Plugin

Discussion in 'DIY Motion Simulator Projects' started by ismaelflorit, May 2, 2019.

  1. ismaelflorit

    ismaelflorit New Member

    Joined:
    Apr 12, 2019
    Messages:
    2
    Balance:
    77Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    2DOF, Arduino
    Hello everyone!

    Context
    As part of a university project, I'm creating a Unity motion platform plugin in conjunction with the SMC3 controller and testing things with a Playseat and a DOF reality M2 seat mover motion platform. The aim of my project is to give indie developers quick and easy motion platform integration to their games. (I know...quick, easy and motion platform don't go along well together...)

    Problem
    I am currently trying to figure out the best way of mapping acceleration (frontal and lateral) to a 2DOF rig.
    I have come up with a system where if there is no lateral acceleration, both axis move in opposite proportional to an offset point (511) to achieve forwards and backwards movement. When there is lateral acceleration registered, the corresponding axis moves parallel to achieve the roll. However there is a fair amount of noise generated in Unity's vector system which often throws one axis off completely when there is a momentary jolt in the data.

    I am almost certain that there are equations which have been written that translate vector changes into n number of DOF. However my background is music and some software development; I'm not particularly strong with maths - Quaternions and Lagrangian equations are digging me into a spiral of madness.

    Request
    If anyone could point me in the right direction of any reading material that would help me map vector acceleration to any given number of DOF, I would be really grateful.

    TLDR:

    I'm trying to write a very basic Unity plugin which maps vector acceleration to 2 axis. @Simtools dev team: can you shed some light on this?

    Many thanks,
    Ismael
  2. Ads Master

    Ads Master

    Balance:
    Coins
    Ratings:
    +0 / 0 / -0
  3. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    16,464
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    119,830Coins
    Ratings:
    +9,533 / 46 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
  4. ismaelflorit

    ismaelflorit New Member

    Joined:
    Apr 12, 2019
    Messages:
    2
    Balance:
    77Coins
    Ratings:
    +0 / 0 / -0
    My Motion Simulator:
    2DOF, Arduino
    Hi,

    I did have a look at Claudio's work, but from what I've seen his plugin outputs Unity telemetry directly Simtools - which then processes the information and sends the data to the control box.

    What I'm working on is on processing and sending Unity data directly to the arduino SMC3 controller - a basic sim tools if you will.

    Currently my way of mapping acceleration does something along the lines of this pseudocode:

    Code:
    If there is lateral acceleration
        Map the lateral acceleration to the corresponding axis
        Map the remaining axis to the frontal acceleration
    Else
        Map the frontal acceleration
    
    My acceleration formula is rather crude, but seems to do the trick. Based off of the RigidBody object in Unity, I'm able to get it from a = Δs / Δt.

    Mapping frontal acceleration to 2 axis is simple. Lateral movement however is incredibly jolty and a simple turn feels more slamming the brakes sideways. It might simply be a case of deleting the noisy data from Unity, but I can't help but think that there has to be a more scientific way of approaching the science of Vector acceleration into any given number of DOF.

    On a separate note, SMC3 offers a range of values between 0-1024. However watching footage of Live for Speed on this video of @perdixero's virtual sim, I can see that the amount of range used in the axis is much more constricted than I originally thought.