atan2 problem with drone
1 回表示 (過去 30 日間)
古いコメントを表示
I am working with a drone which returns information about its orientation in the form of a rotational matrix. Hence, I get the sin and cos of the angle I finally need.
I use atan2 to get around the problem and get the angle in -180 to 180 range. I change to 0 to 360 by adding 360 to any negative values.
However, since I need to be able to give inputs like 570° (+ rotates the drone left and - rotates right)to the drone, I have a problem with the atan2 function. My controller doesnt work in such cases as the output from the drone stays between 0-360 and never reaches the desired value.
Any help is appreciated.
0 件のコメント
回答 (1 件)
David Sanchez
2013 年 8 月 26 日
If I don't get it wrong, you are trying to make your drone spin around itself, aren't you. The state of you drone is obviously +/- 180º or 0/360º. You have to set a zero crossing counter to let the system know when it has completed a whole turn and keep turning until the desired angle is reached.
0 件のコメント
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!