Commit Graph

40 Commits

Author SHA1 Message Date
Sonny Jeon
567fbf93ed G54 work coordinate support (w/ G10,G92.1). Re-factored g-code parser with error checking. Minor compiler compatibility changes.
- G54 work coordinate system support. Up to 6 work coordinate systems
(G54-G59) available as a compile-time option.

- G10 command added to set work coordinate offsets from machine
position.

- G92/G92.1 position offsets and cancellation support. Properly follows
NIST standard rules with other systems.

- G53 absolute override now works correctly with new coordinate systems.

- Revamped g-code parser with robust error checking. Providing user
feedback with bad commands. Follows NIST standards.

- Planner module slightly changed to only expected position movements
in terms of machine coordinates only. This was to simplify coordinate
system handling, which is done solely by the g-code parser.

- Upon grbl system abort, machine position and work positions are
retained, while G92 offsets are reset per NIST standards.

- Compiler compatibility update for _delay_us().

- Updated README.
2012-02-11 11:59:35 -07:00
Sonny Jeon
b51e902530 Program stop support (M0,M1*,M2,M30*), proper position retainment upon reset, misc minor updates.
- Program stop support (M0,M1*,M2,M30*). *Optional stop to be done.
*Pallet shuttle not supported.

- Work position is set equal to machine position upon reset, as
according to NIST RS274-NGC guidelines. G92 is disabled.

- Renamed mc_set_current_position() to mc_set_coordinate_offset().

- Fixed bug in plan_synchronize(). Would exit right before last step is
finished and caused issues with program stops. Now fixed.

- Spindle now stops upon a run-time abort command.

- Updated readme and misc upkeeping.
2012-01-28 20:41:08 -07:00
Sonny Jeon
d27dd13a54 Fix bug with premature step end. Refactored _delay_ms() and square() for better portability.
- Fixed a premature step end bug dating back to Simen's 0.7b edge
version is fixed, from which this code is forked from. Caused by Timer2
constantly overflowing calling the Step Reset Interrupt every 128usec.
Now Timer2 is always disabled after a step end and should free up some
cycles for the main program. Could be more than one way to fix this
problem. I'm open to suggestions.

- _delay_ms() refactored to accept only constants to comply with
current compilers. square() removed since not available with some
compilers.
2012-01-15 18:25:12 -07:00
Sonny Jeon
89a3b37e02 Extended position reporting with both home and work coordinates. Home position now retained after reset. Other minor changes/fixes.
- Grbl now tracks both home and work (G92) coordinate systems and does
live updates when G92 is called.
- Rudimentary home and work position status reporting. Works but still
under major construction.
- Updated the main streaming script. Has a disabled periodic timer for
querying status reports, disabled only because the Python timer doesn't
consistently restart after the script exits. Add here only for user
testing.
- Fixed a bug to prevent an endless serial_write loop during status
reports.
- Refactored the planner variables to make it more clear what they are
and make it easier for clear them.
2012-01-10 08:34:54 -07:00
Sonny Jeon
e8a6bfd179 Position reporting, refactored system variables, serial print fixes, updated streaming scripts.
- Added machine position reporting to status queries. This will be
further developed with part positioning/offsets and maintaining
location upon reset.

- System variables refactored into a global struct for better
readability.

- Removed old obsolete Ruby streaming scripts. These were no longer
compatible. Updated Python streaming scripts.

- Fixed printFloat() and other printing functions.

- Decreased planner buffer back to 18 blocks and increased TX serial
buffer to 64 bytes. Need the memory space for future developments.

- Begun adding run-time modes to grbl, where block delete toggle, mm/in
reporting modes, jog modes, etc can be set during runtime. Will be
fleshed out and placed into EEPROM when everything is added.
2012-01-06 10:10:41 -07:00
Sonny Jeon
03e2ca7cd5 Initial v0.8 ALPHA commit. Features multi-tasking run-time command execution (feed hold, cycle start, reset, status query). Extensive re-structuring of code for future features.
- ALPHA status. - Multitasking ability with run-time command executions
for real-time control and feedback. - Decelerating feed hold and resume
during operation. - System abort/reset, which immediately kills all
movement and re-initializes grbl. - Re-structured grbl to easily allow
for new features: Status reporting, jogging, backlash compensation. (To
be completed in the following releases.) - Resized TX/RX serial buffers
(32/128 bytes) - Increased planner buffer size to 20 blocks. - Updated
documentation.
2011-12-08 18:47:48 -07:00
Sonny Jeon
9141ad2825 Third time's a charm! No more deceleration issues! Updated grbl version and settings. General cleanup.
- Fleshed out the original idea to completely remove the long slope at
the end of deceleration issue. This third time should absolutely
eliminate it.
- Changed the acceleration setting to kept as mm/min^2 internally,
since this was creating unneccessary additional computation in the
planner. Human readable value kept at mm/sec^2.
- Updated grbl version 0.7d and settings version to 4. NOTE: Please
check settings after update. These may have changed, but shouldn't.
- Before updating the new features (pause, e-stop, federate override,
etc), the edge branch will soon be merged with the master, barring any
immediate issues that people may have, and the edge branch will be the
testing ground for the new grbl version 0.8.
2011-10-11 20:51:04 -06:00
Sonny Jeon
2be0d66872 Fixed long slope at deceleration issue. Moved things into config.h. New MINIMUM_PLANNER_SPEED parameter.
- The long standing issue of a long slope at deceleration is likely
fixed. The stepper program was not tracking and timing the end of
acceleration and start of deceleration exactly and now is fixed to
start and stop on time. Also, to ensure a better acceleration curve fit
used by the planner, the stepper program delays the start of the
accelerations by a half trapezoid tick to employ the midpoint rule. -
Settings version 3 migration (not fully tested, but should work) -
Added a MINIMUM_PLANNER_SPEED user-defined parameter to planner to let
a user change this if problems arise for some reason. - Moved all
user-definable #define parameters into config.h with clear comments on
what they do and recommendations of how to change them. - Minor
housekeeping.
2011-09-24 07:46:41 -06:00
Sonny J
6de805441f Fixed minor bugs in planner. Increased max dwell time. Long slope bug stop-gap solution note.
- Fixed the planner TODO regarding minimum nominal speeds. Re-arranged
calculations to be both more efficient and guaranteed to be greater
than zero. - Missed a parenthesis location on the rate_delta
calculation. Should fix a nearly in-perceptible issue with incorrect
acceleration ramping in diagonal directions. - Increased maximum dwell
time from 6.5sec to an 18hour max. A crazy amount more, but that's how
the math works out. - Converted the internal feedrate values to mm/min
only, as it was switching between mm/min to mm/sec and back to mm/min.
Also added a feedrate > 0 check in gcode.c. - Identified the long slope
at the end of rapid de/ac-celerations noted by stephanix. Problem with
the numerical integration truncation error between the exact solution
of estimate_acceleration_distance and how grbl actually performs the
acceleration ramps discretely. Increasing the
ACCELERATION_TICKS_PER_SECOND in config.h helps fix this problem.
Investigating further.
2011-09-18 05:36:55 -06:00
Sonny J
4d03c4febc Further planner improvements and misc minor bug fixes. Memory savings and increased buffer size.
- Update grbl version and settings version to automatically reset
eeprom. FYI, this will reset your grbl settings. - Saved
3*BLOCK_BUFFER_SIZE doubles in static memory by removing obsolete
variables: speed_x, speed_y, and speed_z. - Increased buffer size
conservatively to 18 from 16. (Probably can do 20). - Removed expensive!
modulo operator from block indexing function. Reduces significant
computational overhead. - Re-organized some sqrt() calls to be more
efficient during time critical planning cases, rather than non-time
critical. - Minor bug fix in planner max junction velocity logic. -
Simplified arc logic and removed need to multiply for CW or CCW
direction.
2011-09-13 21:57:16 -06:00
Sonny J
ffcc3470a3 Optimized planner re-write. Significantly faster. Full arc support enabled by rotation matrix approach.
- Significant improvements in the planner. Removed or reordered
repetitive and expensive calculations by order of importance:
recalculating unchanged blocks, trig functions [sin(), cos(), tan()],
sqrt(), divides, and multiplications. Blocks long enough for nominal
speed to be guaranteed to be reached ignored by planner. Done by
introducing two uint8_t flags per block. Reduced computational overhead
by an order of magnitude.   - Arc motion generation completely
re-written and optimized. Now runs with acceleration planner. Removed
all but one trig function (atan2) from initialization. Streamlined
computations. Segment target locations generated by vector
transformation and small angle approximation. Arc path correction
implemented for accumulated error of approximation and single precision
calculation of Arduino. Bug fix in message passing.
2011-09-06 19:39:14 -06:00
Sonny J
d75ad82e49 Minor update for memory savings in ring buffer and fleshed out commenting.
No changes in functionality. Path vectors moved from ring buffer to
local planner static variables to save 3*(BUFFER_SIZE - 1) doubles in
memory. Detailed comments. Really need to stop micro-updating. Should be
the last until a planner optimization (ala Jens Geisler) has been
completed.
2011-09-04 18:53:25 -06:00
Sonny J
f1e5ff35ec More minor bug fixes in planner.
Reverse planner was over-writing the initial/buffer tail entry speed,
which reset the forward planner and caused it to lose track of its
speed. Should now accelerate into short linear segments much nicer now.
2011-09-04 11:19:08 -06:00
Sonny J
5e2e935bda Minor bug fixes in planner. 2011-09-03 23:22:27 -06:00
Sonny J
5c2150daa9 Significantly improved junction control and fixed computation bugs in planner
- Junction jerk now re-defined as junction_deviation. The distance from
the junction to the edge of a circle tangent to both previous and
current path lines. The circle radii is used to compute the maximum
junction velocity by centripetal acceleration. More robust and
simplified way to compute jerk.   - Fixed bugs related to entry and exit
factors. They were computed based on the current nominal speeds but not
when computing exit factors for neighboring blocks. Removed factors and
replaced with entry speeds only. Factors now only computed for stepper
trapezoid rate conversions.  - Misc: Added min(), next_block_index,
prev_block_index functions for clarity.
2011-09-03 15:31:48 -06:00
Sonny J
ed5e5d1181 Revert ea5b8942db2616e93fc0478922010c3bab7c0481^..HEAD 2011-08-15 19:37:22 -06:00
Sonny J
971e50aa9a Revert 517a0f659a06182c89cafe27ee371edccad777a4^..HEAD 2011-08-15 19:15:43 -06:00
Simen Svale Skogsrud
517a0f659a reordered a couple of functions for consistency 2011-08-02 22:44:32 +02:00
Simen Svale Skogsrud
5466bc0c33 fixed a nil dereferencing bug in planner_forward_pass_kernel thanks to jv4779 2011-07-10 21:54:03 +02:00
Simen Svale Skogsrud
804837a111 corrected an outdated comment 2011-07-09 22:35:25 +02:00
Simen Svale Skogsrud
c0b4b8309a cleaned up serial completing support for non blocking tx and refactoring formatting functions into a new module 'print' 2011-06-03 15:28:14 +02:00
Simen Svale Skogsrud
defabc80ed renamed wiring_serial to serial to reflect its complete remake 2011-05-31 22:45:38 +02:00
Simen Svale Skogsrud
f4c1cbac3c added a fix for division by zero errors that would occur on very low feed rates (thanks to Arthur Wolf for hardcore investigation) 2011-05-31 18:37:37 +02:00
Simen Svale Skogsrud
ef20be9f4c result of G92 also affects planner 2011-02-21 22:32:42 +01:00
Simen Svale Skogsrud
2c913a00bd acceleration-Grbl now works with atmega 168 by disabling arc motion 2011-02-20 22:13:31 +01:00
Simen Svale Skogsrud
d5d6298de3 added support for limit switches and homing action 2011-02-20 00:29:56 +01:00
Simen Svale Skogsrud
9c8c259153 made most internal function static to allow gcc to inline them 2011-02-19 23:03:10 +01:00
Simen Svale Skogsrud
464dcd12e8 formatting 2011-02-19 00:32:36 +01:00
Simen Svale Skogsrud
6edbbe322c lowercased boolean constants 2011-02-18 23:04:12 +01:00
Simen Svale Skogsrud
6152d16205 circle buffers now power of two size and indicies are unsigned to help gcc make a few nice optimizations 2011-02-18 21:46:18 +01:00
Simen Svale Skogsrud
124bc363bd removed inline-keywords because gcc ignores them anyway 2011-02-17 23:59:10 +01:00
Simen Svale Skogsrud
b8eee5ac9a clamped safe speed to 100% of nominal speed. Fixes a problem that might have spelled trouble at very low feed rates 2011-02-17 21:41:41 +01:00
Simen Svale Skogsrud
1ed2195e11 a new (slightly inelegant) stab at eliminating the slow tail problem 2011-02-16 22:58:53 +01:00
Simen Svale Skogsrud
c02a6e2366 possible improvement on the long, slow tail problem 2011-02-16 21:11:27 +01:00
Simen Svale Skogsrud
ff73645a14 cleanup, protected some more module variables as static 2011-02-12 00:03:58 +01:00
Simen Svale Skogsrud
bfd8cfa7dd slimmed down nuts_bolts 2011-02-11 23:53:58 +01:00
Simen Svale Skogsrud
33f014aa74 eliminated an abstraction violation where motion_control needed position information from the planner (untested) 2011-02-11 23:01:16 +01:00
Simen Svale Skogsrud
ef61efbf70 makes sure steppers cruise at exactly nominal rate to eliminate rounding errors. Possibly fixes the problem where some moves have a long tail of slow steps. (Untested) 2011-02-11 01:31:44 +01:00
Simen Svale Skogsrud
6dc81b41c9 formatting + moved current position getter to planner 2011-02-11 00:44:18 +01:00
Simen Svale Skogsrud
a4c64945e0 refactored stepper_plan -> planner (untested) 2011-02-11 00:34:53 +01:00