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

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:
    113Coins
    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. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    20,533
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    145,022Coins
    Ratings:
    +10,776 / 52 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
  3. ismaelflorit

    ismaelflorit New Member

    Joined:
    Apr 12, 2019
    Messages:
    2
    Balance:
    113Coins
    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.