Servo jitters on the GoPiGo

I am trying to use the camera with OpenCV object recognition, while looking left and right to try and recognize the object I’m looking for.
That doesn’t work consistently since after using the servo() function, the servo jumps around or jitters for quite a while. This causes images being captured to be blurry which means image recognition fails.
Given that in this application I don’t care as much about the exact direction of the servo but do want it to just turn and stop - is there some way to achieve that?


I have tried the following with some good results:

#Move the servo to the next angle

But I am not 100% satisfied of the results. Maybe I will try another servo, different make, different size.

Thanks patrickjqc!
I will try it out.
Ideally, the SDK should allow for a version of sevro() that does not continue to try refining the servo angle for so long…

Right now we have hardcoded it to 10 seconds: but we can change it. Any suggestions about what time would work great or should we add a function so that people can change it.


I Think 10 seconds is very long for my application. I would definitely love to be able to set it. Thanks

Same here - 10 seconds is way too long. A function that lets us set this, or a function other than disable_servo() that lets us stop it after the application waited an appropriate time, would be much better.
The application I’m looking at has the camera mounted on the servo, and it looks left, right and center, getting a picture in each position and doing some image processing on that. The exact direction of the servo doesn’t matter much, but the shaking makes the picture unusable.
Trying the idea from patrickjqc, I see that doing a disable_servo after a time.sleep(0.3) generally gets me the what I need - but it also means that we must do an enable_servo() every time and seems generally messy.
Something like servo(angle, time_to_stabilize = 10.0) would have worked much better for me, which I would have invoked with servo(angle, 0.3).

Hey Rafit,
Thanks a lot. We’ll add this in the list of things to do for the next firmware update and will let you know when it’s done.


Anything new there ? Just started with my newly aquired GoPiGo and the servo behaviour seems still the same.

@sam3 are you using a GoPiGo2 or GoPiGo3?

I got a GoPiGo2 unfortunately - didn’t know there was a V3 when I bought it few days ago :frowning:

Hi @sam3,

I think I have covered this issue on the following topic - link here.
You’ll see a very nice explanation on this matter.

Thank you!

Thanks for the input RoberLuciAN, but my problem is not the “precision” so to speak. I was hoping the 10 second spastic after each move command would have been removed or at least made configurable in firmware by now.
Does not seem to be the case, guess I will have to move to a “proper” PWM module …

Hi @sam3,

I was hoping the 10 second spastic after each move command would have

I’m not exactly sure what you are referring to.

If you’re still referring to the jitter that’s on the servo lines, then I’ll quote from the link I’ve shared with you.

So because of this SoftwareServo library, the timings are not perfect - they do have some jitter.

This basically says the servos will always have jitter as we are using the SoftwareServo library. And that to us and to all of our clients was a compromise:

  • Either get hardware PWMs where the servo signal is super reliable - but we only could use 1 or 2 servos I think, while disabling other critical functionalities.

  • Or use the SoftwareServo library, where we get jitter on the servo lines, but much more servos can be driven at the same time.

What would you have chosen?

For having a reliable signal on the servos, I suggest you use the PivotPi on your GoPiGo - this is a dedicated platform for actuating servos.
It’s going to work really well and you’ll be able to plug in up to 8 servos.

If there’s anything else still unclear, please let us know and we will try to help you understand.

Thank you!