2 This file is part of Smoothie (http://smoothieware.org/). The motion control part is heavily based on Grbl (https://github.com/simen/grbl).
3 Smoothie is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
4 Smoothie is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
5 You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>.
12 #include "libs/RingBuffer.h"
13 #include "../communication/utils/Gcode.h"
16 #define acceleration_checksum 25326
17 #define max_jerk_checksum 61012
19 // TODO: Get from config
20 #define MINIMUM_PLANNER_SPEED 0.0
27 class Planner
: public Module
{
30 void append_block( int target
[], double feed_rate
, double distance
, double deltas
[] );
31 double max_allowable_speed( double acceleration
, double target_velocity
, double distance
);
32 void attach_gcode_to_queue(Gcode
* gcode
);
36 void recalculate_trapezoids();
38 Block
* get_current_block();
39 void discard_current_block();
41 void on_module_loaded();
42 void on_config_reload(void* argument
);
44 int position
[3]; // Current position, in steps
45 double previous_unit_vec
[3];
46 RingBuffer
<Block
,64> queue
; // Queue of Blocks
47 bool computing
; // Whether or not we are currently computing the queue, TODO: Checks if this is necessary
48 Block last_deleted_block
; // Item -1 in the queue, TODO: Grbl does not need this, but Smoothie won't work without it, we are probably doing something wrong
49 bool has_deleted_block
; // Flag for above value
50 float previous_nominal_speed
;
52 double acceleration
; // Setting
53 double max_jerk
; // Setting