nmayorov / pyins

A Python package for Inertial Navigation Systems modeling and analysis
MIT License
85 stars 30 forks source link

Question of Usage of "compute_theta_and_dv" in strapdown.py #14

Closed ghost closed 11 months ago

ghost commented 2 years ago

Hi.Just trying to use function "compute_theta_and_dv" of strapdown.py to get the rotation azimuth and velocity increments per frame from the gyro and acceleration.

I have a question about how to use this function.

About the arguments

  1. We are using 5fps data. In that case, what should I put in the argument "dt"?
  2. What are the units of gyro and accel?

About output

  1. What are the units of the output rotation vector and velocity increment?
  2. What is the range of the rotation vector? Also, is right rotation a positive direction?
  3. Why are the velocity increments [[0.5,0,0],[0.5,0,0]] for the following arguments?
gyro = [[0,0,0],[0,0,0],[0,0,0]]
accel = [[0,0,0],[1,0,0],[0,0,0]]
dt = 0.2

Best regards.

nmayorov commented 11 months ago

Apologies, I've recently got back to the package and reworked it to a decent stated (called version 1.0).

About the arguments

We are using 5fps data. In that case, what should I put in the argument "dt"? What are the units of gyro and accel?

dt is 1/5 = 0.2, units are SI, that is rad/s and m/s^2 for rate sensors and rad and m/s for increment sensors.

About output

What are the units of the output rotation vector and velocity increment? What is the range of the rotation vector? Also, is right rotation a positive direction? Why are the velocity increments [[0.5,0,0],[0.5,0,0]] for the following arguments?

Rotation vector components are in rad and velocity increment are in m/s. Refer to scipy for the definition of rotation vector, basically it defines the axis and the angle of rotation around this axis.

Not sure about these output, seems incorrect. I suspect you've passed dt = 1.0 and rate sensor interpretation. Here is the code snippet for the version 1.0:

import pandas as pd
import pyins

if __name__ == '__main__':
    imu = pd.DataFrame(data=[
        [0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0]],
        index=[0.0, 0.2, 0.4], columns=pyins.util.GYRO_COLS + pyins.util.ACCEL_COLS
    )
    print("Rate IMU")
    print(pyins.strapdown.compute_increments_from_imu(imu, 'rate'))

    print("Increment IMU")
    print(pyins.strapdown.compute_increments_from_imu(imu, 'increment'))

And the output:

Rate IMU
      dt  theta_x  theta_y  theta_z  dv_x  dv_y  dv_z
0.2  0.2      0.0      0.0      0.0   0.1   0.0   0.0
0.4  0.2      0.0      0.0      0.0   0.1   0.0   0.0
Increment IMU
      dt  theta_x  theta_y  theta_z  dv_x  dv_y  dv_z
0.2  0.2      0.0      0.0      0.0   1.0   0.0   0.0
0.4  0.2      0.0      0.0      0.0   0.0   0.0   0.0