mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-11 02:18:29 -04:00
AP_Gimbal: use new quaternion math to handle gimbal lock issue
This commit is contained in:
parent
255c5b3025
commit
03974c93bb
@ -113,13 +113,13 @@ Vector3f AP_Gimbal::getGimbalRateDemVecTilt(Quaternion quatEst)
|
||||
{
|
||||
// Calculate the gimbal 321 Euler angle estimates relative to earth frame
|
||||
Vector3f eulerEst;
|
||||
quatEst.to_euler(eulerEst.x, eulerEst.y, eulerEst.z);
|
||||
quatEst.to_vector312(eulerEst.x, eulerEst.y, eulerEst.z);
|
||||
|
||||
// Calculate a demanded quaternion using the demanded roll and pitch and estimated yaw (yaw is slaved to the vehicle)
|
||||
Quaternion quatDem;
|
||||
quatDem.from_euler(_angle_ef_target_rad.x,
|
||||
_angle_ef_target_rad.y,
|
||||
eulerEst.z);
|
||||
quatDem.from_vector312( _angle_ef_target_rad.x,
|
||||
_angle_ef_target_rad.y,
|
||||
eulerEst.z);
|
||||
|
||||
//divide the demanded quaternion by the estimated to get the error
|
||||
Quaternion quatErr = quatDem / quatEst;
|
||||
|
Loading…
Reference in New Issue
Block a user