aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/cartesian.py
Commit message (Collapse)AuthorAgeFilesLines
* stepper: Separate out homing code to its own PrinterHomingStepper classKevin O'Connor2017-07-241-1/+1
| | | | | | | Keep the homing code separate from the main stepper class. This makes it easier to verify the correct config parameters are provided. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Support minimum/maximum value checks on configuration variablesKevin O'Connor2017-04-111-2/+4
| | | | | | | Verify that numeric parameters are in a sane range when reading the config. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepcompress: Merge stepcompress_push_accel() and stepcompress_push_const()Kevin O'Connor2017-04-071-3/+4
| | | | | | | | It's not necessary to have separate C functions for constant acceleration and constant velocity as constant velocity can be obtained by using a constant acceleration of zero. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Change mcu_stepper.set_position() to take a location in millimetersKevin O'Connor2017-04-071-3/+2
| | | | | | | | | | Update the set_position() method to convert from millimeters to absolute step position. Also, update PrinterStepper.get_homed_offset() and mcu_stepper.get_commanded_position() to return millimeters. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Pass constant velocity and acceleration directly to mcu_stepperKevin O'Connor2017-04-071-30/+16
| | | | | | | | Rename step_sqrt/step_factor to step_accel/step_const and have them directly take the velocity and acceleration in millimeters and seconds. This simplifies the kinematic classes. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* klippy: Eliminate high-level build_config phaseKevin O'Connor2017-03-131-3/+0
| | | | | | | | | | Now that the mcu objects can be created prior to connecting to the mcu, it is no longer necessary to separate the init and build_config phases in the high-level code. Move the mcu objection creation from the build_config phase to the init phase and eliminate the build_config phase. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* extruder: Calculate sane defaults for extrude only velocity and accelKevin O'Connor2017-01-031-1/+1
| | | | | | | | Instead of requiring the user enter velocity and accel parameters for extrude only moves, calculate sane defaults from the printer's maximum velocity and accel. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Rework homing to use greenletsKevin O'Connor2016-12-091-11/+7
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gcode: Rework endstop query to use greenletsKevin O'Connor2016-12-091-2/+3
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* cartesian: Make it clear which methods of CartKinematics are internalKevin O'Connor2016-12-081-7/+7
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Specify maximum acceleration and velocity in toolhead classKevin O'Connor2016-12-011-13/+9
| | | | | | | | | | Change the config file so the maximum accel and velocity are specified in the "printer" section instead of the individual "stepper" sections. The underlying code limits the velocity and accel of the toolhead relative to the print object, so it makes sense to configure the system that was as well. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: Check homing distance to verify endstop trigger after retractKevin O'Connor2016-11-281-1/+2
| | | | | | | | | Instead of checking the endstop trigger directly after a retract move, verify some distance is traveled during the following homing operation. This reduces the amount of synchronization between mcu and host during homing. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Store the stepper position in the mcu_stepper classKevin O'Connor2016-11-191-10/+5
| | | | | | | Move the storage of the stepper location from the kinematic classes to the low-level mcu_stepper class. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: Verify the endstops are no longer triggered after retract moveKevin O'Connor2016-11-181-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: Add EndstopMoveError wrapper around EndstopErrorKevin O'Connor2016-11-181-2/+3
| | | | | | | | Allow an EndstopError to be raised without a destination position. Introduce EndstopMoveError wrapper so that current callers can continue to pass in a move destination. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: Direct stepper phase detection from kinematic classesKevin O'Connor2016-11-181-3/+7
| | | | | | | | Change the scheduling of the final homed position (which takes into account the stepper phases) so that it is scheduled from the kinematic classes instead of from the toolhead class. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: Create Homing class from gcodeKevin O'Connor2016-11-181-4/+2
| | | | | | | | Create the Homing class in the gcode handler instead of in the kinematic classes. This will make it easier to pass error messages back to the user. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: Create QueryEndstops class from gcodeKevin O'Connor2016-11-181-5/+5
| | | | | | | | | | | Create the QueryEndstops in the gcode handler instead of in the kinematic classes. This simplifies the gcode handler as it can directly register its response callback. Also, store the stepper name in the stepper class. Also, propagate the print_time of the query request to the mcu_endstop class. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Check if the motor needs to be enabled in the kinematic classesKevin O'Connor2016-11-141-4/+16
| | | | | | | Check for motor enable in the kinematic classes so it doesn't need to be checked on every move. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepcompress: Do all step rounding in C codeKevin O'Connor2016-11-131-34/+36
| | | | | | | | | | | | | | | | | Commits f0cefebf and 8f331f08 changed the way the code determined what steps to take on fractional steps. Unfortunately, it was possible in some situations for the C code to round differently from the python code which could result in warnings and lost steps. Change the code so that all fractional step handling is done in the C code. Implementing the step rounding logic in one location avoids any conflicts. In order to efficiently handle the step rounding in the C code, the C code has also been extended to directly send the "set_next_step_dir" command. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Default to a high direction pin meaning positive directionKevin O'Connor2016-11-081-2/+2
| | | | | | | | | Invert the default meaning of the stepper direction pin. Instead of treating a low value as position motion, treat a high value as positive motion. This matches what other firmwares do, and it matches what common stepper motor drivers document. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* cartesian.py: Determine start step offset using last commanded positionKevin O'Connor2016-10-311-5/+7
| | | | | | | | | | | | The existing code calculates the number of steps in a move and then spreads them out evenly throughout that move. Change the code so that step timing is based on where the head is commanded to be relative to the axis step locations. This makes the timing more accurate - in particular the axis velocities will be more accurate during cornering introduced by the lookahead code. It also results in slightly smoother stepper motion which results in better step compression. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* cartesian: Rename step_dist to move_step_dKevin O'Connor2016-10-311-3/+3
| | | | | | | | Don't use step_dist for the "distance along the line of movement per step" as it's too similar to the stepper.step_dist variable. Use the name "move_step_d" instead. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Store both the start and end position in the Move classKevin O'Connor2016-10-251-6/+8
| | | | | | | | Store the start position (in addition to the existing end position) in the Move class. The start position can be useful to the kinematic classes. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Return homing offset in steps instead of an absolute positionKevin O'Connor2016-10-131-1/+2
| | | | | | | | | | Rename get_homed_position() to get_homed_offset() and return the endstop position delta in steps instead of an absolute position relative to position_endstop. The conversion to absolute positions can be dependent on the type of kinematics in use, so is inappropriate to do in the low level stepper.py code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* cartesian: Enforce endstop min and max boundariesKevin O'Connor2016-09-301-0/+17
| | | | | | | Verify that each move command is within range of the configured minimum and maximum for each axis. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Allow kinematics class to verify the move prior to queuing itKevin O'Connor2016-09-301-8/+13
| | | | | | | | | | | | Introduce a check_move() method in the extruder and cartesian kinematic classes. This allows the lower level classes to verify the contents of the move prior to queing that move. The speed and acceleration handling for special Z and extrude only moves are also moved from the generic toolhead class to the low-level classes. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: Support querying the current status of endstopsKevin O'Connor2016-09-221-0/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* cartesian: Minor change to clarify end stop homing direction codeKevin O'Connor2016-09-151-2/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: convert stepper, endstop, and digital_out to take mcu_timeKevin O'Connor2016-08-241-13/+12
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Support stepper phase adjustments when homingKevin O'Connor2016-07-281-0/+2
| | | | | | | Add support for enhancing the precision of endstop switches by also inspecting the phase of the stepper motor when the endstop triggers. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* homing: Move low-level coordinate manipulation to kinematic classKevin O'Connor2016-07-251-4/+27
| | | | | | | Rework the code so that the kinematic class (currently just cartesian.py) has more control over the homing process. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Have caller calculate max jerk velocityKevin O'Connor2016-07-221-0/+2
| | | | | | | | | | Allow the owner of the stepper object to cacluate the maximum step jerk velocity. This is used to ensure there is no communication error between mcu and host. Disable checking of jerk velocity for extruder stepper motors. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* extruder: Create a new class and python file to track the printer extruderKevin O'Connor2016-07-101-6/+3
| | | | | | | | | Create a new python file (extruder.py) to control the extruder heater and stepper motors. This separates the extruder control logic from the cartesian robot code - making it easier to customize both the kinematic control of the robot as well as the extruder. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Store max_velocity/max_accel instead of max_step_velocity/accelKevin O'Connor2016-07-101-13/+7
| | | | | | | | All users of max_step_velocity and max_step_accel end up multiplying by step_dist anyway, so it's easier to store max_velocity and max_accel. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* toolhead: Split toolhead code from cartesian.py to new file toolhead.pyKevin O'Connor2016-07-101-195/+3
| | | | | | Separate out the toolhead logic to its own python file. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* cartesian: Separate out cartesian robot handling from ToolHead classKevin O'Connor2016-07-101-90/+112
| | | | | | | Separate out the low-level stepper motor kinematics handling from the ToolHead class into its own class. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* cartesian: Rename CartKinematics class to ToolHeadKevin O'Connor2016-07-101-13/+13
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* cartesian: Do acceleration and lookahead on requested coordinatesKevin O'Connor2016-07-101-51/+64
| | | | | | | | | Perform all acceleration calculations and lookahead checks in millimeters using the cartesian coordinate system of the request. The conversion to step coordinates is now done at the time of the step timing creation. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Initial commit of source code.Kevin O'Connor2016-05-251-0/+252
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>