Demo Code calculation of Rollang is always positive - Discovery board
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2014-04-18 10:15 AM
Posted on April 18, 2014 at 19:15
In the Demo code for the stm32f3discovery the Rollang calculation appears to be incorrect.
The author chose to use the acos function and apply quadrant correction instead of using atan2(x,y) function which handles the sign of the two terms.the code linefCosRoll = sqrt(1.0-(fSinRoll * fSinRoll));will always be a positive number.The quadrant test will always take the the postive branch in this code, if (fCosRoll>0) { RollAng = acos(fCosRoll)*180/PI; } else { RollAng = acos(fCosRoll)*180/PI + 180; }The calculated value for RollAng will always be positive since fCosRoll is always positive.Is my logic correct? Has this been brought up before? Is there any revised code from st?
This discussion is locked. Please start a new topic to ask your question.
0 REPLIES 0
