Skip to content

Wrong coordinate system and alignement for the python lsm9ds1 driver #50

@2lian

Description

@2lian

After implementing the madgwick algorithm on it, I noticed that the accelerometer, the gyros and the magnetometer were not lining up. The resulting coordinate system wasn't even direct.

The following code corrects the results of the accelerometer and gyro :

            acc,gyr,mag=(self.imu2.getMotion9())
            acc[0],acc[1]=-acc[1],-acc[0]
            gyr[2]=-gyr[2]
            gyr[0], gyr[1] = gyr[1], gyr[0]

Now, for the acc. and the gyro. : the z axis points toward the ground, x follows the arrow on the PCB and y is such that the coordinate system is orthogonal direct.

I don't know how to check if the magnetometer is aligned, but after calibrating it (and correcting the acc and gyro), the madgwick algorithm gave me the right pitch, roll and yaw, with very good performances

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions