Datalogger for gyroscope and orientation

Inquiry and support for Freematics products
mrshim1101
Posts: 4
Joined: Thu Feb 02, 2017 3:59 am

Datalogger for gyroscope and orientation

Postby mrshim1101 » Fri Oct 06, 2017 7:17 am

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));
}

stanley
Site Admin
Posts: 734
Joined: Sat Mar 01, 2014 3:15 am

Re: Datalogger for gyroscope and orientation

Postby stanley » Fri Oct 06, 2017 10:23 pm

Which class is used for "mems" or how was it defined?

mrshim1101
Posts: 4
Joined: Thu Feb 02, 2017 3:59 am

Re: Datalogger for gyroscope and orientation

Postby mrshim1101 » Sat Oct 07, 2017 5:23 am

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.

stanley
Site Admin
Posts: 734
Joined: Sat Mar 01, 2014 3:15 am

Re: Datalogger for gyroscope and orientation

Postby stanley » Sun Oct 08, 2017 7:55 pm

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.

mrshim1101
Posts: 4
Joined: Thu Feb 02, 2017 3:59 am

Re: Datalogger for gyroscope and orientation

Postby mrshim1101 » Tue Oct 10, 2017 6:02 am

Hi!

In config.h in datalogger on Freematics ONE+(v5),

I changed the mems mode to 9DOF and it worked well.

Thanks!


Return to “Freematics Products”

Who is online

Users browsing this forum: No registered users and 7 guests