Though much data collection, I found that the relationships between the PWM values
sent to the Robot's Wheels to specify their speeds and the resulting Wheel speeds
(as represented by their Encoder Counts/minute) are wildly irreproducible,
and differ from wheel to wheel as well.
Meaning that treating a Wheel's speed as a continuous range from 0-600 Encoder
Counts/minute just isn't something that the Wheels' motors can deliver.
To address this, I collected PWM Count vs. Wheel Encoder Count Response Curves from a
dozen test runs driving my Robot up and down the hallway, and segmented each Wheel's Speed Range into
non-overlapping sub-ranges, called Encoder Count Ranges.
To do this, I first obtained from those test runs the
the Black upper-bound line and
the Cyan lower-bound line
for each Wheel, as shown below.
I wrote a function that starts at the first
data point on the Cyan line, and draws a
vertical Purple line up to the
Black upper-bound line.
To find the lower end of the next
Purple line,
the function moves horizontally to the right, back to the
Cyan line.
The point that the function lands on on the
Cyan line
becomes the lower end of the next
Purple line.
The function continues like this, drawing a series of
Purple "Steps" all the
way to the end of the Plot. Each of these Steps I call an Encoder Count Range.
The usage for these Encoder Count Ranges is as follows:
When the Robot's control program commands that a Wheel rotate at
a particular speed (expressed in Encoder Counts/minute),
a function determines in which Encoder Count Range that speed lies.
That Encoder Count Range's PWM value is then sent to the Wheel,
with the claim that the Wheel will now begin rotating at a
speed "somewhere" within the chosen Encoder Count Range.
For example, to command each of the Wheels to rotate at an
Encoder Count/minute "near" 100, I send each Wheel
a its own unique PWM value as shown here
(click on the image to open a larger view of it in a new Window):
This approach provides a general way to reliably deliver "close"
to the requested Wheel speed while allowing for the variation between
Wheels, as well as taking into account the unpredictable behavior
exhibited by each Wheel.
Click on any of the 5 images below to open a new Window/Tab in your Browser
to see greatly enlarged versions of the
Purple Vertical Lines for each of the 4 wheels:
Unfortunately with this approach, very few distinct Wheel
speeds are possible.
Here is a screenshot of my full Robot Control program: