DCM matrix implementation problem

Hello all, I'm Leonardo from argentina. I'm implementing dcm algorithm on an lpc1769 and can't make it work.

I test my gyro, obtain raw data, calculate standar deviation on each axis and note that l3g4200 is a litle noise gyro.

I integrate Wt over my timestep, 20msec, and obtain rotating angle for each axis. I note a drift of 1 degree per minute. I check gyro gains and seems to be very close to datasheet.

Finally a porting dcm matrix to my uC. I don't make it work. rigth now I want to implement just gyro on my DCM matrix. well, when I do that I notice that, on still position, dcm is drift too fast. i.e. it go from 1 0 0 to 0 1 0 on first row, then to -1 0 0 in 30 second... On the same time I see that angle calculated by integration is less than 1 degree...

then I make a new test. I put 0 to Y and Z gyro and work only with X gyro. when i log dcm matrix I see that is not drifting to fast, but when a rotate my gyro 4 values, of 9, on dcm matrix change a lot with litle rotation angle. and if a go back to still position dcm is not close to identity....

becouse I log angle integration and chek that the angle calculated is close to rotate angle I think thta gyro offset and gain is correct.

Now I'm asking myself if what I expect is ok,l mean, working with one axis gyro i have to see only 4 values change on my dcm matrix while y rotate de imu. and I should see that a row on dcm have to change from, i.e., 1 0 0 to -1 0 0 when I rotate 180 degrees. is that ok?

I will debug my code with the help of matlab. I'm thinking on log data with my gyro and put it onto matlab implementation and see where the error is, cheking partial calculation.

Can anyone tell me another way to verify where the error is?

thk and best regards

and sorry for my english!!!!!

Replies

• I'm a new question:

If i rotate the IMU at a rate of [1 2 3] deg/sec for 10 second, do I expect to obtain 10deg of pitch, 20deg of roll and 30deg for yaw?

I know about euler angles singularities, but I rotate 30deg max on yaw...

Is this equation valid to obtain euler angles < 90°?

Pitch = -asin(dcmEst(3,1));

Roll = atan2(dcmEst(2,1),dcmEst(1,1));

Yaw = atan2(dcmEst(3,2),dcmEst(3,3));

Best regards!

• T3

Leonardo,

Just to make sure you understand the basics.

The direction cosine matrix represents attitude, not rotation rate. So, there is not a mapping from gyro rates to the matrix.

Some of your replies suggest to me that you thought some of the matrix entries would be trigonometric functions of the rotation rate. If so, then that is the issue.

When the IMU is rotated from its initial position, and then stopped, the direction cosine matrix will not look anything like the identity matrix.

Best regards,

Bill

• Hello Leonardo,

Sounds like what you are doing is correct, it just wont work with noisy mems gyros. They will drift slightly with temperature changes too. You also need to use accelerometers to do drift correction on your gyro values. Then if your system is moving you will need to do centripetal corrections when you are accelerating in a circular path. I can be very complicated. Fortunately the hard work has all ready been done by Paul Blizard and William Premerlani. A good place to start is here. Good luck in your endeavors.

Activity

RT @TinkerGen_: "The Tinkergen MARK (\$199) is my new favorite starter robocar. It’s got everything — computer vision, deep learning, sensor…
Monday
RT @roboton_io: Join our FREE Sumo Competition 🤖🏆 👉 https://roboton.io/ranking/vsc2020 #sumo #robot #edtech #competition #games4ed https://t.co/WOx…
Nov 16
First impressions of Tinkergen MARK robocar https://ift.tt/36IeZHc
Nov 16
Our review of the @TinkerGen_ MARK robocar, which is the best on the market right now https://diyrobocars.com/2020/11/15/first-impressions-of-tinkergen-mark-robocar/ https://t.co/ENIlU5SfZ2
Nov 15
RT @Ingmar_Stapel: I have now explained the OpenBot project in great detail on my blog with 12 articles step by step. I hope you enjoy read…
Nov 15
Nov 15
RT @a1k0n: Got a new chassis for outdoor races (hobbyking Quantum Vandal) but I totally didn't expect that it might cause problems for my g…
Nov 11
First impressions of the Intel OpenBot https://ift.tt/36qkVV4
Nov 10
Nov 9
Nov 7
RT @chr1sa: We've got a record 50 teams competing in this month's @DIYRobocars @donkey_car virtual AI car race. Starting today at 10:00am…
Nov 7
RT @a1k0n: Car's view, using a fisheye camera. The ceiling light tracking algorithm gave me some ideas to improve ConeSLAM, and having grou…
Nov 5
RT @a1k0n: To get ground truth I measured the rug, found the pixel coordinates of its corners, calibrated my phone camera with my standard…
Nov 5