Commit | Line | Data |
---|---|---|
df27a6a3 | 1 | /* |
4cff3ded AW |
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. | |
df27a6a3 | 5 | You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>. |
4cff3ded AW |
6 | */ |
7 | ||
8 | #ifndef PLANNER_H | |
9 | #define PLANNER_H | |
10 | ||
11 | #include <vector> | |
12 | #include "libs/RingBuffer.h" | |
13 | #include "../communication/utils/Gcode.h" | |
14 | #include "Block.h" | |
15 | ||
d4f93cf4 AG |
16 | #define acceleration_checksum CHECKSUM("acceleration") |
17 | #define max_jerk_checksum CHECKSUM("max_jerk") | |
18 | #define junction_deviation_checksum CHECKSUM("junction_deviation") | |
4cff3ded | 19 | |
7b49793d | 20 | // TODO: Get from config |
aab6cbba | 21 | #define MINIMUM_PLANNER_SPEED 0.0 |
4cff3ded AW |
22 | using namespace std; |
23 | ||
aab6cbba | 24 | |
4cff3ded AW |
25 | class Planner : public Module { |
26 | public: | |
27 | Planner(); | |
aab6cbba AW |
28 | void append_block( int target[], double feed_rate, double distance, double deltas[] ); |
29 | double max_allowable_speed( double acceleration, double target_velocity, double distance); | |
4cff3ded AW |
30 | void recalculate(); |
31 | void reverse_pass(); | |
32 | void forward_pass(); | |
33 | void recalculate_trapezoids(); | |
34 | void dump_queue(); | |
df27a6a3 | 35 | Block* get_current_block(); |
4cff3ded AW |
36 | void cleanup_queue(); |
37 | void on_module_loaded(); | |
da24d6ae | 38 | void on_config_reload(void* argument); |
4cff3ded AW |
39 | |
40 | int position[3]; // Current position, in steps | |
aab6cbba | 41 | double previous_unit_vec[3]; |
7b49793d | 42 | 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 |
4cff3ded | 43 | bool has_deleted_block; // Flag for above value |
aab6cbba | 44 | float previous_nominal_speed; |
4cff3ded AW |
45 | |
46 | double acceleration; // Setting | |
47 | double max_jerk; // Setting | |
2bb8b390 | 48 | double junction_deviation; // Setting |
4cff3ded AW |
49 | |
50 | }; | |
51 | ||
52 | ||
53 | ||
54 | #endif |