cmdMO_RMPCFGIndex

Command Code:

The Packet:

Description:

This command is only available on BrainStem modules with the motion control feature.

The cmdMO_RMPCFG command is used to set or retrieve ramp control parameters.  If no parameter data is included in the packet, a reply packet is sent reporting the current value for the requested parameter.

The ramp feature provides a capability for performing motions with a trapezoidal velocity profile.  The ramp motion is defined with the range to travel, maximum velocity, acceleration step time, and some control flags.  The velocity and range must have the same sign.  To reverse a ramp motion, both the range and maximum velocity must be negated.  NOTE: The trapezoidal ramp feature may only be used with mode 7 (ENCVEL or velocity from encoder input) motion control.

The ramp feature also provides a velocity damping mode.  In this mode, changes in the velocity setting take place gradually.  The MAXV parameter is the velocity setting.  The acceleration step time controls the rate at which the velocity changes from the old MAXV setting to the new MAXV setting.  The RANGE parameters are unused in velocity damping mode.  Once activated, velocity damping stays in effect until the control flags are changed or the ramp is disabled with the cmdMO_RMPENA command.  NOTE: The velocity damping feature may only be used with mode 6 (A2DVEL) or mode 7 (ENCVEL) motion control*.

* Change introduced in Moto 1.0 Firmware Build 8

The velocity damping feature may also be used with mode 4 (A2DPOS) or mode 5 (ENCPOS) motion control.  When using these modes, this feature applies new position setpoints instead of new velocity setpoints.

Parameters:

NOTE:

The feature associated with Bit 4 was added in Moto 1.0 Firmware Build 5.

Velocity Damping

Velocity damping makes changes in the velocity take place one unit at a time.  The acceleration step time determines how quickly the velocity changes.  For example, if the current MAXV is 30 and a new MAXV of 50 is entered, the velocity will step through 20 increments (31, 32, 33, etc.) until it reaches 50.  If the ACCDT parameter is 20ms, it will take 0.4 seconds for the velocity to reach its new setting.  This feature is useful when rapid changes in velocity might cause undesirable effects, such as excessive current surges or physical instability (robot flipping over).

Trapezoidal Ramp

A trapezoidal ramp increases motor velocity at a constant acceleration rate, then holds the velocity at a maximum setting, then decreases the velocity at the same acceleration rate to bring the motor to a stop.  This makes the position vary smoothly over time.  Since the acceleration is known, it is possible to determine the moment when to start slowing down in order to reach a desired position.

The Moto board ramp algorithm records the distance traveled when the maximum velocity is obtained.  This is the deceleration offset distance.  When that much distance remains until the target range is met, the ramp algorithm begins the deceleration phase of the motion.  If the ramp motion reaches the halfway point before reaching the maximum velocity, the deceleration phase begins immediately.

NOTE:

For best results, the ramp accleration step time parameter, ACCDT, should be significantly larger than the PID period.  As a rule-of-thumb, try an ACCDT parameter of at least 10 times the PID period.  This gives the PID loop several iterations to settle at a velocity before the ramp algorithm assigns a new setpoint.

Ramp Error and Nudge

The ramp motion will have some error because of the implementation of the ramp algorithm.  The speed will not be truly linear during the acceleration phase.  This will introduce some error in the deceleration offset distance.  When cruising at the maximum velocity, the distance traveled is sampled every millisecond so it is not possible to start decelerating at the exact moment when the deceleration offset distance is reached.  Furthermore, the speed will not be truly linear during the deceleration phase.  The end result of all these errors is usually a small undershoot when trying to travel a desired range with a ramp motion.  When the "nudge" feature is enabled, it can greatly reduce this error.  Since the nudge is performed at minimum velocity, a ramp motion with nudge may take a significant amount of extra time.

Trapezoidal Ramp Synchronization

In a two-wheel drive robot, both wheels must change speeds at the same time in order to go straight or perform a rotation.  In the Moto 1.0 module, setting the synchronization bit for both channels forces the wheels to change speeds at the same time.  Setting the bit for only one channel has no effect.  When synchronizing ramp motions, the absolute values of the maximum velocity settings and absolute values for the range settings for both channels must be identical.  When the signs are the same, the robot will go straight forward or backward.  When the signs differ, the robot will perform a rotation.  The acceleration step times must also be the same.  If these conditions do not apply, synchronizing ramp motions will have unexpected results.

There may still be some error in the distances traveled by both motors when using ramp synchronization.  The ramp synchronization algorithm only affects the velocity setpoints.  Actual velocities for each motor will always differ slightly.  The ramp synchronization only ensures that the motor velocity settings will change at the same time.

Ramp Reflex

A trapezoidal ramp motion can trigger a reflex when it finishes.  If the nudge feature is enabled, the reflex is issued after the nudge finishes.  If the nudge is not enabled, the reflex is issued after the deceleration stage of the motion is completed.

The main use for the ramp reflex is to allow a TEA program to perform an automatic delay until a ramp motion is finished.  A TEA program can start a ramp motion then wait for its semaphore to be written.  If the ramp reflex writes to the semaphore, then the TEA program will continue.  When controlling synchronized ramps, both ramp motions will finish at nearly the same time.  In this case, it is sufficient to enable the ramp reflex for only one channel.  Then the single reflex will indicate when the dual ramp motions are done.


version: 1.0, build n.a.
© Copyright 1994-2012 Acroname, Inc., Boulder, Colorado.  All rights reserved.