1. Trouble with the game?
    Try the troubleshooter!

    Dismiss Notice
  2. Issues with the game?
    Check the Known Issues list before reporting!

    Dismiss Notice
  3. Before reporting issues or bugs, please check the up-to-date Bug Reporting Thread for the current version.
    0.37 Bug Reporting thread
    Solutions and more information may already be available.

Incorrect Acceleration Vector Length

Discussion in 'Troubleshooting: Bugs, Questions and Support' started by Citizen07, Jul 3, 2018.

  1. Citizen07

    Citizen07
    Expand Collapse

    Joined:
    Dec 15, 2017
    Messages:
    1
    Sum of separate acceleration axes doesn't equal the value of gravity vector length, example code:

    Code:
      M.gx = obj:getSensorX()
      M.gy = obj:getSensorY()
      M.gz = obj:getSensorZnonInertial()
      Vector = math.sqrt(M.gx*M.gx + M.gy*M.gy + M.gz*M.gz)
    I think the problem is that gravity vector projection is not included in gx and gy sensor values.

    Issue is most pronounced when vehicle is stationary on a steep incline (last part of image 8-11 second):
    log_20180702_speedup_uphill_brake_slide_stop_angles.jpg
    Accelerations:
    log_20180702_speedup_uphill_brake_slide_stop_axes.jpg
    log_20180702_speedup_uphill_brake_slide_stop_vector.jpg

    See attached .txt file for logged data

    Is there a solution to receive acceleration data with values which correspond to measured in a real car with accelerometer (with a gravity vector projected to all axes)?
     

    Attached Files:

    #1 Citizen07, Jul 3, 2018
    Last edited: Jul 3, 2018
    • Staff Pick Staff Pick x 1
  2. estama

    estama
    Expand Collapse
    Developer
    BeamNG Team

    Joined:
    Aug 7, 2012
    Messages:
    268
    Very nice analysis :) . Your conclusions are also correct.

    The sensor data for X and Y do not include the gravity vector (so that accelerations on X and Y are not affected by gravity).

    I'll add a function to get the raw sensor data (including gravity) in the next update (which comes in a few days: 13 July 2018).

    Edit:

    You can get the non inertial forces with current version by using the following code:

    local refNodes = v.data.refNodes[0]
    local mass = v.data.nodes[refNodes.ref].nodeWeight
    sensorX = obj:getNodeForceNonInertial(refNodes.ref, refNodes.left) / mass
    sensorY = obj:getNodeForceNonInertial(refNodes.ref, refNodes.back) / mass
    sensorZ = obj:getNodeForceNonInertial(refNodes.ref, refNodes.up) / mass
     
    #2 estama, Jul 3, 2018
    Last edited: Jul 4, 2018
    • Like Like x 1
  3. Diamondback

    Diamondback
    Expand Collapse
    Vehicle Systems Lead
    BeamNG Team

    Joined:
    Apr 8, 2014
    Messages:
    1,966
    What exactly are you trying to do btw? :)
     
  4. RobertGracie

    RobertGracie
    Expand Collapse

    Joined:
    Oct 15, 2013
    Messages:
    3,866
    I would guess it's SOMETHING to do with how the car reacts in game compared to real life....but I am not exactly sure
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice