LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading Acc,Gyro,Mag,Temp information from MPU-9250 with NI-Myrio

The one I use is MPU-9250.
The data I want to read with NI-Myrio is as follows
1-Accelerometer 3 axis
2-Gyroscope 3 axis
3-Magnetometer 3 axis
4-Temperature
After reading all this information, I converted it to Pitch, roll information. But I want to read Compass information in addition. I think magnetometer information is required for this. but the problem is that I can't read the Magnetometer information fast.

In addition, I think I cannot read the pitch roll information correctly because the pitch roll angles affect each other. If the pitch has a slope of more than 90 degrees, the roll information changes.
Is there anyone who can help with this?
Attached below is what I'm working on

Any opinion given is worthy of respect

0 Kudos
Message 1 of 7
(2,246 Views)

Hello, again, and welcome to the Exciting World of Rotations, and movable Coordinate Frames.  Here are a couple of points you might have missed:

  • Doing a single axis rotation is easy -- all you need to do is specify (uniquely) the orientation of the Axis.  You may have noticed that the coordinate Frame I used in my previous reply to you was not the same as the one Dr. Doering uses -- we both put Z "up", but his X axis is out the right ear, while mine is out the nose.  I call rotation about X a "Roll", he calls it a "PItch".
  • Unlike New York City Subway riders, Rotations do not Commute!  Consider doing one rotation about one ax, followed by another rotation about a different axis -- if you do the rotations in the opposite order and look at the position in space of the 3D object, they will almost always be different!
  • Another complication when specifying multiple rotations is the following:  are you rotating about Earth-fixed axes, or Subject-fixed axes?  Again, it makes a difference!

Some other things to consider:

  • As Dr. Doering points out, gyroscopes respond to angular velocity about their preferred axis.  On the other hand, "Roll", "Pitch", and "Yaw" typically refer to single axis position changes with respect to the three Cartesian Axes.
  • Imagine you have a ball and put three dots on it to mark the X (Nose), Y (Left Ear), and Z (Top) of the ball.  Start with X pointing North and Z pointing Up (Y would have to point West).  Now orient the ball to a Target Point in space by doing the following three rotations:
    1. Rotate about the ball's Z axis (a Yaw) until the X axis is in the vertical plane that includes the Target Point.
    2. Rotate about the Ball's (now-rotated) Y Axis (a Pitch) until the X axis points to the Target.
    3. Now "Roll" the ball around your X Axis.  This doesn't change the orientation of the X Axis (so if this was your eye, you would still be looking at the Target).
  • The previous operation took three rotations and put the Ball into a new orientation.  It turns out that you can accomplish exactly the same thing, moving from "straight ahead" to "looking at a target with a specific "apparent Roll" when on Target with a single rotation (usually about a tilted axis).  This means you have to be really careful and really specific when you talk about "doing rolls and pitches" (as, among other things, "Roll 15° then Pitch 40°" is not the same as "Pitch 40° then Roll 15°".
  • Gyroscopes tell you about the velocity of rotation about a specific axis.  It does not tell you anything about position.  When you get "time" mixed up with "position", things get much more complicated.  Among other things, you have to ask "is the sensor, itself, moving?  What are the characteristics of the motion?".
  • For static (non-moving) measurements, the triaxial accelerometer gives you "positioning in space" (with respect to gravity, i.e. the Z component) and the magnetic compass gives you essentially the "planar" orientation with respect to Magnetic North.
  • Learn the Math.  It is not trivial.

Bob Schor

 

0 Kudos
Message 2 of 7
(2,190 Views)

There are excellent references to the information you ask about in Dr. Doering's articles (check the references he cites).

 

Bob Schor

0 Kudos
Message 3 of 7
(2,183 Views)

Hello, thanks for your answer.

I am trying a new example to read magnetometer information in addition to accelerometer, gyroscope information. I'm still trying to read data from sensors using SPI. I found a new example. Serial connection to Myrio was lost while trying to read information from sensor using SPI. I cannot reconnect to myrio without restarting myrio. What do you think could be the cause of this problem?

Below is the example I used.

If I can fix this problem I will work on the next steps again.

0 Kudos
Message 4 of 7
(2,176 Views)

Is this the same code that @IllinoisControl shared in the Academic Forum in 2014?  Looks like it ...

 

You do know, I presume, why the myRIO stopped -- there was an Error somewhere that stopped the top Timed Loop (but why didn't the bottom Timed Loop prevent the Frame Sequence from executing the Reset myRIO?).  So the culprit is either "Initialize_Loop" or "Read_Data" (why did I leave out "Process Graph"?).  

 

Now you can learn a little about debugging LabVIEW code.  Here are three things you should look up and learn about that may be helpful:

  • Highlight Execution -- the little Light Bulb on the Block Diagram Toolbar, 5th icon.
  • Breakpoints -- click on a Wire and scroll down to the Breakpoint drop-down.
  • Probes -- click on a Wire and scroll down to the Probes drop-down.

You can also go to LabVIEW Help and search for "Debugging".  Look for the entry "Debugging Techniques" in location "Concepts".

 

Bob Schor

0 Kudos
Message 5 of 7
(2,147 Views)

I think the problem was that the VI was using too much CPU causing overheating. After deleting the extra representations in the code, the problem was solved.

thank you for the answer.

But on other issues in general. I'm working using different methods.

0 Kudos
Message 6 of 7
(2,131 Views)

@constructionworker wrote:

I think the problem was that the VI was using too much CPU causing overheating.


Overheating?  From a 9-axis MPU running on 3V power and 9 channels of SPI or I²C?  I don't believe temperature is a factor here.  But then I don't really know how hard your myRIO is running -- how many channels (9?) are you sampling, how fast, and for how long?  What are you using to power your myRIO?  I think its power consumption is pretty modest (I've run it off batteries) ...

 

Bob Schor

0 Kudos
Message 7 of 7
(2,118 Views)