Go to the source code of this file.
Data Structures | |
struct | plan_block_t |
This struct stores a linear movement of a g-code block motion with its critical "nominal" values. More... | |
struct | plan_line_data_t |
Planner data prototype. Must be used when passing new motions to the planner. More... | |
Functions | |
void | plan_reset () |
Initialize and reset the motion plan subsystem. More... | |
void | plan_reset_buffer () |
Reset buffer only. More... | |
uint8_t | plan_buffer_line (float *target, plan_line_data_t *pl_data) |
Add a new linear movement to the buffer. target[N_AXIS] is the signed, absolute target position. More... | |
void | plan_discard_current_block () |
Called when the current block is no longer needed. Discards the block and makes the memory. More... | |
plan_block_t * | plan_get_system_motion_block () |
Gets the planner block for the special system motion cases. (Parking/Homing) More... | |
plan_block_t * | plan_get_current_block () |
Gets the current block. Returns NULL if buffer empty. More... | |
uint8_t | plan_next_block_index (uint8_t block_index) |
Called periodically by step segment buffer. Mostly used internally by planner. More... | |
float | plan_get_exec_block_exit_speed_sqr () |
Called by step segment buffer when computing executing block velocity profile. More... | |
float | plan_compute_profile_nominal_speed (plan_block_t *block) |
Called by main program during planner calculations and step segment buffer during initialization. More... | |
void | plan_update_velocity_profile_parameters () |
Re-calculates buffered motions profile parameters upon a motion-based override change. More... | |
void | plan_sync_position () |
Reset the planner position vector (in steps) More... | |
void | plan_cycle_reinitialize () |
Reinitialize plan with a partially completed block. More... | |
uint8_t | plan_get_block_buffer_available () |
Returns the number of available blocks are in the planner buffer. More... | |
uint8_t | plan_get_block_buffer_count () |
Returns the number of active blocks are in the planner buffer. More... | |
uint8_t | plan_check_full_buffer () |
Returns the status of the block ring buffer. True, if buffer is full. More... | |
void | plan_get_planner_mpos (float *target) |
struct plan_block_t |
This struct stores a linear movement of a g-code block motion with its critical "nominal" values.
Data Fields | ||
---|---|---|
float | acceleration | Axis-limit adjusted line acceleration in (mm/min^2). Does not change. |
uint8_t | condition | Block bitflag variable defining block run conditions. Copied from pl_line_data. |
uint8_t | direction_bits | The direction bit set for this block (refers to *_DIRECTION_BIT in config.h) |
float | entry_speed_sqr | The current planned entry speed at block junction in (mm/min)^2. |
int32_t | line_number | Block line number for real-time reporting. Copied from pl_line_data. |
float | max_entry_speed_sqr | Maximum allowable entry speed based on the minimum of junction limit and. |
float | max_junction_speed_sqr |
NOTE: This value may be altered by stepper algorithm during execution. Junction entry speed limit based on direction vectors in (mm/min)^2 |
float | millimeters | The remaining distance for this block to be executed in (mm). |
float | programmed_rate | Programmed rate of this block (mm/min). |
float | rapid_rate | Axis-limit adjusted maximum rate for this block direction in (mm/min) |
float | spindle_speed | Block spindle speed. Copied from pl_line_data. |
uint32_t | step_event_count | The maximum step axis count and number of steps required to complete this block. |
uint32_t | steps[N_AXIS] |
NOTE: Used by stepper algorithm to execute the block correctly. Do not alter these values. Step count along each axis |
struct plan_line_data_t |
Planner data prototype. Must be used when passing new motions to the planner.
#define BLOCK_BUFFER_SIZE 36 |
#define PL_COND_ACCESSORY_MASK (PL_COND_FLAG_SPINDLE_CW|PL_COND_FLAG_SPINDLE_CCW|PL_COND_FLAG_COOLANT_FLOOD|PL_COND_FLAG_COOLANT_MIST) |
#define PL_COND_FLAG_INVERSE_TIME bit(3) |
#define PL_COND_FLAG_NO_FEED_OVERRIDE bit(2) |
#define PL_COND_FLAG_RAPID_MOTION bit(0) |
#define PL_COND_FLAG_SYSTEM_MOTION bit(1) |
#define PL_COND_MOTION_MASK (PL_COND_FLAG_RAPID_MOTION|PL_COND_FLAG_SYSTEM_MOTION|PL_COND_FLAG_NO_FEED_OVERRIDE) |
uint8_t plan_buffer_line | ( | float * | target, |
plan_line_data_t * | pl_data | ||
) |
Add a new linear movement to the buffer. target[N_AXIS] is the signed, absolute target position.
Add a new linear movement to the buffer. target[N_AXIS] is the signed, absolute target position.
/ NOTE: Assumes buffer is available. Buffer checks are handled at a higher level by motion_control. In other words, the buffer head is never equal to the buffer tail. Also the feed rate input value is used in three ways: as a normal feed rate if invert_feed_rate is false, as inverse time if invert_feed_rate is true, or as seek/rapids rate if the feed_rate value is negative (and invert_feed_rate always false). The system motion condition tells the planner to plan a motion in the always unused block buffer head. It avoids changing the planner state and preserves the buffer to ensure subsequent gcode motions are still planned correctly, while the stepper module only points to the block buffer head to execute the special system motion.
< Zero all block values.
NOTE: Computes true distance from converted step values.
< Store unit vector numerator
NOTE: This calculation assumes all axes are orthogonal (Cartesian) and works with ABC-axes,
< Starting from rest. Enforce start from zero velocity.
NOTE: If the junction deviation value is finite, Grbl executes the motions in an exact path
NOTE: The max junction speed is a fixed value, since machine acceleration limits cannot be
NOTE: Computed without any expensive trig, sin() or acos(), by trig half angle identity of cos(theta).
< Trig half angle identity. Always positive.
< pl.previous_unit_vec[] = unit_vec[]
< pl.position[] = target_steps[]
uint8_t plan_check_full_buffer | ( | ) |
float plan_compute_profile_nominal_speed | ( | plan_block_t * | block | ) |
Called by main program during planner calculations and step segment buffer during initialization.
Called by main program during planner calculations and step segment buffer during initialization.
NOTE: All system motion commands, such as homing/parking, are not subject to overrides.
void plan_cycle_reinitialize | ( | ) |
void plan_discard_current_block | ( | ) |
uint8_t plan_get_block_buffer_available | ( | ) |
uint8_t plan_get_block_buffer_count | ( | ) |
plan_block_t* plan_get_current_block | ( | ) |
float plan_get_exec_block_exit_speed_sqr | ( | ) |
void plan_get_planner_mpos | ( | float * | target | ) |
plan_block_t* plan_get_system_motion_block | ( | ) |
uint8_t plan_next_block_index | ( | uint8_t | block_index | ) |
void plan_reset | ( | ) |
void plan_reset_buffer | ( | ) |
void plan_sync_position | ( | ) |