Go Down

Topic: Need Help Maping Continuous Servo Speeds (Read 298 times)previous topic - next topic

TOhlsen

Apr 16, 2019, 11:32 pm
I am currently working on a project for a mechatronics class, where we are building an autonomous robot. The robot is going to be modeled as a front wheel drive car using continuous rotation servos for the motors for the front wheels.

I do want to note that the servos are not standard servos. They are built specifically for limitless rotation and are controlled by setting the speed rather than the angle.

The problem we have, is that the servos rotate faster when going one direction as opposed to the other. The way we have the motors aligned, one wheel will be rotating forward while the other is rotating backwards to move the car forward. This will cause the car to move slightly to one side when commanded to move forward.

Our solution is to use the map function to readjust the speed values so that the car will drive straight. I have tried looking online for solutions and have only found solutions for standard servos that use stepping functions to adjust the speed.

I wanted to ask the community if anyone has any ideas or any other solutions before we jump into the rabbit hole and make a mess of things.

neiklot

#1
Apr 17, 2019, 06:58 amLast Edit: Apr 17, 2019, 07:01 am by neiklot
The only real way to "guarantee" speed is to measure it.

Even if you can be reasonably certain that one wheel is a consistent amount slower than the other, and feed it a writeMicroseconds(foo) rather than writeMicroseconds(bar) to compensate, that's still no guarantee.

I epoxied a hall sensor on the side of a small continuous rotation servo and stuck a tiny magnet on the horn; then used code which iirc I found in the playground to measure the actual rpm.

So you could read one side's speed and deem that the "correct" value, and then read the other and if it's "wrong" send it a different value?

wildbill

#2
Apr 17, 2019, 04:09 pm
If you don't want to go with the hall sensor, good though it is, you can figure out by experiment what the necessary adjustment is at a variety of speeds. Then keep that data in a 2D array and extrapolate in-between. Alternatively have Excel derive a formula to do it for you.

But even if you have the servos calibrated nicely, you'll still have the possibility of wheel slip causing you to go off course. You really need some other sensor to keep you straight (compass, ultrasonic wall tracking etc.)

Go Up