![]() |
Converting between camera normalized data and servo
I have been trying to have a servo attached to the camera x axis twist to turn it so the center image is the center of the target. Since the normalized output in the vision target is a value that shows it to the left or right of the center of the image, you should be able to take that and convert it to the scale a servo uses. Then make changes to the servo until it and the target are centered.
The issue I am having is figuring out how to normalize the ranges. I have gotten this far, I do not think I am lost, but that I am just not understanding the math, or the proper procedure for determining it. Suggestions or help would be greatly appreciated. I tried following the math on this page http://stackoverflow.com/questions/1471370/normalizing-from-0-5-1-to-0-1 not sure if this is the right method or not Code:
double servoChange = ((report.center_mass_x_normalized-(-1))/2); |
Re: Converting between camera normalized data and servo
It seems odd that you are pinning servoChange but don't use the value and use servoInput instead.
The other variable is how the servo is mounted. It could be that the serverInput should be the cameraS.get() + servoChange. Greg McKaskle |
Re: Converting between camera normalized data and servo
Ok, reworked it a little. What i am getting for a servo change is usually over 1 at current testing. So i think i am back to trying to get the values scaled correctly.
Code:
servoChange = ((report.center_mass_x_normalized-(-1))/2); |
| All times are GMT -5. The time now is 02:16. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi