Hello,

Apologies if this is fairly simple, but I am trying to make sure I have my foundations right for a project I am working on which basically pans and tilts a camera to take images along the X and Y axis to later be combined into a gigapan style image.

So I calculate the xMax and xMin positions, as well as the yMax and yMin positions to end up with a yTotal and xTotal (the total degrees across the respective axis)

From there, I also calculate the number of degrees the given camera and lens (e.g. focal length) will cover accounting for some overlap.

Knowing the number of degrees the lens covers, I can do a simple yTotal / yLensDegrees to work out how many images I need to capture along the Y axis which is fine.

Say I need to capture 3 images across the Y axis, and 10 images along the X axis and I know the lens covers 20 degrees along the X, and 15 degrees along the Y what is the best way to loop these given I need to give absolute commands to the servo (e.g. move to position 45 degrees along x).

I thought about doing an integer loop which would still work, but just not sure how to handle the increasing servo position, should I just do something like a simple integer loop but start at 1 instead of zero, and move finish at the endpoint+1, then I could just multiply the integer loop number by the number of degrees the lens covers and send that to the servo as an absolute position?

Just wondering if there is a better way to do it than that, or if not does anyone foresee any problems?

Many thanks!