Clear Filters
Clear Filters

atan2 problem with drone

1 view (last 30 days)
Dhruv
Dhruv on 26 Aug 2013
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.

Answers (1)

David Sanchez
David Sanchez on 26 Aug 2013
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.

Categories

Find more on Simulink in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!