 # Joint angle measurement with IMUs (mpu6050)

Hi community,

as you can see in the attached picture, the system consists of two links. Both links rotate around x. The center of gravity is marked with yellow points.

The goal is to measure the joint angle values with the roll value from IMUs attached on each link.
However, the problem is that the roll increases on the second axis, (which isnt moving) while the first moves.

So actually, the increment of the second roll value is right, since it actually rotates with the first axis. However, the second roll should stay at 0, when only the first axis rotates. Am I missing something here or it is just not feasible?

To measure I am using MPU6050 with the standard DMP6 script. OP’s rather unclear image, posted properly: Measuring joint angles using IMUs as tilt sensors is straightforward.

However, forum members are not in a position to help, as you forgot to follow the posting guidelines, described in the “How to use this forum” post.

Hi community,

I am having hard time to understand the concept of joint angle measurement.
Below is the approach that I thought of, correct me please, if I am wrong :

• MPU6050 is used to measure the rotation. So since gyros are used, the center of geometry points are estimated ( Yellow points in the attached image ).

• To measure the rotation of the first axis, we only have to read the output of the 1. IMU

• To measure the rotation of the second axis, a relational angle between 1. and 2. axis should be estimated. This is the part that I do not understand.

Let’s assume the 1. axis rotates around 10 deg. How can the rotation of 2. axis be estimated ? Like this ?

Roll_2 = Measured_Roll_with_2_IMU - Roll_1 An IMU measures an orientation in space, relative to a reference frame (typically defined by gravity and earth's magnetic field). So if you have two joints with the same axis of rotation you'd need two IMUs.

Typically such a measurement would be done using encoders, not IMUs, since the magnetic field around machinery is not usually well-behaved and the reference frames could be way out. Also encoders give more precision and much less noise.

The gyro in the MPU6050 measures [u]rate[/u] of rotation, and cannot be used to measure joint angles.

If the joint is stationary, you can measure two tilt angles (usually called pitch and roll) with respect to Down, using the accelerometer.

Coordinate system rotations are usually concatenated by sequential matrix multiplications, as described here: https://en.wikipedia.org/wiki/Rotation_matrix

MarkT: So if you have two joints with the same axis of rotation you'd need two IMUs.

I am using two IMUs, one for each joint. That is why there are two yellow points in the attached image.

MarkT: Typically such a measurement would be done using encoders

I know...The question is whether this equation for second joint is correct..

Roll_2 = Measured_Roll_with_2_IMU - Roll_1

`````` ////Low Pass Filter
fXg = Xg * alpha + (fXg * (1.0 - alpha));
fYg = Yg * alpha + (fYg * (1.0 - alpha));
fZg = Zg * alpha + (fZg * (1.0 - alpha));
//Roll & Pitch Equations from accelerometers only
float roll2  = (atan2(-mpu9250.getAyScaled(), mpu9250.getAzScaled())*180.0)/M_PI;
float pitch2 = (atan2( mpu9250.getAxScaled(), sqrt(mpu9250.getAyScaled()*mpu9250.getAyScaled() + mpu9250.getAzScaled()*mpu9250.getAzScaled()))*180.0)/M_PI;
``````

Idahowalker: ``` ////Low Pass Filter     fXg = Xg * alpha + (fXg * (1.0 - alpha));     fYg = Yg * alpha + (fYg * (1.0 - alpha));     fZg = Zg * alpha + (fZg * (1.0 - alpha));     //Roll & Pitch Equations from accelerometers only     float roll2  = (atan2(-mpu9250.getAyScaled(), mpu9250.getAzScaled())*180.0)/M_PI;     float pitch2 = (atan2( mpu9250.getAxScaled(), sqrt(mpu9250.getAyScaled()*mpu9250.getAyScaled() + mpu9250.getAzScaled()*mpu9250.getAzScaled()))*180.0)/M_PI; ```

Yes, using low pass filter we can estimate roll and pitch from accel. However, imagine the first axis in the attached file rotates around 10 deg. The second IMU's roll will not be 0. But we are expecting it to be 0, right? ( Since it did not actually rotate). How to compensate this effect on the second IMU from the first IMU is actually the question..