ROBOTC.net forums
http://www.robotc.net/forums/

Dexter IMU
http://www.robotc.net/forums/viewtopic.php?f=41&t=10565
Page 1 of 2

Author:  Hobbes [ Mon Feb 23, 2015 12:23 am ]
Post subject:  Dexter IMU

Just got a Dexter Industries IMU. Has anyone used it on an EV3?

I am trying to get "dexterind-imu-test1.c" to run on my brick. The code compiles on Ver. 4.30 and downloads. Running the code only gets me:

ERROR, You have not setup the sensor port correctly.
Please refer to one of the examples.
Detected SensorType on port[0]: 0

Is my sensor bad? Any suggestions?

Author:  mightor [ Mon Feb 23, 2015 1:05 am ]
Post subject:  Re: Dexter IMU

Change the top of the file from:
Code:
#pragma config(Sensor, S1,     DIMU,                sensorI2CCustomFastSkipStates)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

to
Code:
#pragma config(Sensor, S1,     DIMU,           sensorEV3_GenericI2C)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

Let me know if that worked for you.

= Xander

Author:  Hobbes [ Mon Feb 23, 2015 2:46 pm ]
Post subject:  Re: Dexter IMU

I tried the new line of code and got the following:

ERROR, You have not setup the sensor port correctly.
Please refer to one of the examples.
Detected SensorType on port[0]: 97

Using Program Debug's Step Into I was able to capture the following local variables:

Offset Variable Value Type
0x0000 x_val 0 float
0x0004 y_val 0 float
0x0008 z_val 0 float

0x0000 link DIMU tSensors
0x0004 range 4('.') ubyte

0x0000 link DIMU tSensors
0x0004 request 0x403C31C8 tByteArray &

Author:  mightor [ Mon Feb 23, 2015 3:05 pm ]
Post subject:  Re: Dexter IMU

97 is the sensorEV3_EnergyMeter, that is not quite right, it should be 98 (sensorEV3_GenericI2C). I don't have the dIMU handy to test this with. I'll see if I can find it though.

= Xander

Author:  Hobbes [ Tue Feb 24, 2015 12:34 am ]
Post subject:  Re: Dexter IMU

Thanks for looking into things. Let me know if there is any other info I can provide or tests I can run that may be helpful.

Author:  mightor [ Fri Feb 27, 2015 1:23 am ]
Post subject:  Re: Dexter IMU

Thanks for the info guys, I am still looking for my dIMU, but I have not been able to locate it yet.

= Xander

Author:  mightor [ Fri Feb 27, 2015 2:47 am ]
Post subject:  Re: Dexter IMU

Hey peeps,

I have a work-around for you. Make sure you are using the latest driver suite from the Github repo (I committed some changes just a few minutes ago). Then simply change the include line to this:
Code:
#define __COMMON_H_SENSOR_CHECK__ 0  // this disables the check that is causing the error
#include "dexterind-imu.h"

That will disable the sensor type check. The compiler will have a warning like this:
Code:
*Warning*:sensor checking disabled, I hope you know what you are doing!

You can ignore it :)

I will work on a better sensor checking system in the mean time, but this should keep you going for now :)

= Xander

Author:  Hobbes [ Sat Feb 28, 2015 12:54 am ]
Post subject:  Re: Dexter IMU

Xander,

Thanks for working on the issue.

I did some testing. The accelerometer looks like it is working in all 3 axes and resolutions. Values at rest are:

x < 0.1
y < 0.1
z ~ 1.0

The gyro looks like it is only working in Y and Z. Values at rest are:

x ~ 572 (RANGE_250)
x ~ 1146 (RANGE_500)
x ~ 4587 (RANGE_2000) - drops to near zero every second or two.
y < 0.5
z < 0.5

Author:  mightor [ Sat Feb 28, 2015 1:56 am ]
Post subject:  Re: Dexter IMU

Could you share your test program, so I can play with it here?

= Xander

Author:  Hobbes [ Sat Feb 28, 2015 12:30 pm ]
Post subject:  Re: Dexter IMU

Xander,

I download the latest master.zip files from Github repo and replace all the example and include files in the EV3 3rd Party Driver Library.

Attached are the test programs. They are just a simple mod of dexterind-imu-test1.c and dexterind-imu-test2.c

I see 3 files is the limit so I will upload the raw data in the next post.

Jim

Attachments:
File comment: dexterind-imu-test2.c with Xander's requested changes and output set for Gyro
dexterind-imu-test2-Gryo.c [1.94 KiB]
Downloaded 555 times
File comment: dexterind-imu-test2.c with Xander's requested changes and output set for Accl
dexterind-imu-test2-Accl.c [1.94 KiB]
Downloaded 570 times
File comment: dexterind-imu-test1.c with Xander's requested changes
dexterind-imu-test1.c [3.5 KiB]
Downloaded 526 times

Author:  Hobbes [ Sat Feb 28, 2015 12:35 pm ]
Post subject:  Re: Dexter IMU

Xander,

Attached is raw data captures from the accl and gyro with the test2 programs. Accl data is for 10bit/2G mode. Gyro data is for 250, 500, and 2000 modes.

Jim

Attachments:
File comment: Raw data for Gyro
Gyro-Raw-Data.txt [47.83 KiB]
Downloaded 517 times
File comment: Raw data for Accl
ACC-Raw-Data.txt [15.68 KiB]
Downloaded 488 times

Author:  mightor [ Sun Mar 01, 2015 9:55 am ]
Post subject:  Re: Dexter IMU

I have found the root cause of the issue and am in the process of fixing the driver and adding a calibration routine while I'm at it. I'll let you know when the code has been committed.

PS: if you want to stay up to date on the latest changes to the driver suite, follow me on twitter: https://twitter.com/xandersoldaat. All commits end up being posted there automagically like this:
Attachment:
Screenshot at 14-54-27.png
Screenshot at 14-54-27.png [ 33.99 KiB | Viewed 17475 times ]

= Xander

Author:  mightor [ Sun Mar 01, 2015 11:18 am ]
Post subject:  Re: Dexter IMU

Fixes are up! Get 'em while they're fresh!

= Xander

Author:  Hobbes [ Sun Mar 01, 2015 6:34 pm ]
Post subject:  Re: Dexter IMU

Xander,

Thanks for all your work. The sensor is working. I'm good to go. I tested every mode and function I could find with “dexterind-imu-test2.c”. The following is just FYI:

The accelerometer looks good for all modes (2G, 4G, 8G) and all functions:

DIMUreadAccelAxes8Bit(DIMU, xvals[i], yvals[i], zvals[i])
DIMUreadAccelAxes10Bit(DIMU, xvals[i], yvals[i], zvals[i])

xvals[i] = DIMUreadAccelAxis8Bit(DIMU, DIMU_ACC_X_AXIS)
yvals[i] = DIMUreadAccelAxis8Bit(DIMU, DIMU_ACC_Y_AXIS)
zvals[i] = DIMUreadAccelAxis8Bit(DIMU, DIMU_ACC_Z_AXIS)

xvals[i] = DIMUreadAccelAxis10Bit(DIMU, DIMU_ACC_X_AXIS)
yvals[i] = DIMUreadAccelAxis10Bit(DIMU, DIMU_ACC_Y_AXIS)
zvals[i] = DIMUreadAccelAxis10Bit(DIMU, DIMU_ACC_Z_AXIS)

The gyro is working in modes 250 & 500 for the function:

DIMUreadGyroAxes(DIMU, xvals[i], yvals[i], zvals[i])

In mode 2000 the values for x, y, & z only read:

-0.000000 or 0.000000

The gyro does not seem to be working with the functions:

xvals[i] = DIMUreadGyroAxis(DIMU, DIMU_GYRO_X_AXIS)
yvals[i] = DIMUreadGyroAxis(DIMU, DIMU_GYRO_Y_AXIS)
zvals[i] = DIMUreadGyroAxis(DIMU, DIMU_GYRO_Z_AXIS)

Mode 250
X ~ 7481943
y mostly < 10000
z mostly < 10000

Mode 500
X ~ 3741885
y mostly < 10000
z mostly < 10000

Mode 2000
X = inf or nan
y = inf or nan
z = inf or nan

Author:  mightor [ Mon Mar 02, 2015 1:50 am ]
Post subject:  Re: Dexter IMU

Hey there,

I can reproduce the 2000 dps issue, but I don't have time right now to investigate it. You can fix the single axis issue by changing the following line:
Code:
/**
 * Retrieve the axis data
 * @param link the port number
 * @param axis the specified axis
 * @return the axis data in degrees per second
 */
float DIMUreadGyroAxis(tSensors link, ubyte axis){
  // ubyte _msb = 0;
  // ubyte _lsb = 0;

  DIMU_I2CRequest[0] = 2;                   // Message size
  DIMU_I2CRequest[1] = DIMU_GYRO_I2C_ADDR;  // I2C Address
  DIMU_I2CRequest[2] = axis + 0x80;            // Register address

  if (!writeI2C(link, DIMU_I2CRequest, DIMU_I2CReply, 2)) {
    writeDebugStreamLine("error write");
    return 0;
  }

  return (DIMU_I2CReply[0]+((word)(DIMU_I2CReply[1]<<8)))/DIMU_Gyro_divisor[link];  // <-- replace 'long' with 'word'
}

Page 1 of 2 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/