View unanswered posts | View active topics It is currently Fri Oct 19, 2018 2:59 pm






Reply to topic  [ 16 posts ]  Go to page 1, 2  Next
Dexter IMU 
Author Message
Rookie

Joined: Tue Jan 13, 2015 11:30 pm
Posts: 10
Post 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?


Mon Feb 23, 2015 12:23 am
Profile
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post 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

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Mon Feb 23, 2015 1:05 am
Profile WWW
Rookie

Joined: Tue Jan 13, 2015 11:30 pm
Posts: 10
Post 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 &


Mon Feb 23, 2015 2:46 pm
Profile
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post 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

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Mon Feb 23, 2015 3:05 pm
Profile WWW
Rookie

Joined: Tue Jan 13, 2015 11:30 pm
Posts: 10
Post 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.


Tue Feb 24, 2015 12:34 am
Profile
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post 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

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Fri Feb 27, 2015 1:23 am
Profile WWW
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post 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

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Fri Feb 27, 2015 2:47 am
Profile WWW
Rookie

Joined: Tue Jan 13, 2015 11:30 pm
Posts: 10
Post 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


Sat Feb 28, 2015 12:54 am
Profile
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post Re: Dexter IMU
Could you share your test program, so I can play with it here?

= Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Sat Feb 28, 2015 1:56 am
Profile WWW
Rookie

Joined: Tue Jan 13, 2015 11:30 pm
Posts: 10
Post 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 457 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 447 times
File comment: dexterind-imu-test1.c with Xander's requested changes
dexterind-imu-test1.c [3.5 KiB]
Downloaded 405 times
Sat Feb 28, 2015 12:30 pm
Profile
Rookie

Joined: Tue Jan 13, 2015 11:30 pm
Posts: 10
Post 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 426 times
File comment: Raw data for Accl
ACC-Raw-Data.txt [15.68 KiB]
Downloaded 393 times
Sat Feb 28, 2015 12:35 pm
Profile
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post 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 14744 times ]

= Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Sun Mar 01, 2015 9:55 am
Profile WWW
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post Re: Dexter IMU
Fixes are up! Get 'em while they're fresh!

= Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Sun Mar 01, 2015 11:18 am
Profile WWW
Rookie

Joined: Tue Jan 13, 2015 11:30 pm
Posts: 10
Post 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


Sun Mar 01, 2015 6:34 pm
Profile
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post 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'
}

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Mon Mar 02, 2015 1:50 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 16 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.