yarf 0.1
Yet Another RepRap Firmware
Functions
src/movement/planner.h File Reference

The planner component translates movement g-code commands into blocks that represent a linear movement and places these blocks into a queue of blocks to be executed by the block handler component. More...

#include "yarf.h"
#include "block.h"
#include <stdbool.h>

Go to the source code of this file.

Functions

void plan_init (void)
 Initializes the planner component.
steps_t plan_get_virtual_position (unsigned char axis)
 Returns the virtual position in number of steps from the origin for the specified axis.
void plan_set_virtual_position_rel (steps_t x, steps_t y, steps_t z, steps_t e)
 Sets the virtual position of all axes.
void plan_set_virtual_position_abs (steps_t x, steps_t y, steps_t z, steps_t e)
 Sets the virtual position of all axes.
void plan_calculate_trapezoid (block_t *b, speed_t entry_speed, speed_t exit_speed)
 Sets a number of block parameters in order to have the block accelerate from a given entry speed at the start of the block and to have it decelerate to a given exit speed at the end of it.
void plan_linear_movement_rel (steps_t steps_x, steps_t steps_y, steps_t steps_z, steps_t steps_e, speed_t plateau_speed)
 Adds a movement from the current virtual position to the specified position at the specified feed rate to the end of the planning queue.
void plan_linear_movement_abs (steps_t dest_x, steps_t dest_y, steps_t dest_z, steps_t dest_e, speed_t plateau_speed)
 Adds a movement from the current virtual position to the specified position at the specified feed rate to the end of the planning queue.
void plan_home_axes (bool x, bool y, bool z)
 Homes the specified axes.

Detailed Description

The planner component translates movement g-code commands into blocks that represent a linear movement and places these blocks into a queue of blocks to be executed by the block handler component.

Author:
Pieter Agten (pieter.agten@gmail.com)
Date:
23 sep 2011

Definition in file planner.h.


Function Documentation

void plan_calculate_trapezoid ( block_t b,
speed_t  entry_speed,
speed_t  exit_speed 
)

Sets a number of block parameters in order to have the block accelerate from a given entry speed at the start of the block and to have it decelerate to a given exit speed at the end of it.

These parameters are used by the block handler during execution of the block.

Parameters:
ba pointer to the block for which to calculate the parameters
entry_speedthe entry speed of the block in mm/min
exit_speedthe exit speed of the block in mm/min

Definition at line 431 of file planner.c.

steps_t plan_get_virtual_position ( unsigned char  axis)

Returns the virtual position in number of steps from the origin for the specified axis.

The virtual position is the position the printer will be at when all pending blocks in the planning queue have been executed.

Parameters:
axisthe axis for which to get the virtual position. Valid values are X_AXIS, Y_AXIS, Z_AXIS and E_AXIS.
Returns:
The virtual position in number of steps for the specified axis.

Definition at line 406 of file planner.c.

void plan_home_axes ( bool  x,
bool  y,
bool  z 
)

Homes the specified axes.

Homing an axis means moving it in the negative direction until it reaches its min endstop.

Parameters:
xboolean indicating whether or not to home the x axis
yboolean indicating whether or not to home the y axis
zboolean indicating whether or not to home the z axis

Definition at line 505 of file planner.c.

void plan_linear_movement_abs ( steps_t  dest_x,
steps_t  dest_y,
steps_t  dest_z,
steps_t  dest_e,
speed_t  plateau_speed 
)

Adds a movement from the current virtual position to the specified position at the specified feed rate to the end of the planning queue.

The position arguments are interpreted as absolute positions in numbers of steps from the origin.

Parameters:
dest_xthe destination position of the x axis, in steps from the origin, must be within the bounds of the axis
dest_ythe destination position of the y axis, in steps from the origin, must be within the bounds of the axis
dest_zthe destination position of the z axis, in steps from the origin, must be within the bounds of the axis
dest_ethe destination position of the e axis, in steps from the origin
plateau_speedmaximum speed of the block in mm/min

If any of the X, Y or Z axes is not homed when calling this movement, that axis is homed before making the movement.

If any of the destination parameters is out of bounds, the movement is not added to the planning queue (it is silently dropped).

If the lookahead component is enabled, it is called immediately after adding the new block to the queue, in order to optimize the block's entry speed and to reduce the jerkiness of the transitions between blocks. The machine's virtual position is updated to the position it will be in after this movement has been executed.

Definition at line 491 of file planner.c.

void plan_linear_movement_rel ( steps_t  steps_x,
steps_t  steps_y,
steps_t  steps_z,
steps_t  steps_e,
speed_t  plateau_speed 
)

Adds a movement from the current virtual position to the specified position at the specified feed rate to the end of the planning queue.

The position arguments are interpreted as offsets in numbers of steps from the current virtual position.

Parameters:
steps_xthe number of steps to take in the x direction (can be negative), must not make the machine go out of bounds
steps_ythe number of steps to take in the y direction (can be negative), must not make the machine go out of bounds
steps_zthe number of steps to take in the z direction (can be negative), must not make the machine go out of bounds
steps_ethe number of steps to take in the e direction (can be negative)
plateau_speedmaximum speed of the block in mm/min

If any of the X, Y or Z axes is not homed when calling this movement, that axis is homed before making the movement.

If any of the destination parameters would cause the machine to go out of bounds, the movement is not added to the planning queue (it is silently dropped).

If the lookahead component is enabled, it is called immediately after adding the new block to the queue, in order to optimize the block's entry speed and to reduce the jerkiness of the transitions between blocks. The machine's virtual position is updated to the position it will be in after this movement has been executed.

Definition at line 468 of file planner.c.

void plan_set_virtual_position_abs ( steps_t  x,
steps_t  y,
steps_t  z,
steps_t  e 
)

Sets the virtual position of all axes.

The arguments are interpreted as absolute positions in numbers of steps from the origin.

Parameters:
xthe new virtual x position in number of steps
ythe new virtual x position in number of steps
zthe new virtual x position in number of steps
ethe new virtual x position in number of steps

Definition at line 421 of file planner.c.

void plan_set_virtual_position_rel ( steps_t  x,
steps_t  y,
steps_t  z,
steps_t  e 
)

Sets the virtual position of all axes.

The arguments are interpreted as offsets in numbers of steps relative to the current virtual position.

Parameters:
xthe number of steps to add to the virtual x position
ythe number of steps to add to the virtual y position
zthe number of steps to add to the virtual z position
ethe number of steps to add to the virtual e position

Definition at line 412 of file planner.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines