ClearCore Library
Loading...
Searching...
No Matches
List of all members | Classes | Public Types | Public Member Functions
ClearCore::StepGenerator Class Referenceabstract

Detailed Description

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>

+ Inheritance diagram for ClearCore::StepGenerator:

Public Types

enum  MoveTarget { MOVE_TARGET_ABSOLUTE , MOVE_TARGET_REL_END_POSN }
 

Public Member Functions

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.
 

Member Function Documentation

◆ 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

// Set the StepGenerator's maximum velocity to 15000 step pulses/sec^2
void AccelMax(uint32_t accelMax)
Sets the maximum acceleration in step pulses per second^2.
MotorDriver ConnectorM0
M-0 connector instance.
Parameters
[in]accelMaxThe 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.

// The commanded move is at the cruising velocity
}
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

// Set the StepGenerator's maximum E-stop deceleration to 15000 step pulses/sec^2
void EStopDecelMax(uint32_t decelMax)
Sets the maximum deceleration for E-stop Deceleration in step pulses per second^2....
Parameters
[in]decelMaxThe 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.
// Interrupt any on-going move and move to the absolute position 5000
ConnectorM0.Move(5000, StepGenerator::MOVE_TARGET_ABSOLUTE);
virtual bool Move(int32_t dist, MoveTarget moveTarget=MOVE_TARGET_REL_END_POSN) override
Issues a positional move for the specified distance.
Parameters
[in]distThe 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.

// Command an abrupt stop
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.

// Ramp to a stop at a decel rate of 100000 pulses/sec^2
void MoveStopDecel(uint32_t decelMax=0)
Parameters
[in]decelMaxThe 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.

// Perform a velocity move
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]velocityThe 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.

// M-0's position reference is above 5000
}
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.

// Set the StepGenerator's position reference to -5000
void PositionRefSet(int32_t posn)
Sets the absolute commanded position to the given value.
Definition StepGenerator.h:164
Parameters
[in]posnThe 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.

// No more steps are being commanded
}
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)

Sets the maximum velocity for position moves, in step pulses per second.

// Set the StepGenerator's maximum velocity to 1200 step pulses/sec
void VelMax(uint32_t velMax)
Sets the maximum velocity for position moves, in step pulses per second.
Parameters
[in]velMaxThe new velocity limit
For use with Step and Direction mode.
Examples
EncoderInputExamples/FollowEncoder/FollowEncoder.cpp, and FollowEncoder.cpp.

◆ VelocityRefCommanded()

int32_t ClearCore::StepGenerator::VelocityRefCommanded ( )

Accessor for the StepGenerator's momentary velocity.

// M-0's current velocity is above 1000
}
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: