cancel
Showing results for 
Search instead for 
Did you mean: 

Aligning the coordinate systems of accelerometer and vehicle?

E-John
Associate III

I have an accelerometer located in an arbitrary position on a car. As the accelerometer already has a coordinate system by default, I want to find some method that allows transforming the data I have from the sensor and aligning them with the coordinate system of the car.

  1. When the vehicle is stationary on a flat, horizontal surface, use the three components relative to g-sensor, Gxs, Gys and Gzs(Gxs is the g value obtained on g-sensor Xs, the Gys and Gzs are g component relative to g-sensor Ys and Zs) and make rotation can rotate the Gzs aligned with gravity direction and Xs-Ys plane parallel to with horizontial. But how to align the Xs to vehicle X-axis?
  2. In theory, the euler angle can be obtained by rotating the coordinate axis of the G-sensor three times, and use this conversion matrix for conversion. But In practice this is not feasible.

Is there any simple way to aligning the coordinate systems of accelerometer and vehicle?

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Martin B
ST Employee

Aligning device (sensor/PCB) reference frame to car reference frame is pure matter of vector math.

Let's assume we have car reference frame Left-Forward-Up where X-axis points Left, Y-axis points Forward and Z-axis points Up:

  |X_car|
  |Y_car|
  |Z_car|

and sensor device frame:

  |X_sens|
  |Y_sens|
  |Z_sens|

The optimal option would be to mount sensor device to perfectly align with car reference frame and no transformation would be needed:

  |X_car|   |X_sens|
  |Y_car| = |Y_sens|
  |Z_car|   |Z_sens|

However in real situation the sensor device could be only placed in arbitrary position which could be very different from optimal. This means for us to use transformation matrix to transform sensor data to car data and vice-versa:

  |X_car|   |T_xs_xc, T_ys_xc, T_zs_xc|   |X_sens|
  |Y_car| = |T_xs_yc, T_ys_yc, T_zs_yc| * |Y_sens|
  |Z_car|   |T_xs_zc, T_ys_zc, T_zs_zc|   |Z_sens|

where:

  |T_xs_xc, T_ys_xc, T_zs_xc|
  |T_xs_yc, T_ys_yc, T_zs_yc|
  |T_xs_zc, T_ys_zc, T_zs_zc|

is transformation matrix.

Transformation matrix coefficients have to be calculated for real sensor device placed on car using vector math.

View solution in original post

4 REPLIES 4
Paul1
Lead

Vector Matrix Mathematics. Been a while but by multiplying a vector [x y z] against the correction matrix [9 number in grid] you get a new vector [x' y' z'].

I did this for a similar arrangement, but the 3d sensor on a patient's elbow, and it was magnetically measured against another 3d field generator, combining the sets of xyz coordinates was fun.

We had to change to use angles like you mention, otherwise the graphic figure's forearm turned into a helicopter when the put arm in right orientation over their head and one of the vectors when to zero in the math.

I'm sorry but many decades and jobs since and don't have the code.

All I recall was we used vector matrix math, and we had to convert from xyz to angles to properly define rotation when vector pointed straight up. Rotate equator, rotate North/South, and rotate for spin last (otherwise that turned into the helicopter).

(Wrote all this just to pass on the warning about using xyz versus safer using vector+angles)

Paul

raptorhal2
Lead

But how to align the Xs to vehicle X-axis?

The accelerometer data sheet will give you the X-axis orientation relative to the accelerometer package. Then physically orient the package on the PCB and the PCB to the vehicle.

By pointing the PCB x-axis down and measuring the Y and Z values, the X-axis direction can be calibrated prior to vehicle installation.

Cheers, Hal

Martin B
ST Employee

Aligning device (sensor/PCB) reference frame to car reference frame is pure matter of vector math.

Let's assume we have car reference frame Left-Forward-Up where X-axis points Left, Y-axis points Forward and Z-axis points Up:

  |X_car|
  |Y_car|
  |Z_car|

and sensor device frame:

  |X_sens|
  |Y_sens|
  |Z_sens|

The optimal option would be to mount sensor device to perfectly align with car reference frame and no transformation would be needed:

  |X_car|   |X_sens|
  |Y_car| = |Y_sens|
  |Z_car|   |Z_sens|

However in real situation the sensor device could be only placed in arbitrary position which could be very different from optimal. This means for us to use transformation matrix to transform sensor data to car data and vice-versa:

  |X_car|   |T_xs_xc, T_ys_xc, T_zs_xc|   |X_sens|
  |Y_car| = |T_xs_yc, T_ys_yc, T_zs_yc| * |Y_sens|
  |Z_car|   |T_xs_zc, T_ys_zc, T_zs_zc|   |Z_sens|

where:

  |T_xs_xc, T_ys_xc, T_zs_xc|
  |T_xs_yc, T_ys_yc, T_zs_yc|
  |T_xs_zc, T_ys_zc, T_zs_zc|

is transformation matrix.

Transformation matrix coefficients have to be calculated for real sensor device placed on car using vector math.

Dear Martin,

Thanks for your helps and detail explanations.

I have got a transformation matrix from the mechanical angle and got the expected transform values after test.

Thanks,

E-John