-
Notifications
You must be signed in to change notification settings - Fork 441
IR-LOCK: rework driver #59
base: master
Are you sure you want to change the base?
Conversation
why is tangent of angles better than just the angles? |
#define IRLOCK_FOV_X (60.0f*M_PI_F/180.0f) | ||
#define IRLOCK_FOV_Y (35.0f*M_PI_F/180.0f) | ||
|
||
#define IRLOCK_TAN_ANG_PER_PIXEL_X (2*tanf(IRLOCK_FOV_X/2)/IRLOCK_RES_X) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have you checked that the compiler does the tanf() call at build time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have not and I suspect that it probably does not.
By the way, I test flew this and it definitely improves the precision landing. It no longer snakes towards the target, it just comes straight down onto it. It still misses it some times but undoubtedly it improves the control. |
@tridge In regard to your question about why it is the tangent of the angles, I've done it that way because it is a convenient and natural format - it converts easily to either a unit vector or to an angle, and it is fast and compact. My second choice would be to convert it to a unit vector. |
@tridge actually it should, since gcc 4.3 according to stackoverflow http://stackoverflow.com/questions/4633480/compile-time-trigonometry-in-c https://gcc.gnu.org/gcc-4.3/changes.html I haven't verified though. |
maybe check with nm or objdump? If not then computing it once would make sense. |
@tridge updated in response to review. Note: this PR supports ArduPilot/ardupilot#4437 |
I've created PR upstream as well. PX4#5024 |
No description provided.