LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

myRIO-1900 MPU-6050 error

Solved!
Go to solution

  thanks for your answer it was an instructive answer. I think I understood what the Gyroscope, Accelerometer and Magnetometer do, although not much. But I still have a problem. I am reading the 3 Axis information of the Accelerometer and Gyroscop, but I cannot read the information of the magnetometer and I almost never used I2C communication. Currently I am trying to solve the Shared code and I2C communication.

Another problem is pitch, yaw, roll calculation.
I think the pitch and roll can be calculated from the 3 axis information of the Accelerometer. I don't know how accurately it can work.
For yaw calculation, I think it is necessary to use pitch, roll and magnotemeter 3 axis information.

I'm just thinking and I have no idea how to do this on labview.

0 Kudos
Message 11 of 14
(607 Views)

The mathematics of 3-D Geometry can be "challenging", as there are multiple "conventions".  But here is a common one that should get you started:

  • X-Y-Z Coordinate Axes (basis for Linear Accelerations, and should correspond to your Linear Accelerometer).  Consider your head, or an airplane. 
    • The +X Axis is your nose, or the nose of the airplane.
    • The +Y Axis is out your left ear (or the left wing of the airplane).
    • The +Z Asis is the top of your head (or "Up" if you are standing), and the "sky" for an airplane.
  • The ordering of X-Y-Z form a right-hand coordinate system (point your fingers in the X direction, curl them towards the Y direction, and you will find that if you stick out your thumb, it points "up").
    • If you've had a course on Vector Calculus, you'll already know about this, and will know that the Vector Cross Product follows this "Right Hand Rule".
  • Assume the Sensor (Linear + Angular + Magnetic) is not moving.  Compute the X, Y, Z components (of Gravity, which points in the -Z direction).  If your Sensor is "Level", you should record something close to (0, 0, -1) (I'm assuming Units in "g's").  If it says (0, 0, +1), then they are telling you the orientation of the "sensor" (which is "accelerating upward at 1 g to prevent itself from falling").
  • I don't know how the Magnetometer reports its readings, but remember it tells you where Magnetic North is (a direction) with respect to an earth-horizontal plane.  Again, Magnetic North is probably not "Earth North" (which is the direction of the North Pole in the same "horizontal" plane).
  • Roll, Pitch, and Yaw represent rotations about the X (Roll), Y (Pitch), and Z (Yaw) axes.  Again, the Right-Hand Rule would say that a positive Roll is "Right Ear Down", Pitch is "Nose Down", and Yaw is "Nose Left".
  • Let's not talk about Gimbels -- it will get very messy, very fast.  Here's the problem -- everything is easy when the sensor lies in the Horizontal Plane (i.e. +Z is "up").  The Magnetometer reading gives you "Magnetic North", and if you know the angular difference between "Magnetic" and "True" North, you can simply Yaw (in the appropriate direction) and say "my Nose now points to the North Pole".  But what if the Z axis does not point up?  Then it gets messy, because (as the Mathematicians like to say, "Rotations don't (necessarily) Commute" -- the order you do the rotations matters (and is the difference between Fick and Helmholtz, among other illustrious names).

Bob Schor

0 Kudos
Message 12 of 14
(596 Views)

 

Thanks for your answer.I did some research on the XYZ axis information of MPU. I think I understood a little bit. I cannot read the magnetometer information at the moment. How can I read this? Only accelerometer and gyroscope outputs can be read in the shared code.I am using the MPU-9250 product.

0 Kudos
Message 13 of 14
(593 Views)

I think it would be better if I opened a new topic, this topic is both old and seems like I will go out of the topic.New topic

0 Kudos
Message 14 of 14
(577 Views)