V5 Motor Position, Velocity, and Acceleration functions

Does anyone have any data on the V5 motor’s position, velocity, and acceleration functions?
Is there a model of the motor’s pos, vel, and acel?
Do V5 motors have constant acceleration or does it fluctuate when going from 0 to 100 pct?
Is the position function of the V5 motor concave down, up, both, does it have an inflection point?

I want to find the optimal method of acceleration that reduces the sudden jerk on the robot when there is a sudden jump in acceleration or deceleration.

2 Likes

@prathusa, that is a good question.

In general, acceleration depends on the mass of the robot (that will resist acceleration) and the force (torque) produced by the motors which, in turn, is proportional to the electric current going through the motors.

They are linked by the Newton’s Law “F=ma” or its angular equivalent “τ=Iα”

Then you can define differential equation for the forces acting on the robot.

There was a thread several years ago describing all this in details, but after forum migrated to a new platform it, unfortunately, lost a lot of its formatting and readability. Here is a couple of equations recovered from that thread:

There are equal but opposite forces acting on the robot. Torque out of the motors is trying to accelerate robot, while various friction forces (Frrf), mass of the robot, and moment of inertia of the drivetrain are resisting.

“τdrive” is torque out of the motors at wheel axles,
“Vpwm” is the voltage applied to the motors,
“n” is the number of motors,

“m” is the mass of the robot,
“F” is the force of resistance of the robot to acceleration (due to its mass),

“Idt” is the moment of inertia of the drivetrain components,
“Fdt” is the force of resistance of drivetrain components to acceleration,
“τdt” is its torque equivalent at the wheel axles,

“ω” is angular velocity of the wheel axles,
“a” is linear acceleration of the robot and
“α” is angular acceleration of drivetrain that is related to acceleration as
“a=αrw”, where “rw” is the radius of the wheels.

“C??” are various constant coefficients associated with the motors, drivetrain, and other parameters of the robot and could be determined experimentally.

For example, you can say “Frrf=Crrfm” assuming that friction force is proportional to the mass of the robot times some coefficient Crrf, that somehow reflects everything on the robot that affects friction: number of axles in the drivetrain, gear ratios, gear materials, coefficients for dynamic and rolling resistance friction, … As far as we are concerned, if you don’t change the design of the drivetrain, it is some constant coefficient times total robot mass, that could change if robot carries additional game objects.

If anyone wants more details, I could dig them up from the original thread and external references.

Resulting graph for velocity and position (as an exponential function of time) will look like this:

Cf is the coefficient which describes the friction losses in the drivetrain of the robot.

Cp is the coefficient which describes how voltage commanded to the motors translates into idle velocity.

Ct is the coefficient describing the ratio between acceleration resistance due to the robot mass + drivetrain moment of inertia and total power available from the motors.

The larger Ct is - the slower the robot will accelerate.

These are general formulas that are applicable to any electric motor. The shape of the curves for V5 may be affected by the firmware control algorithms that limit max current and power going to the motors.

However, if V5 motors are operating below firmware limits, then you can expect their curves to be described by the graph above.

6 Likes

I was wondering, in the real world, how we can control the motor’s acceleration as well. (in VEXCode)

Searching the threads the best I saw (most linked to old forum) was a simple loop like:

motor.speed = 0
do while present.motor.speed < desired.motor.speed
motor.setSpeed(motor.speed )
motor.speed = motor.speed +1
wait(10,ms)

I’m sure my syntax is lacking but hope you got the idea. While this sounds simple-enough for accelerating, not quite sure how to decelerate…

Here’s hoping our expert programmers chime in (like our illustrious @jpearman ?)

Good luck all!

One way would be to limit the current available to the motor, which would limit F in the A = F/M equation, thus limiting A (acceleration). The main issue is that this would be difficult to translate to a proper m/(sec)^2 acceleration value.

1 Like

For constant deceleration I figured you can start from your max speed initialMotorSpeed and do -1*(iteration) + initialMotorSpeed;, giving your velocity line a negative slope. Here’s an example:

motor.spin(fwd, initialMotorSpeed, pct);
while (initialMotorSpeed > 0)
{
  motor.setSpeed(--initialMotorSpeed);
  wait(10, ms);
}
motor.stop();

Keep in mind that this uses time rather than the more accurate unit of measurement, rotations, for duration of deceleration.

Thanks - this is much better than what I was working on!

Would this be possible to run concurrent accel / decel ramps on left and right motors?

In my mind it turns into a very nasty & impractical nested-while loop…

maybe @sazrocks is onto something with setTorque() as well…

sigh

Got to say, VEX did a great job w/V5