Skip to content
This repository has been archived by the owner on Oct 1, 2021. It is now read-only.

IR-LOCK: rework driver #59

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

jschall
Copy link

@jschall jschall commented Jul 7, 2016

No description provided.

@tridge
Copy link

tridge commented Jul 7, 2016

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)
Copy link

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?

Copy link
Author

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.

@rmackay9
Copy link

rmackay9 commented Jul 7, 2016

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.

@jschall
Copy link
Author

jschall commented Jul 7, 2016

@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.

@jschall
Copy link
Author

jschall commented Jul 7, 2016

@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.

@tridge
Copy link

tridge commented Jul 7, 2016

maybe check with nm or objdump? If not then computing it once would make sense.
Or make it a constexpr, and the compiler should give an error if it can't evaluate it

@jschall
Copy link
Author

jschall commented Jul 7, 2016

@tridge updated in response to review.

Note: this PR supports ArduPilot/ardupilot#4437

@rmackay9
Copy link

I've created PR upstream as well. PX4#5024

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants