Hi!
I got a Freematics ONE+ recently and modifying datalogger code to collect gyroscope and orientation data.
However, the collected gyroscope showed weird values. It was 0, changed to 200, and stuck.
I modified code like below not for changing other parameters in header files.( When I changed some parameter such as ENABLE_ORIENTATION, MEMS_MODE, OR ENABLE_DMP, I could not upload the code on the dongle).
Thanks!
#if MEMS_MODE
if (one.state & STATE_MEMS_READY) {
float acc[3];
float gyr[3];
bool updated;
#if ENABLE_ORIENTATION
ORIENTATION ori;
#if !ENABLE_DMP
//float mag[3];
updated = mems.memsRead(acc, gyr, 0, 0, &ori);
#else
updated = mems.memsRead(acc, gyr, 0, 0, &ori);
#endif
if (updated) {
Serial.print("Orientation: ");
Serial.print(ori.yaw, 2);
Serial.print(' ');
Serial.print(ori.pitch, 2);
Serial.print(' ');
Serial.println(ori.roll, 2);
one.log(PID_ACC, (int16_t)(acc[0] * 100), (int16_t)(acc[1] * 100), (int16_t)(acc[2] * 100));
one.log(PID_ORIENTATION, (int16_t)(ori.yaw * 100), (int16_t)(ori.pitch * 100), (int16_t)(ori.roll * 100));
one.log(PID_GYRO, (int16_t)(gyr[0] * 100), (int16_t)(gyr[1] * 100), (int16_t)(gyr[2] * 100));
}
#else
updated = mems.memsRead(acc, gyr, 0, 0, &ori);
if (updated) {
one.log(PID_ACC, (int16_t)(acc[0] * 100), (int16_t)(acc[1] * 100), (int16_t)(acc[2] * 100));
one.log(PID_ORIENTATION, (int16_t)(ori.yaw * 100), (int16_t)(ori.pitch * 100), (int16_t)(ori.roll * 100));
one.log(PID_GYRO, (int16_t)(gyr[0] * 100), (int16_t)(gyr[1] * 100), (int16_t)(gyr[2] * 100));
}
Datalogger for gyroscope and orientation
Re: Datalogger for gyroscope and orientation
Which class is used for "mems" or how was it defined?
-
- Posts: 4
- Joined: Thu Feb 02, 2017 3:59 am
Re: Datalogger for gyroscope and orientation
I define MEMS_MODE as MEMS_DMP
and ENABLE_ORIENTATION 1
ans ENABLE_DMP as 0 because of !ENABLE_DMP in ino file.
I just checked orientation , now it is working but still I don't get any data from gyro.
and ENABLE_ORIENTATION 1
ans ENABLE_DMP as 0 because of !ENABLE_DMP in ino file.
I just checked orientation , now it is working but still I don't get any data from gyro.
Re: Datalogger for gyroscope and orientation
DMP mode does not work well with Freematics ONE's ATmega328p (due to very limited memory) so you need to define it as MEMS_MPU9250.
-
- Posts: 4
- Joined: Thu Feb 02, 2017 3:59 am
Re: Datalogger for gyroscope and orientation
Hi!
In config.h in datalogger on Freematics ONE+(v5),
I changed the mems mode to 9DOF and it worked well.
Thanks!
In config.h in datalogger on Freematics ONE+(v5),
I changed the mems mode to 9DOF and it worked well.
Thanks!