yarf 0.1
Yet Another RepRap Firmware
Data Fields
block_t Struct Reference

Data structure which represents a straight line to be printed. More...

#include <block.h>

Data Fields

unsigned int id
 Unique number to identify this block.
uint32_t nb_steps
 Total number of linear steps to take to execute this block.
uint32_t nb_steps_completed
 Number of linear steps of this block that have been executed so far.
steps_t steps [NUM_AXES]
 Total number of stepper motor steps to take for each axis.
void(* collision_handler )(uint8_t)
 Pointer to a function which will be called if one of the end stop switches is hit while executing this block.
fxp16u16_t timer_ticks
 The number of timer ticks to wait in between linear steps.
fxp16u16_t plateau_timer_ticks
 The number of timer ticks to wait in between linear steps when the block execution is at its plateau (its maximum speed).
fxp16u16_t exit_timer_ticks
 The number of timer ticks to wait in between linear steps at the end of the block execution (at the end of deceleration).
uint16_t acceleration_step
 Indicates the current position on the linear acceleration ramp which starts at speed 0 and linearly accelerates according to a constant acceleration.
uint16_t acceleration_end
 Linear step number at which to stop accelerating.
uint32_t deceleration_start
 Linear step number at which to start decelerating.
float distance_mm
 Distance in millimeters of the movement represented by this block.
float mm_ticks_per_step_min
 Average distance in millimeters traveled by each linear step, multiplied by the RTTIMER_TICKS_PER_MIN constant.
float direction [NUM_AXES]
 Four-dimensional unit direction vector (containing the direction cosines for each axis) of the movement represented by this block.
speed_t plateau_speed
 The speed in mm/min when the block execution is at its plateau (its maximum speed).
speed_t entry_speed
 Entry speed in mm/min at the start of the block execution (at the start of acceleration).
speed_t max_entry_speed
 Entry speed in mm/min at the end of the block execution (at the end of deceleration).
bool plateau_speed_always_reachable
 Flag set and used by the lookahead component, indicating whether this block is long enough to be able to reach its plateau speed for sure.
bool recalculate
 Flag set and used by the lookahead component, to indicate that the entry_speed field of this block was changed and that the timer and acceleration fields need to be updated accordingly.

Detailed Description

Data structure which represents a straight line to be printed.

The planner component creates blocks based on g-code commands sent by the host. These block are placed into a queue, which is read in a different thread by the block handler component. The block handler is component that actually executes blocks.

A block's speed vs time plot is always shaped like a trapezoid:

             speed ^
                   |
   plateau speed --|---> +--------+
                   |    /          \                                
     entry speed --|-> +            \                               
                   |   |             + <-- exit speed = next block's
                   |   +-------------+                  entry speed
                   |______________________
                                 time --> 

The acceleration and deceleration segments always have the same slope magnitude, as configured by the ACCELERATION configuration value.

Definition at line 64 of file block.h.


Field Documentation

Linear step number at which to stop accelerating.

Definition at line 77 of file block.h.

Indicates the current position on the linear acceleration ramp which starts at speed 0 and linearly accelerates according to a constant acceleration.

Definition at line 76 of file block.h.

void(* block_t::collision_handler)(uint8_t)

Pointer to a function which will be called if one of the end stop switches is hit while executing this block.

Definition at line 71 of file block.h.

Linear step number at which to start decelerating.

Definition at line 78 of file block.h.

float block_t::direction[NUM_AXES]

Four-dimensional unit direction vector (containing the direction cosines for each axis) of the movement represented by this block.

Definition at line 84 of file block.h.

Distance in millimeters of the movement represented by this block.

Definition at line 82 of file block.h.

Entry speed in mm/min at the start of the block execution (at the start of acceleration).

Used by the planner and lookahead components to calculate the ticks and acceleration variables above.

Definition at line 88 of file block.h.

The number of timer ticks to wait in between linear steps at the end of the block execution (at the end of deceleration).

This value is needed to prevent glitches while decelerating due to numerical round-off errors.

Definition at line 75 of file block.h.

unsigned int block_t::id

Unique number to identify this block.

Used for debugging purposes.

Definition at line 65 of file block.h.

Entry speed in mm/min at the end of the block execution (at the end of deceleration).

Used by the planner and lookahead components to calculate the ticks and acceleration variables above.

Definition at line 89 of file block.h.

Average distance in millimeters traveled by each linear step, multiplied by the RTTIMER_TICKS_PER_MIN constant.

Definition at line 83 of file block.h.

Total number of linear steps to take to execute this block.

Each linear step consists of a single step of one or several stepper motors.

Definition at line 68 of file block.h.

Number of linear steps of this block that have been executed so far.

Definition at line 69 of file block.h.

The speed in mm/min when the block execution is at its plateau (its maximum speed).

Definition at line 85 of file block.h.

Flag set and used by the lookahead component, indicating whether this block is long enough to be able to reach its plateau speed for sure.

Definition at line 91 of file block.h.

The number of timer ticks to wait in between linear steps when the block execution is at its plateau (its maximum speed).

Definition at line 74 of file block.h.

Flag set and used by the lookahead component, to indicate that the entry_speed field of this block was changed and that the timer and acceleration fields need to be updated accordingly.

Definition at line 92 of file block.h.

Total number of stepper motor steps to take for each axis.

Definition at line 70 of file block.h.

The number of timer ticks to wait in between linear steps.

This field changes during acceleration and deceleration while executing the block.

Definition at line 73 of file block.h.


The documentation for this struct was generated from the following file:
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines