Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Smoothie by
modules/robot/Planner.h@0:31e91bb0ef3c, 2012-07-31 (annotated)
- Committer:
- scachat
- Date:
- Tue Jul 31 21:11:18 2012 +0000
- Revision:
- 0:31e91bb0ef3c
- Child:
- 2:1df0b61d3b5a
smoothie port to mbed online compiler
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| scachat | 0:31e91bb0ef3c | 1 | /* |
| scachat | 0:31e91bb0ef3c | 2 | This file is part of Smoothie (http://smoothieware.org/). The motion control part is heavily based on Grbl (https://github.com/simen/grbl). |
| scachat | 0:31e91bb0ef3c | 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. |
| scachat | 0:31e91bb0ef3c | 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. |
| scachat | 0:31e91bb0ef3c | 5 | You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>. |
| scachat | 0:31e91bb0ef3c | 6 | */ |
| scachat | 0:31e91bb0ef3c | 7 | |
| scachat | 0:31e91bb0ef3c | 8 | #ifndef PLANNER_H |
| scachat | 0:31e91bb0ef3c | 9 | #define PLANNER_H |
| scachat | 0:31e91bb0ef3c | 10 | |
| scachat | 0:31e91bb0ef3c | 11 | #include <vector> |
| scachat | 0:31e91bb0ef3c | 12 | #include "libs/RingBuffer.h" |
| scachat | 0:31e91bb0ef3c | 13 | #include "../communication/utils/Gcode.h" |
| scachat | 0:31e91bb0ef3c | 14 | #include "Block.h" |
| scachat | 0:31e91bb0ef3c | 15 | |
| scachat | 0:31e91bb0ef3c | 16 | #define acceleration_checksum 25326 |
| scachat | 0:31e91bb0ef3c | 17 | #define max_jerk_checksum 61012 |
| scachat | 0:31e91bb0ef3c | 18 | #define junction_deviation_checksum 6035 |
| scachat | 0:31e91bb0ef3c | 19 | |
| scachat | 0:31e91bb0ef3c | 20 | // TODO: Get from config |
| scachat | 0:31e91bb0ef3c | 21 | #define MINIMUM_PLANNER_SPEED 0.0 |
| scachat | 0:31e91bb0ef3c | 22 | using namespace std; |
| scachat | 0:31e91bb0ef3c | 23 | |
| scachat | 0:31e91bb0ef3c | 24 | |
| scachat | 0:31e91bb0ef3c | 25 | class Planner : public Module { |
| scachat | 0:31e91bb0ef3c | 26 | public: |
| scachat | 0:31e91bb0ef3c | 27 | Planner(); |
| scachat | 0:31e91bb0ef3c | 28 | void append_block( int target[], double feed_rate, double distance, double deltas[] ); |
| scachat | 0:31e91bb0ef3c | 29 | double max_allowable_speed( double acceleration, double target_velocity, double distance); |
| scachat | 0:31e91bb0ef3c | 30 | void recalculate(); |
| scachat | 0:31e91bb0ef3c | 31 | void reverse_pass(); |
| scachat | 0:31e91bb0ef3c | 32 | void forward_pass(); |
| scachat | 0:31e91bb0ef3c | 33 | void recalculate_trapezoids(); |
| scachat | 0:31e91bb0ef3c | 34 | void dump_queue(); |
| scachat | 0:31e91bb0ef3c | 35 | Block* get_current_block(); |
| scachat | 0:31e91bb0ef3c | 36 | void cleanup_queue(); |
| scachat | 0:31e91bb0ef3c | 37 | virtual void on_module_loaded(); |
| scachat | 0:31e91bb0ef3c | 38 | virtual void on_config_reload(void* argument); |
| scachat | 0:31e91bb0ef3c | 39 | |
| scachat | 0:31e91bb0ef3c | 40 | int position[3]; // Current position, in steps |
| scachat | 0:31e91bb0ef3c | 41 | double previous_unit_vec[3]; |
| scachat | 0:31e91bb0ef3c | 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 |
| scachat | 0:31e91bb0ef3c | 43 | bool has_deleted_block; // Flag for above value |
| scachat | 0:31e91bb0ef3c | 44 | float previous_nominal_speed; |
| scachat | 0:31e91bb0ef3c | 45 | |
| scachat | 0:31e91bb0ef3c | 46 | double acceleration; // Setting |
| scachat | 0:31e91bb0ef3c | 47 | double max_jerk; // Setting |
| scachat | 0:31e91bb0ef3c | 48 | double junction_deviation; // Setting |
| scachat | 0:31e91bb0ef3c | 49 | |
| scachat | 0:31e91bb0ef3c | 50 | }; |
| scachat | 0:31e91bb0ef3c | 51 | |
| scachat | 0:31e91bb0ef3c | 52 | |
| scachat | 0:31e91bb0ef3c | 53 | |
| scachat | 0:31e91bb0ef3c | 54 | #endif |
