This post is based off of the tremendous help found in James Pearman’s thread that he posted: Found Here which showed the 2-wire motors’ “strange” logarithmic Motor Control Value-to-Motor Speed curve.
With my ITZ season and time with Vex Robotics Competition coming to an end, I would like to share something that helped my team, 2158X/S achieve the 112 Skills Score.
Basically, our drive uses a variable controller function (trueSpeed) that I made to allow the motors to accelerate at a Linear constant. When you allow the motors to accelerate in a "raw" (without any form of control) manner, you will get something like this, (Note that these are not the motor input values on my 14 lbs ITZ Robot, this is based on the test robot I created on the whim to share this.):
When you have a "raw" acceleration, it gives some drawbacks such as the speed you can accelerate over that given time period. If you were to have a linear acceleration, you would be able to go from 0 Motor Power to 127 Motor Power over the given time to achieve a perfect acceleration. It is near impossible to achieve purely linear acceleration through Vex EDR Motors, and if you somehow could, the motors would not be able to maintain that acceleration for long. Again, If you were to achieve a linear acceleration, you would have something like this:
The natural "raw" acceleration from the test robot I built faired to be very different from the acceleration that is Linear/”Perfect”. This is an example of the two groups being plotted:
As you can see, the “raw” acceleration is not a constant acceleration like the Linear one. This is where I can introduce trueSpeed combined with MLD2.0. Basically trueSpeed a controller that achieves somewhat close to Linear acceleration. When you add MLD2.0 (Releasing Open-Source in a few days) to the sample program that I created for the trueSpeed testing, you get a close-to-Linear acceleration that you would want. Using my test data (Because we really only needed this fine control on the drive, that was what I ended up doing testing on. I got a few foam tiles and created a square to run the robot on for testing, and ran a program that gave a Motor Control Value to all the motors on one side of the drive for about 5 seconds (with one additional second at the beginning to allow the motors to accelerate) before taking count of the value of the IME on that half of the drive, and calculating a speed in RPM for that Motor Control Value. It would then step to the next power value and repeat the process, for every value from 1 to 127. I performed this test both from 1 to 127 and 127 to 1, on the left and right sides, monitoring the battery voltage along the way.)), I was able to create an array so that this curve would be as close to the red “Linear” line on the graph as possible.
Array for sample robot:
// compensates for non-linearity of control value vs speed curve
const unsigned int TrueSpeed[128] =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 21, 21, 21, 22, 22, 22, 23, 24, 24,
25, 25, 25, 25, 26, 27, 27, 28, 28, 28,
28, 29, 30, 30, 30, 31, 31, 32, 32, 32,
33, 33, 34, 34, 35, 35, 35, 36, 36, 37,
37, 37, 37, 38, 38, 39, 39, 39, 40, 40,
41, 41, 42, 42, 43, 44, 44, 45, 45, 46,
46, 47, 47, 48, 48, 49, 50, 50, 51, 52,
52, 53, 54, 55, 56, 57, 57, 58, 59, 60,
61, 62, 63, 64, 65, 66, 67, 67, 68, 70,
71, 72, 72, 73, 74, 76, 77, 78, 79, 79,
80, 81, 83, 84, 84, 86, 86, 87, 87, 88,
88, 89, 89, 90, 90,127,127,127
};
(Taken from BNS post from 2013, I’m sorry that I did not document this properly)
When I plotted all of the accelerations on to a graph, I was able to see how close the sample program was to the “Perfect” Linear Acceleration. Here:
As you can see, the trueSpeed combined with MLD2.0 allows the robot to achieve near perfect Linear acceleration.
If you have any questions about this process, feel free to PM me on the forums.
If you want to know more about MLD2.0 and its benefits, I will be releasing a post about MLD2.0 and will be releasing its first open source release.
Notes: I graphed most of this data on RapidTables because I did not have access to Excel at the moment and the values are not as in-depth as I would have liked, but it would fair to work.
If you need a better explanation of trueSpeed, check out the 24C (BNS) Guide on the forums from 2013.
– Josiah