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 pagehttp://stackoverflow.com/questions/1471370/normalizing-from-0-5-1-to-0-1
not sure if this is the right method or not
double servoChange = ((report.center_mass_x_normalized-(-1))/2);
System.out.println("Servo Change: " + servoChange);
double servoInput = CameraX.get()-servoChange;
if(servoChange > 1) {
servoChange = 1; }
else if(servoChange < 0) {
servoChange = 0;
}
CameraX.set(servoInput);