atan2 problem with drone

1 次查看(过去 30 天)
Dhruv
Dhruv 2013-8-26
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.

回答(1 个)

David Sanchez
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.

类别

Help CenterFile Exchange 中查找有关 Simulink 的更多信息

标签

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by