The quaternion transformation for this 180 deg rotation about x is:
qFLU2FRD = (w,x,y,z) = (cos(pi/2),sin(pi/2),0,0) = (0,1,0,0)
Then it is a question of what convention your original quaternion is in. If your original qFLU represents a Hamilton passive coordinate system transformation, then successive coordinate system transformations stack up on the right and you would get:
qFRD = qFLU * qFLU2FRD
Otherwise you will get:
qFRD = qFLU2FRD * qFLU
I am not familiar with the quaternion convention of the Eigen package, so can't advise you as to which one of these is correct for your particular problem. To see that this quaternion flips the signs of the y and z elements, an example using MATLAB assuming passive Hamilton convention:
>> a = 1:3 % an arbitrary vector in FLU
a =
1 2 3
>> qa = quaternion([0,a]) % a as quaternion
qa =
quaternion
0 + 1i + 2j + 3k
>> qFLU2FRD = quaternion(cosd(180/2), sind(180/2), 0, 0)
qFLU2FRD =
quaternion
0 + 1i + 0j + 0k
>> conj(qFLU2FRD) * qa * qFLU2FRD % rotate the vector a coordinates
ans =
quaternion
0 + 1i - 2j - 3k
As you can see, the y and z elements flipped signs as expected.
Since we know the form of qFLU2FRD, we can simply do the qFLU * qFLU2FRD symbolically to see how the quaternion changes, again using MATLAB:
>> syms qw qx qy qz % the elements of qFLU
>> qv = [qx,qy,qz] % the vector part of qFLU
qv =
[ qx, qy, qz]
>> pw = 0 % the scalar part of qFLU2FRD
pw =
0
>> pv = [1 0 0] % the vector part of qFLU2FRD
pv =
1 0 0
>> qpw = qw*pw - sum(qv.*pv) % the scalar part of qFLU * qFLU2FRD
qpw =
-qx
>> qpv = qw*pv + pw*qv + cross(qv,pv) % the vector part of qFLU * qFLU2FRD
qpv =
[ qw, qz, -qy]
So, if qFLU = (qw,qx,qy,qz), then qFRD = (-qx,qw,qz,-qy). I.e., you can do some simple element + sign swapping to get the new quaternion. But, again, this assumes a passive Hamilton quaternion convention. If the Eigen package has a different convention, then you would have to switch the order of multiplication in my example to get the matching result for that case.
1entry, you can optimize the multiplication to a shuffle and (a/some) sign change(s). Be very careful with the order of multiplication and test your code thoroughly.