ClearCore Step and Direction generator class.
This class manages the generation and communication of movement profiles for the MotorDriver connectors.
For more detailed information on the ClearCore Motor Control and Motion Generation systems, check out the Motor Control System and Step and Direction Control informational pages.
ClearCore Step and Direction generator class.
More...
#include <StepGenerator.h>
|
enum | MoveTarget { MOVE_TARGET_ABSOLUTE
, MOVE_TARGET_REL_END_POSN
} |
|
|
virtual bool | Move (int32_t dist, MoveTarget moveTarget=MOVE_TARGET_REL_END_POSN) |
| Issues a positional move for the specified distance.
|
|
virtual bool | MoveVelocity (int32_t velocity) |
| Issues a velocity move at the specified velocity.
|
|
void | MoveStopAbrupt () |
|
void | MoveStopDecel (uint32_t decelMax=0) |
|
void | PositionRefSet (int32_t posn) |
| Sets the absolute commanded position to the given value.
|
|
volatile const int32_t & | PositionRefCommanded () |
| Accessor for the StepGenerator's position reference.
|
|
int32_t | VelocityRefCommanded () |
| Accessor for the StepGenerator's momentary velocity.
|
|
void | VelMax (uint32_t velMax) |
| Sets the maximum velocity for position moves, in step pulses per second.
|
|
void | AccelMax (uint32_t accelMax) |
| Sets the maximum acceleration in step pulses per second^2.
|
|
void | EStopDecelMax (uint32_t decelMax) |
| Sets the maximum deceleration for E-stop Deceleration in step pulses per second^2. This is only for MoveStopDecel.
|
|
bool | StepsComplete () |
| Function to check if no steps are currently being commanded to the motor.
|
|
bool | CruiseVelocityReached () |
| Function to check if the commanded move is at the cruising velocity - Acceleration portion of movement has finished.
|
|
◆ AccelMax()
void ClearCore::StepGenerator::AccelMax |
( |
uint32_t |
accelMax | ) |
|
Sets the maximum acceleration in step pulses per second^2.
Value will be clipped if out of bounds
void AccelMax(uint32_t accelMax)
Sets the maximum acceleration in step pulses per second^2.
MotorDriver ConnectorM0
M-0 connector instance.
- Parameters
-
[in] | accelMax | The new acceleration limit |
For use with Step and Direction mode.
- Examples
- EncoderInputExamples/FollowEncoder/FollowEncoder.cpp, and FollowEncoder.cpp.
◆ CruiseVelocityReached()
bool ClearCore::StepGenerator::CruiseVelocityReached |
( |
| ) |
|
|
inline |
Function to check if the commanded move is at the cruising velocity - Acceleration portion of movement has finished.
}
bool CruiseVelocityReached()
Function to check if the commanded move is at the cruising velocity - Acceleration portion of movemen...
Definition StepGenerator.h:285
- Returns
- Returns true if there the move is in the cruise state
- Note
- The motor will still need to decelerate after cruising
For use with Step and Direction mode.
◆ EStopDecelMax()
void ClearCore::StepGenerator::EStopDecelMax |
( |
uint32_t |
decelMax | ) |
|
Sets the maximum deceleration for E-stop Deceleration in step pulses per second^2. This is only for MoveStopDecel.
Value will be clipped if out of bounds
void EStopDecelMax(uint32_t decelMax)
Sets the maximum deceleration for E-stop Deceleration in step pulses per second^2....
- Parameters
-
[in] | decelMax | The new e-stop deceleration limit |
For use with Step and Direction mode.
◆ Move()
virtual bool ClearCore::StepGenerator::Move |
( |
int32_t |
dist, |
|
|
MoveTarget |
moveTarget = MOVE_TARGET_REL_END_POSN |
|
) |
| |
|
virtual |
Issues a positional move for the specified distance.
- Note
- When making absolute moves, ClearCore tracks the current position based on the zero position at program-start. If there is a move in progress when a new move is issued, the target position will be adjusted according to the moveTarget parameter, the new acceleration and velocity limits will be applied, and the new move is merged seamlessly with the previous motion. If you want to make sure that the previous move fully completes without being merged with a new command, wait for StepsComplete() to return true.
virtual bool Move(int32_t dist, MoveTarget moveTarget=MOVE_TARGET_REL_END_POSN) override
Issues a positional move for the specified distance.
- Parameters
-
[in] | dist | The distance of the move in step pulses |
[in] | moveTarget | (optional) Specify the type of movement that should be done. Absolute or relative to the end position of the current move. Invalid will result in move relative to the end position. Default: MOVE_TARGET_REL_END_POSN |
For use with Step and Direction mode.
Reimplemented in ClearCore::MotorDriver.
◆ MoveStopAbrupt()
void ClearCore::StepGenerator::MoveStopAbrupt |
( |
| ) |
|
Interrupts the current move; the motor may stop abruptly.
For use with Step and Direction mode.
◆ MoveStopDecel()
void ClearCore::StepGenerator::MoveStopDecel |
( |
uint32_t |
decelMax = 0 | ) |
|
Interrupts any current move and commands the motor to stop. The stopping acceleration used will be the higher of either
- 1) the move's current acceleration rate, or
- 2) the value of EStopDecelMax.
This function's decelMax parameter can be used to update the EStopDecelMax value used for stopping.
void MoveStopDecel(uint32_t decelMax=0)
- Parameters
-
[in] | decelMax | The new EStop deceleration rate to set instead of the value that was set prior to issuing the move. Passing 0 maintains the EStopDecelMax that was previously set. |
For use with Step and Direction mode.
◆ MoveVelocity()
virtual bool ClearCore::StepGenerator::MoveVelocity |
( |
int32_t |
velocity | ) |
|
|
virtual |
Issues a velocity move at the specified velocity.
virtual bool MoveVelocity(int32_t velocity) override
Issues a velocity move at the specified velocity.
- Note
- Any existing move will be immediately overwritten with the new velocity.
- Parameters
-
[in] | velocity | The velocity of the move in step pulses/second. |
For use with Step and Direction mode.
Reimplemented in ClearCore::MotorDriver.
◆ PositionRefCommanded()
volatile const int32_t & ClearCore::StepGenerator::PositionRefCommanded |
( |
| ) |
|
|
inline |
Accessor for the StepGenerator's position reference.
}
volatile const int32_t & PositionRefCommanded()
Accessor for the StepGenerator's position reference.
Definition StepGenerator.h:182
- Returns
- Returns the absolute commanded position.
For use with Step and Direction mode.
◆ PositionRefSet()
void ClearCore::StepGenerator::PositionRefSet |
( |
int32_t |
posn | ) |
|
|
inline |
Sets the absolute commanded position to the given value.
void PositionRefSet(int32_t posn)
Sets the absolute commanded position to the given value.
Definition StepGenerator.h:164
- Parameters
-
[in] | posn | The new position to be set. |
For use with Step and Direction mode.
◆ StepsComplete()
bool ClearCore::StepGenerator::StepsComplete |
( |
| ) |
|
|
inline |
Function to check if no steps are currently being commanded to the motor.
}
bool StepsComplete()
Function to check if no steps are currently being commanded to the motor.
Definition StepGenerator.h:265
- Returns
- Returns true if there is no valid current command.
- Note
- The motor may still be moving after steps are done being sent.
For use with Step and Direction mode.
◆ VelMax()
void ClearCore::StepGenerator::VelMax |
( |
uint32_t |
velMax | ) |
|
◆ VelocityRefCommanded()
int32_t ClearCore::StepGenerator::VelocityRefCommanded |
( |
| ) |
|
Accessor for the StepGenerator's momentary velocity.
}
int32_t VelocityRefCommanded()
Accessor for the StepGenerator's momentary velocity.
- Returns
- Returns the momentary commanded velocity.
For use with Step and Direction mode.
The documentation for this class was generated from the following file: