Understanding Acceleration and Deceleration Values

Spread the love

Acceleration and deceleration values set how quickly a RoboClaw ramps between commanded values instead of changing instantly. Duty commands measure them in duty units per second, where a value of 32768 equals 100% duty per second, while speed commands measure them in encoder counts per second squared. This guide explains both systems and the conversions between raw values, percentages, and time.

Acceleration and deceleration values appear throughout Motion Studio and the software libraries: in the Motors pane defaults, in the control sliders on the settings screens, and as arguments to many packet serial commands. This guide looks at what the values mean, how to calculate them, and the important difference between the values used by duty commands and the values used by speed commands.

How Do Motor Controllers Manage Acceleration and Deceleration?

When a motor controller receives a new command, it does not have to apply the change instantly. An acceleration value tells the controller how quickly to ramp from the current output to the commanded one, and a deceleration value does the same when slowing down. Ramping reduces mechanical stress on the drivetrain, limits the current spikes that come from sudden changes, and reduces the regenerative voltage produced when a motor decelerates. A command that includes its own acceleration or deceleration argument uses that value; commands without one use the defaults stored on the controller.

Duty Command Acceleration Values

Duty cycle commands drive the motor open loop, without encoder feedback. The duty value is signed, with a range of -32768 to +32767 representing -100% to +100% power. The acceleration value for these commands is the rate at which the duty changes per second, which makes the scale easy to reason about: a value of 32768 changes the duty by 100% in one second. The value can be thought of in three ways: as the raw value entered in commands, as a percentage, and as a time.

Convert a raw value to a percentage:
percentage = ( raw value / 32768 ) x 100

Convert a percentage to a raw value:
raw value = ( percentage / 100 ) x 32768

Time to change the duty by 100%:
time (seconds) = 32768 / raw value

Raw value for a given time:
raw value = 32768 / time (seconds)

For example, the maximum acceleration value for duty commands is 655359:

time = 32768 / 655359
time = 0.05 seconds per 100% duty

At the maximum value the duty can sweep its full range, from -100% to +100%, in about 100 milliseconds, which is how the RoboClaw user manual describes the limit.

Speed Command Acceleration Values

Speed commands use encoder feedback, and their acceleration values use different units entirely: encoder counts per second, per second, usually written as QPPS per second. The acceleration is the amount the speed increases each second. An acceleration of 12,000 QPPS with a commanded speed of 12,000 QPPS accelerates the motor from a stop to full speed in one second; an acceleration of 24,000 QPPS with the same speed command gets there in half a second. The time to reach a new speed is the change in speed divided by the acceleration value:

time (seconds) = speed change (QPPS) / acceleration value

Because every motor and encoder combination generates pulses at its own rate, the right acceleration values depend on the measured maximum QPPS of the system. In the control screens, an acceleration value of 0 uses the stored default.

Setting the Defaults in Motion Studio

The default acceleration and deceleration values live in the Motors pane of the General Settings screen; the default fields are outlined in Figure 1. The “Default Accel (%)” and “Default Decel (%)” fields set the defaults as percentages for RC, Analog, and packet serial commands, and the “Default Speed (%)” field sets the maximum speed of position movements for commands that have no speed argument. Commands that include their own acceleration or deceleration arguments override these defaults. The pane is covered setting by setting in General Settings in Motion Studio.

The General Settings screen in BasicMicro Motion Studio with the default speed, acceleration, and deceleration fields outlined in the Motors pane

Figure 1: The default speed, acceleration, and deceleration fields, outlined in the Motors pane of the General Settings screen.

Next Steps

Velocity Settings in Motion Studio covers the velocity PID settings that speed commands rely on, Auto Tuning with Motion Studio walks through measuring QPPS and tuning the PID values, and PID Control and Motor Controllers explains the control loop behind it all.