# POSITION_CONTROL vs VELOCITY_CONTROL

I want to use the highest speed of the motor below to displace a pulley 600 mm in 0.042 secs
AMT102 V CPR = 2048*4 = 8192
4250-410 kv Turnigy Brushless motor 7790 RPM
Odrive 24v 3.4
UPS 24v 13A
Brake Resistance 0.47 ohmn
Control Mode Position Control

Calibrated and Configured- Error Free- with default settings.

According to instructions, the velocity limit is counts/s.

The motor does 125 Rev in one second: (7790/60)
In one second, the total CPR counts in 125 rev are 1024000 (8192 CPR *125 Rev).
So, is OK to determine my highest speed as 1024000/1 sec

On the other hand, the motor has a 30 teeth GT2 pulley attached to it.
So, Diameter = (2 mm * 30)/Pi = 19.09859317

Circumferece = 2Pi* Radius = 60 mm, which is the distance traveled by the pulley in one revolution.
Now, we multiply this number 60 mm * 7790 RPM to find out how much the pulley can travel in 7790 RPM;(467400 mm)
If we divide 467400 mm in 60 seconds, we can calculate the distance traveled in one second. 7790 mm/sec
Finally, if I want the pulley to travel 600 mm in 0.042 seconds and knowing that for every second I need 1024000 CPR, my speed parameter is 43008?

Do the numbers above make sense at all?

The motor is in Mode Position Control. The motor runs an infinite loop jumping from position 0 and then jumping to position 40960. This move should be accomplished in 0.042 seconds. Should I leave the Mode Position Control and teak the speed or should I set the CONTROL_MODE_VELOCITY_CONTROL to accomplish the task?

Thanks very much

Can you expand a bit more what you are trying to do? Is the 600 mm a belt travel and you are controlling something like a 3d printer?

Are you trying to continuously rotate the motor at your desired speed? Thatâ€™s velocity control, for example cruise control in a car or spindle speed control on a CNC.

Are you trying to move the motor from a stationary position, rotate the motor to a new position, and then hold that new position? If so thatâ€™s position mode, which I think is what you are after. To do this, the motor has to do a few things. It has to accelerate the motor and whatever load you are driving, then go along at maximum speed, then decelerate the motor and load to zero velocity at the end of travel.

To do that the position loop drives the speed loop which drive the current loop which is actually feeding the motor commutation/phase currents. These control loops gains as well as your system (voltage, motor parameters, motor inertia, gear ratio, driven mass) determine the response you get - how quickly can you move from point A to point B. You can add various levels of complexity and model it all and predict your performance, or you can build it and test/tune to see what is attainable. Your calculation assumes the motor will move at maximum speed for the whole duration of the move, which is physically impossible because the motor canâ€™t attain infinite acceleration. This is a reasonable assumption for low speed/long distances where the motor will be moving at constant speed for most of the move. This is a bad assumption for very short periods of time, and for moves that are dominated by acceleration.

Hope that helps!

1 Like

If you are wanting to go to 40960 then 0, then 40960, then 0, etc then position mode is what youâ€™ll want to use. Are the timings youâ€™ve mentioned merely calculations of what you expect, or are they requirements that must be met?

The duration that a given position change takes isnâ€™t simply calculated by speed and distance (and, conversely, the speed isnâ€™t calculated by duration and distance, etc). There are control loops at play and configurable gains that change the rate of acceleration and the likes.