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.
grbl/motion_control.h@0:9dcf85d9b2f3, 2017-09-04 (annotated)
- Committer:
- Sergunb
- Date:
- Mon Sep 04 12:05:05 2017 +0000
- Revision:
- 0:9dcf85d9b2f3
Initial commit
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Sergunb | 0:9dcf85d9b2f3 | 1 | /* |
| Sergunb | 0:9dcf85d9b2f3 | 2 | motion_control.h - high level interface for issuing motion commands |
| Sergunb | 0:9dcf85d9b2f3 | 3 | Part of Grbl |
| Sergunb | 0:9dcf85d9b2f3 | 4 | |
| Sergunb | 0:9dcf85d9b2f3 | 5 | Copyright (c) 2011-2016 Sungeun K. Jeon for Gnea Research LLC |
| Sergunb | 0:9dcf85d9b2f3 | 6 | Copyright (c) 2009-2011 Simen Svale Skogsrud |
| Sergunb | 0:9dcf85d9b2f3 | 7 | |
| Sergunb | 0:9dcf85d9b2f3 | 8 | Grbl is free software: you can redistribute it and/or modify |
| Sergunb | 0:9dcf85d9b2f3 | 9 | it under the terms of the GNU General Public License as published by |
| Sergunb | 0:9dcf85d9b2f3 | 10 | the Free Software Foundation, either version 3 of the License, or |
| Sergunb | 0:9dcf85d9b2f3 | 11 | (at your option) any later version. |
| Sergunb | 0:9dcf85d9b2f3 | 12 | |
| Sergunb | 0:9dcf85d9b2f3 | 13 | Grbl is distributed in the hope that it will be useful, |
| Sergunb | 0:9dcf85d9b2f3 | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| Sergunb | 0:9dcf85d9b2f3 | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| Sergunb | 0:9dcf85d9b2f3 | 16 | GNU General Public License for more details. |
| Sergunb | 0:9dcf85d9b2f3 | 17 | |
| Sergunb | 0:9dcf85d9b2f3 | 18 | You should have received a copy of the GNU General Public License |
| Sergunb | 0:9dcf85d9b2f3 | 19 | along with Grbl. If not, see <http://www.gnu.org/licenses/>. |
| Sergunb | 0:9dcf85d9b2f3 | 20 | */ |
| Sergunb | 0:9dcf85d9b2f3 | 21 | |
| Sergunb | 0:9dcf85d9b2f3 | 22 | #ifndef motion_control_h |
| Sergunb | 0:9dcf85d9b2f3 | 23 | #define motion_control_h |
| Sergunb | 0:9dcf85d9b2f3 | 24 | |
| Sergunb | 0:9dcf85d9b2f3 | 25 | |
| Sergunb | 0:9dcf85d9b2f3 | 26 | // System motion commands must have a line number of zero. |
| Sergunb | 0:9dcf85d9b2f3 | 27 | #define HOMING_CYCLE_LINE_NUMBER 0 |
| Sergunb | 0:9dcf85d9b2f3 | 28 | #define PARKING_MOTION_LINE_NUMBER 0 |
| Sergunb | 0:9dcf85d9b2f3 | 29 | |
| Sergunb | 0:9dcf85d9b2f3 | 30 | #define HOMING_CYCLE_ALL 0 // Must be zero. |
| Sergunb | 0:9dcf85d9b2f3 | 31 | #define HOMING_CYCLE_X bit(X_AXIS) |
| Sergunb | 0:9dcf85d9b2f3 | 32 | #define HOMING_CYCLE_Y bit(Y_AXIS) |
| Sergunb | 0:9dcf85d9b2f3 | 33 | #define HOMING_CYCLE_Z bit(Z_AXIS) |
| Sergunb | 0:9dcf85d9b2f3 | 34 | |
| Sergunb | 0:9dcf85d9b2f3 | 35 | |
| Sergunb | 0:9dcf85d9b2f3 | 36 | // Execute linear motion in absolute millimeter coordinates. Feed rate given in millimeters/second |
| Sergunb | 0:9dcf85d9b2f3 | 37 | // unless invert_feed_rate is true. Then the feed_rate means that the motion should be completed in |
| Sergunb | 0:9dcf85d9b2f3 | 38 | // (1 minute)/feed_rate time. |
| Sergunb | 0:9dcf85d9b2f3 | 39 | void mc_line(float *target, plan_line_data_t *pl_data); |
| Sergunb | 0:9dcf85d9b2f3 | 40 | |
| Sergunb | 0:9dcf85d9b2f3 | 41 | // Execute an arc in offset mode format. position == current xyz, target == target xyz, |
| Sergunb | 0:9dcf85d9b2f3 | 42 | // offset == offset from current xyz, axis_XXX defines circle plane in tool space, axis_linear is |
| Sergunb | 0:9dcf85d9b2f3 | 43 | // the direction of helical travel, radius == circle radius, is_clockwise_arc boolean. Used |
| Sergunb | 0:9dcf85d9b2f3 | 44 | // for vector transformation direction. |
| Sergunb | 0:9dcf85d9b2f3 | 45 | void mc_arc(float *target, plan_line_data_t *pl_data, float *position, float *offset, float radius, |
| Sergunb | 0:9dcf85d9b2f3 | 46 | uint8_t axis_0, uint8_t axis_1, uint8_t axis_linear, uint8_t is_clockwise_arc); |
| Sergunb | 0:9dcf85d9b2f3 | 47 | |
| Sergunb | 0:9dcf85d9b2f3 | 48 | // Dwell for a specific number of seconds |
| Sergunb | 0:9dcf85d9b2f3 | 49 | void mc_dwell(float seconds); |
| Sergunb | 0:9dcf85d9b2f3 | 50 | |
| Sergunb | 0:9dcf85d9b2f3 | 51 | // Perform homing cycle to locate machine zero. Requires limit switches. |
| Sergunb | 0:9dcf85d9b2f3 | 52 | void mc_homing_cycle(uint8_t cycle_mask); |
| Sergunb | 0:9dcf85d9b2f3 | 53 | |
| Sergunb | 0:9dcf85d9b2f3 | 54 | // Perform tool length probe cycle. Requires probe switch. |
| Sergunb | 0:9dcf85d9b2f3 | 55 | uint8_t mc_probe_cycle(float *target, plan_line_data_t *pl_data, uint8_t parser_flags); |
| Sergunb | 0:9dcf85d9b2f3 | 56 | |
| Sergunb | 0:9dcf85d9b2f3 | 57 | // Handles updating the override control state. |
| Sergunb | 0:9dcf85d9b2f3 | 58 | void mc_override_ctrl_update(uint8_t override_state); |
| Sergunb | 0:9dcf85d9b2f3 | 59 | |
| Sergunb | 0:9dcf85d9b2f3 | 60 | // Plans and executes the single special motion case for parking. Independent of main planner buffer. |
| Sergunb | 0:9dcf85d9b2f3 | 61 | void mc_parking_motion(float *parking_target, plan_line_data_t *pl_data); |
| Sergunb | 0:9dcf85d9b2f3 | 62 | |
| Sergunb | 0:9dcf85d9b2f3 | 63 | // Performs system reset. If in motion state, kills all motion and sets system alarm. |
| Sergunb | 0:9dcf85d9b2f3 | 64 | void mc_reset(); |
| Sergunb | 0:9dcf85d9b2f3 | 65 | |
| Sergunb | 0:9dcf85d9b2f3 | 66 | #endif |