Major INDI Library release v1.9.0 bring significant internal changes championed by @pawel-soja to modernize core INDI Library drivers and clients. New drivers for DeepSkyDad Flat Panel & Pegasus devices plus further improvements to PCM8 drivers.
Can someone help me understand elative and absolute focuser position?
I'm a college student working on client development using PyIndi-Client for a research project with a professor. There are standard properties for focusers called REL_FOCUS_POSITION and ABS_FOCUS_POSITION for which I'm trying to write functions to change their values. Or, rather, I would like to be able to do that, but I don't understand what they are or what the difference between them is. I do know that you can use getNumber("REL_FOCUS_POSITION") to access the list of members, change the value and send it back to the indiclient, but I don't know what the numbers mean. Here's what some of my code looks like right now:
return make_response(jsonify('Absolute focus position set to: ' +
The app.route stuff is from a package called Flask, for anyone who might not recognize that. So you see that a number of steps is passed into the function, but what does that number actually represent?
I'm still pretty novice when it comes to this stuff, so I'm trying to build a deeper understanding. When I googled this question, I didn't see any real explanations, so I would appreciate any clarification someone could give me.
Last edit: 1 year 1 month ago by Stephen Berg. Reason: Fixed code
Most (but not all) focusers use a stepper motor. Stepper motors have a definite number of steps per revolution of the motor (usually 200, sometimes 400). So the steps parameter maps directly to a number of steps on the stepper motor.
Setting the absolute position will move the stepper to the new position specified. If it thinks the current position is 5000, and you tell it to move to 4000, then it will move inward by 1000 steps.
Now, if you know you want to move inward by, say, 100 steps, you could get the current absolute position, subtract 100, then tell the focuser to move to that new absolute position. Or you could just tell it to move inward by 100 steps by passing -100 to the relative position property. Or +100 to move outward. So the relative properties are just a shortcut to move in or out a set distance. Otherwise you'd have to read the absolute position, do some math (not complicated), then send back the new position.
Thanks for the speedy reply. I understand how the relative and absolute positions work now, but this has brought up another question. There is another standard property for focusers called FOCUS_MOTION which is a switch that can be defined as focusing in or focusing out. I'm testing my functions with an indiserver running indi_simulator_focus, and being able to pass in absolute position values to the simulator to change the absolute position to be higher or lower than the previous value seems to invalidate the need for the FOCUS_MOTION property. Am I understanding this correctly? What's the point of the FOCUS_MOTION switch if the absolute focuser position can be changed in either direction at will?
Sorry, I was going from memory. I poked through the code, and yes, the relative motion is slightly more complicated than I first described it. Doing a relative move is a two-step process. Set the direction via the FOCUS_MOTION property. Then set the amount you want to move via REL_FOCUS_POSITION (always a positive number, so my comment above about -100 is wrong). When you do that, the focuser will move the specified direction for the specified distance. And yes, you could achieve this with the ABS_FOCUS_POSITION setting as well.
The main reason (I believe) for the relative movement properties is for DC focus motors, not stepper motors. DC motors don't have steps. You turn voltage on, they run until you turn the voltage off. In this case, the amount to move isn't steps, but milliseconds. And for those types of focusers, the absolute position settings won't be available. I think that's how it works. I'm not sure, I only work with stepper motors.