Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

127
Vistas
How to convert LSM9DS1 MEMS sensor data to make euler angles or quaternions

Im trying to make a euler or quaternion angles using the MEMS sensor of LSM9DS1TR (simular to LSM9DS1) PDF File

        let accel_x = data.accel_x_mg/9.81, //velocity
            accel_y = data.accel_z_mg/9.81, //velocity
            accel_z = data.accel_y_mg/9.81, //velocity
            gyro_x = data.gyro_x_dps*0.07/57.295779513, //degrees per radians.
            gyro_y = data.gyro_z_dps*0.07/57.295779513, //degrees per radians.
            gyro_z = data.gyro_y_dps*0.07/57.295779513, //degrees per radians.
            magn_x = data.magn_x_mG,
            magn_y = data.magn_z_mG,
            magn_z = data.magn_y_mG;

let thetaM = Math.atan2(accel_x, Math.sqrt(accel_y*accel_y+accel_z*accel_z));
        let phiM = Math.atan2(accel_y, Math.sqrt(accel_x*accel_x+accel_z*accel_z))
        console.log(thetaM*57.295779513, phiM*57.295779513)

With this code i get perfect degree angles. But those are only from -90 to 90. And i want to display an object to show how the sensor is moving. So i started using AHRS but this does not work. When i do

madgwick.update(gyro_x, gyro_y, gyro_z, accel_x, accel_y, accel_z, magn_x, magn_y, magn_z);
        let quat = madgwick.getQuaternion();

I get perfect 1 if i do

Math.sqrt(quat.w*quat.w+quat.x*quat.x+quat.y*quat.y+quat.z*quat.z);

But if convert the quat.x*57.295779513, it goes a bit up, but when i hold it still it doesnt stay at that degree angle, it goes back to something like 1 or 0 zero degrees.

How can i fix this?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda