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?
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…
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).
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 …
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.