I was studying PX4 and quaternions, and I learned that quaternions can represent the rotation of vectors and the rotation of the coordinate system.

For the case of theorem of Quaternion - rotation of a vector: given a vector **p** and a quaternion q,then the vector **p** rotated by quaternion q can be expressed as **p**ā=q**p**q^-1.

For the case of theorem of Quaternion- Rotation of a coordinate system: given a vector **p** in the coordinate system XYZ,the XYZ coordiniate system is rotated by a quaternion q to XāYāZā,and vector **p** expressed in the XāYāZā coordinate system pā is expressed as **p**ā=q^-1**p**q.

I can ensure that these two formulas should be correct, but when I looked at the quaternion.hpp code of PX4, I found that the formulas in PX4 were different from my understanding. When using quaternions to represent the rotation of the coordinate system, the second formula should be used, but PX4 uses the first one, pā=qpq^-1.

Here is the code in PX4

```
* In order to rotate a vector in frame b (v_b) to frame n by a righthand
* rotation defined by the quaternion q_nb (from frame b to n)
* one can use the following operation:
* v_n = q_nb * [0;v_b] * q_nb^(-1)
```

I think the formula here should be v_n = q_nb^(-1) * [0;v_b] * q_nb

```
/**
* Rotates vector v_1 in frame 1 to vector v_2 in frame 2
* using the rotation quaternion q_21
* describing the rotation from frame 1 to 2
* v_2 = q_21 * v_1 * q_21^-1
*
* @param vec vector to rotate in frame 1 (typically body frame)
* @return rotated vector in frame 2 (typically reference frame)
*/
Vector3<Type> conjugate(const Vector3<Type> &vec) const
{
const Quaternion &q = *this;
Quaternion v(Type(0), vec(0), vec(1), vec(2));
Quaternion res = q * v * q.inversed();
return Vector3<Type>(res(1), res(2), res(3));
}
```

The code is located in src\lib\matrix\matrix\Quaternion.hpp

I donāt know if thereās something wrong with my understanding, but obviously these two formulas cannot be mixed. So I came to ask for any help because it is very important for my further research!