Here's a very simple approach if you do not need high accuracy or precision:
simulate this circuit – Schematic created using CircuitLab
R1 acts as a "voltage to current converter", and the op-amp provides the necessary bias to M1 to make sure the voltage across R1 equals Vin.
Since the gate current through M1, and the input bias current to U1 are negligible, all the current flowing through the load (your motor controller, in this case) must also flow through R1. So you can use Ohm's law to convert between voltage at Vin and current through the load.
With R1 = 100 ohms, you need Vin from 0.4 to 2 volts. You might get that from a DAC output or by low pass filtering a PWM digital output.
You will need an op-amp that will function with a common-mode input voltage as low as 0.4V. A common TL072 for example does not meet these requirements, but a modern rail-to-rail type like OPA342 does. Alternately you can connect the negative supply of U1 to a negative voltage.
Be mindful of the load resistance, which should be specified by your motor controller. You must be sure V2 is high enough such that the combined voltage drop across the load, M1, and R1 aren't greater than V2 at 20mA.