rickmason1
Member
Hello to all,
I started using the Teensy 3.5 and the prop shield about two weeks ago. The hardware looks to be a good fit to what I need. When I run the Orientation module that was part of the package, the getYaw() function for the Serial.print(heading), rotates the compass in the opposite direction to the actual rotation. The code is below.
The problem looks to me to be in NXPMotionSense imu or NXPSensorFusion filter (maybe?) . I've reloaded Arduino, and the TeensyDuino several times on a Win10 platform and with the teensy 3.5. and re-downloaded the github link for the NXP code as described in the installation guide. I've searched the web for info, and only found one entry about this problem, but can't find the fix at github. After two weeks of pounding the keyboard and searching for an answer I'm finally saying Uncle and asking your forum for help.
The goal is to have the Teensy report all the parameters from the propshield IMU to another computer/program. I can read the data on the Win10 or Arduino IDE very easily, but the mag data appears to rotate wrong.
The NXPMotionSense and NXPSensorFusion packages are very large and cumbersome to include in this posting.
If anyone has run into this can you suggest how to correct my problem.
Thanx Rick
// Full orientation sensing using NXP's advanced sensor fusion algorithm.
//
// You *must* perform a magnetic calibration before this code will work.
//
// To view this data, use the Arduino Serial Monitor to watch the
// scrolling angles, or run the OrientationVisualiser example in Processing.
#include <NXPMotionSense.h>
#include <Wire.h>
#include <EEPROM.h>
NXPMotionSense imu;
NXPSensorFusion filter;
void setup() {
Serial.begin(9600);
imu.begin();
filter.begin(100);
}
void loop() {
float ax, ay, az;
float gx, gy, gz;
float mx, my, mz;
float roll, pitch, heading;
if (imu.available()) {
// Read the motion sensors
imu.readMotionSensor(ax, ay, az, gx, gy, gz, mx, my, mz);
// Update the SensorFusion filter
filter.update(gx, gy, gz, ax, ay, az, mx, my, mz);
// print the heading, pitch and roll
roll = filter.getRoll();
pitch = filter.getPitch();
heading = filter.getYaw();
Serial.print("Orientation: ");
Serial.print(heading);
Serial.print(" ");
Serial.print(pitch);
Serial.print(" ");
Serial.println(roll);
}
}
I started using the Teensy 3.5 and the prop shield about two weeks ago. The hardware looks to be a good fit to what I need. When I run the Orientation module that was part of the package, the getYaw() function for the Serial.print(heading), rotates the compass in the opposite direction to the actual rotation. The code is below.
The problem looks to me to be in NXPMotionSense imu or NXPSensorFusion filter (maybe?) . I've reloaded Arduino, and the TeensyDuino several times on a Win10 platform and with the teensy 3.5. and re-downloaded the github link for the NXP code as described in the installation guide. I've searched the web for info, and only found one entry about this problem, but can't find the fix at github. After two weeks of pounding the keyboard and searching for an answer I'm finally saying Uncle and asking your forum for help.
The goal is to have the Teensy report all the parameters from the propshield IMU to another computer/program. I can read the data on the Win10 or Arduino IDE very easily, but the mag data appears to rotate wrong.
The NXPMotionSense and NXPSensorFusion packages are very large and cumbersome to include in this posting.
If anyone has run into this can you suggest how to correct my problem.
Thanx Rick
// Full orientation sensing using NXP's advanced sensor fusion algorithm.
//
// You *must* perform a magnetic calibration before this code will work.
//
// To view this data, use the Arduino Serial Monitor to watch the
// scrolling angles, or run the OrientationVisualiser example in Processing.
#include <NXPMotionSense.h>
#include <Wire.h>
#include <EEPROM.h>
NXPMotionSense imu;
NXPSensorFusion filter;
void setup() {
Serial.begin(9600);
imu.begin();
filter.begin(100);
}
void loop() {
float ax, ay, az;
float gx, gy, gz;
float mx, my, mz;
float roll, pitch, heading;
if (imu.available()) {
// Read the motion sensors
imu.readMotionSensor(ax, ay, az, gx, gy, gz, mx, my, mz);
// Update the SensorFusion filter
filter.update(gx, gy, gz, ax, ay, az, mx, my, mz);
// print the heading, pitch and roll
roll = filter.getRoll();
pitch = filter.getPitch();
heading = filter.getYaw();
Serial.print("Orientation: ");
Serial.print(heading);
Serial.print(" ");
Serial.print(pitch);
Serial.print(" ");
Serial.println(roll);
}
}