I have a Pololu mini maestro board using which I am trying to control one servo. I want the servo to maintain a target angle (~90 degrees or the middle position) at all times, and the code should re-center the servo if it is moved by a force. How can I program that?
Any help would be really appreciated
@BrandonM could you please assist me
Thanks so much!
As long as you are using a normal servo (e.g. not some continuous rotation or specialty one), sending it a position signal is all you need to do to make it try to hold its position and resist change. The electronics in the servo take care of that. Standard servos do not give access to their internal feedback, so there is no way for the Maestro to know if the servo is actually at the position it is commanding. If the servo is not maintaining its position, you might consider using a stronger servo for your application. You could try adding some external feedback and doing your own feedback control, but as I mentioned before, if your servo cannot hold its position, you might already be stressing it beyond what it is capable of and could end up damaging it.
Thanks for your quick reply. What you said makes sense to me now. However, I am looking at the pololu manual but I am struggling with the script. I have a normal servo. By any chance would you be able to assist me with a simple script that will set my servo continuously at 90 degrees which I can run on startup
Since you just want the servo to stay in one spot, you do not need to use a script. Instead, you can just set the “On startup or error” behavior for that channel to “Goto” in the Channel Settings tab of the Maestro Control Center. Then, you can specify the target value you want in the dialog box next to it. If you do not know what target value corresponds to the position you want, you can use the slider in the “Status” tab to move your servo and find it.
Thanks so much for your help, following those steps worked! and my servo holds the desired target value after specifying that on startup. However, there is some freeplay or deadzone near the target position. Do you happen to know how I may be able to eliminate the freeplay?
If all you are doing is setting the “On startup or error” for that servo channel to a specific target, the Maestro should be sending a steady pulse width signal to the servo, so any play in the servo’s position is likely from the servo itself.
If you are doing more than that (e.g. you have a script running), could you post your Maestro settings file? You can save your settings file from the “File” drop-down menu of the Maestro Control Center while the controller is connected. What servo are you using? Does it still have the deadzone you are describing if you move it to other positions?