trueSpeed + MLD2.0

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.): 

Here

 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:

Here

 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:

Here

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:

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

Looks Interesting. What advantage does MLD2.0 give you? lol I’m not really a programmer so I don’t know

You copied this almost word for word from the post @LegoMindstormsmaniac made in 2013. The Truespeed look up table is even exactly the same as his. I know you didn’t actually plot this yourself because if you did then your first 11 values wouldn’t all be 0. They’d look more like this:


const unsigned int TrueSpeed[128] =
{
  0, 0, 10, 10, 10, 10, 11, 11, 11, 11,
  11, 12, 12, 12, 12, 12, 13, 13, 13, 13,
  13, 13, 14, 14, 14, 14, 14, 15, 15, 15,
  15, 16, 16, 16, 16, 16, 16, 17, 17, 17,
  17, 17, 18, 18, 18, 18, 19, 19, 19, 19,
  20, 20, 20, 20, 20, 21, 21, 21, 21, 21,
  22, 22, 22, 23, 23, 23, 24, 24, 24, 24,
  25, 25, 25, 26, 26, 26, 27, 27, 27, 28,
  28, 28, 29, 29, 30, 31, 31, 32, 32, 33,
  33, 34, 34, 34, 35, 35, 36, 37, 38, 40,
  41, 41, 42, 43, 44, 45, 47, 48, 50, 51,
  51, 52, 52, 53, 55, 56, 57, 58, 60, 62,
  66, 69, 74, 84, 85, 85, 126, 127
};

@Drow I’m concerned that this post (and potentially code from this MLD2.0 library) could be considered plagiarism. Here’s the post that some of this information is copied/pasted from. @Zero If I were you I’d be very careful about making sure any code snippets taken from elsewhere that are used in the code you’re publishing are clearly documented and proper attribution is given.

Also, I believe, TrueSpeed mapping tables posted above were collected while motors run under light load.

As you increase the load on the motors (>25%) the curve flattens and you don’t need any non-linear mapping. See here: https://vexforum.com/t/aidans-truespeed/45160/1

I would be skeptical about the claim that single mapping table works across wide range of motor loads without additional math to correct it based on encoder feedback about actual load at any given moment of time.

I think to make robust load independent trueSpeed library you need to model PTCs (i.e. SmartMotorLibrary) to ensure that corrections do not depend on the mass and friction/acceleration profile of the specific robot interacting with PTCs.

The fact that his profile picture and team number say V5 beta tester when he isn’t actually in the V5 beta tester group should also probably not be allowed.

I am truly very sorry. I was writing this without access to the sample robot and was unable to paste my code in. I did not get by clearly that the code was from BNS. It was not my intent to perform such an action. Also, the MLD 2.0 Library is not plagiarized in any way and has a whole private community backing the release of it…

I also do not understand how I copied the BNS Post “word for word”. This is based off of my own plottings, I am sorry you may think it was copied due to the unclear documentation of the array.

@Easton this is the post that we’re referencing.

https://lh3.googleusercontent.com/osJop4VjtwV49Kz8nKJku70DkKb19XbKyXa1XV_r_4dfe1u20rR8lpyNzBacahXeoddv55mP-502flL4xHJ95NW45V7I9QiIT62nsyEnerluTBrTyNAv_2GsrKIb-05aWo3ZcTCYE765mTKsDyNCsiCOwXI8SnNbKsLOMAA-UWFRthGGHoL6zxwHM-vsXMPVNd8xH-sNxx8xpDou6ammRUxAxnU1QXcY0U8EJR_6IIpv84ABKh0lhIcY1eQZyuy1wAB6484JEIV6yTjruZiqxPlmlIg8MmorMCFlynII-_nH561eDqgtH6erqF1b4MrXbMs7uRZFoSqbQoy-BVr9yMwLhHnlZXj1KHV6Ey6IMyB18nHJ9DeI6io5hSQ3O5sudZDuzElJZYkMufNVM7vJzg6akg6em0bL65J4lpnwIrOEZOKCnro7v0OT2SDqlf6iQhTU29RJ_pEF1FXUlYXLfdaDoxyufm5jM8T98b3LCTDm3_Dox_jUwdDvnWiANR5RwKb6h5B40hiOELzGboSMDNnBQ1v658aG8MG8ME9KpD23zphtX6VC2mTnfwmP2PpIVjOIKYsW-xC43j6iKkCMLPSWDhDgxQsICw8TIdJfYpcyIp1N1i-M-GPKp8H4k8_4KIotmV82rLw1agn8kwGtOdSB6hCDa_s=w1114-h638-no

I’ve highlighted the part that is copy/pasted. I’ll also point out again that the TrueSpeed table is also copied from the post as well.

uh-oh yousa in big doo-doo dis time, zero…