Using getDirectionCosines
- Moe Curtin
- Posts: 43
- Joined: Fri Oct 02, 2009 5:40 am
Using getDirectionCosines
Could anyone please tell me in what order the values are returned when using getDirectionCosines and what they correspond to. I'm having trouble trying to figure it out, thanks!
- Ayman Habib
- Posts: 2235
- Joined: Fri Apr 01, 2005 12:24 pm
RE: Using getDirectionCosines
Moe,
SimbodyEngine::getDirectionCosines(state,B,mtx)
Extracts from the state cache the spatial orientation R_GB of body B's body frame x, y, and z axes expressed in the Ground frame, as the Rotation matrix R_GB returned in mtx[3][3].
The sense of this rotation matrix is such that if you have a vector v fixed on body B, represented by the vector v_B expressed in the B frame, then v_G=R_GB*v_B where v_G is the same vector but re-expressed in the Ground frame.
This matrix can be later converted to BodyFixedXYZ Euler angles using the call to SimbodyEngine::convertDirectionCosinesToAngles
Hope this helps,
-Ayman
SimbodyEngine::getDirectionCosines(state,B,mtx)
Extracts from the state cache the spatial orientation R_GB of body B's body frame x, y, and z axes expressed in the Ground frame, as the Rotation matrix R_GB returned in mtx[3][3].
The sense of this rotation matrix is such that if you have a vector v fixed on body B, represented by the vector v_B expressed in the B frame, then v_G=R_GB*v_B where v_G is the same vector but re-expressed in the Ground frame.
This matrix can be later converted to BodyFixedXYZ Euler angles using the call to SimbodyEngine::convertDirectionCosinesToAngles
Hope this helps,
-Ayman
- Moe Curtin
- Posts: 43
- Joined: Fri Oct 02, 2009 5:40 am
RE: Using getDirectionCosines
Thanks Ayman, that worked great!