mycnc:gantry_alignment_macro_wizard
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
mycnc:gantry_alignment_macro_wizard [2018/08/25 13:26] – skirillov | mycnc:gantry_alignment_macro_wizard [2019/10/24 14:49] – ivan | ||
---|---|---|---|
Line 1: | Line 1: | ||
===== Gantry Alignment ===== | ===== Gantry Alignment ===== | ||
- | Gantry Alignment macro wizard helps to generate macro for dual motor gantry alignment. There can be several methods for gantry alignment. Almost any of method can be implemented by (advanced) user through macro/PLC layer. We can offer 2 methods for gantry alignment. | + | Gantry Alignment macro wizard helps to generate |
==== Method 1 ==== | ==== Method 1 ==== | ||
- | 2 sensors on each side of gantry used to find side position. The alignment procedure is described below- | + | 2 sensors on each side of the gantry |
- | - CNC activates motors on both sides and moves toward | + | - CNC activates motors on both sides and moves towards |
- | - When one of the sensors is triggered, CNC control disconnects motor on this side, the 2nd motor continues to move. \\ {{mycnc: | + | - When one of the sensors is triggered, CNC control disconnects |
- | - When both sensors are triggered, motion | + | - When both sensors are triggered, |
- | - In case of sensors, | + | - It is important to note that the sensors do not have to be perfectly aligned on the same line - they can be placed wherever it is convenient, provided that the offset |
- Both motors are activated and move together. \\ {{mycnc: | - Both motors are activated and move together. \\ {{mycnc: | ||
- | - The machine moves out from the sensors for given distance. {{mycnc: | + | - The machine moves out from the sensors for a predefined |
- | To generate this kind of alignment macro can be used the wizard. See below a screenshot of the Gantry Alignment Wizard | + | To generate this kind of alignment, the alignment macro will be generated by the Macro Wizard. See below the screenshot of the Gantry Alignment Wizard |
{{mycnc: | {{mycnc: | ||
- | On the screen we have | + | On this screen, we have: |
- **Axis, Direction** - Macro is generated for Y axis | - **Axis, Direction** - Macro is generated for Y axis | ||
- While alignment machine moves toward Y-MIN | - While alignment machine moves toward Y-MIN | ||
- **Sensor numbers** - sensor #0, #1 are used as sensors on each side of gantry, both senors are " | - **Sensor numbers** - sensor #0, #1 are used as sensors on each side of gantry, both senors are " | ||
- **Use Encoder Z signals for align** - not used | - **Use Encoder Z signals for align** - not used | ||
- | - **Ignore Limits while align** - If sensors #0 or #1 is used as limit sensor, then Limits should be ignored (put check-box) while alignment to prevent | + | - **Ignore Limits while align** - If sensors #0 or #1 is used as limit sensor, then Limits should be ignored (set the check mark to ON) during the alignment |
- **Align while move** - Forward | - **Align while move** - Forward | ||
- **Final tuning (Motor #1 offset)** - set distance to adjust sensors | - **Final tuning (Motor #1 offset)** - set distance to adjust sensors | ||
- **Double check** (to be described later) | - **Double check** (to be described later) | ||
- **Move distance** Distance expected from start position to alignment sensors. This distance should be set a more than real distance to alignment sensors. | - **Move distance** Distance expected from start position to alignment sensors. This distance should be set a more than real distance to alignment sensors. | ||
- | - **Gap** - move out from the sensors for given distance. | + | - **Gap** - move out from the sensors for a given distance. |
- | - **Speed** - speed for motion toward the sensors | + | - **Speed** - speed for the motion toward the sensors |
- | - **Slow Speed** - not used for "Align while move: | + | - **Slow Speed** - not used for "Align while move: |
- | - **Reset work position after align** | + | - **Reset work position after align** |
- | - **Macro filename** - File name to ave macro source to file. | + | - **Macro filename** - File name to save the macro source to file. |
To generate and save macro (As usual for the Macro wizard) 3 buttons should be pressed | To generate and save macro (As usual for the Macro wizard) 3 buttons should be pressed | ||
- | - **Save** (top-right corner - to save macro wizard settings and use them for future macro generate | + | - **Save** (top-right corner - to save macro wizard settings and use them for future macro generation) |
- | - **Generate** - to generate macro source and show it in "Macro preview" | + | - **Generate** - to generate macro source and show it in "Macro preview" |
- | - **Save Macro** - save macro from **Macro preview** for the macro file with the name given in **Macro filename**, then reload all macros to CNC memory. | + | - **Save Macro** - save macro from the **Macro preview** for the macro file with the name given in **Macro filename**, then reload all macros to CNC memory. |
- | Gantry Alignment procedure either can work simultaneously as a homing procedure (if the alignment sensor is used as a homing sensor as well), or Homing procedure can be run just after gantry alignment procedure. | + | Gantry Alignment procedure either can work simultaneously as a homing procedure (if the alignment sensor is used as a homing sensor as well), or, alternatively, |
==== Method 2 ==== | ==== Method 2 ==== | ||
- | 2 sensors on each side of gantry used to find each side positions. When both sensors actual positions found, CNC control moves the only side to get the gantry aligned. | + | 2 sensors on each side of gantry |
The alignment procedure is described below- | The alignment procedure is described below- | ||
- CNC activates motors on both sides and moves toward the sensors. \\ {{mycnc: | - CNC activates motors on both sides and moves toward the sensors. \\ {{mycnc: | ||
- | - PLC controoler | + | - PLC controller |
- | - Motion stopped at the moment both sensors are triggered. \\ {{mycnc: | + | - Motion |
- | - PLC procedure calculates the difference between | + | - PLC procedure calculates the difference between |
- | - The second motor control temporarily disabled, the first motor only is rotated accordingly calculated adjustment | + | - The second motor control |
- | - Then the second | + | - Then, after the alignment has completed |
- | That's the plan. How to implement it? Here is step-by-step implementation description. | + | That's the plan, but how do we implement it? Here is a step-by-step implementation description. |
- | * CNC activates motors on both sides and moves toward the sensors. \\ Actually | + | * CNC activates motors on both sides and moves toward the sensors. \\ NOTE: While both motors for the gantry |
<code C M219.plc> | <code C M219.plc> | ||
Line 82: | Line 82: | ||
</ | </ | ||
- | * PLC controller procedure | + | * PLC controller procedure |
<code C M144.plc> | <code C M144.plc> | ||
Line 91: | Line 91: | ||
// Position X is stored in register #802 when sensor s2 triggered | // Position X is stored in register #802 when sensor s2 triggered | ||
// If both sensors triggered, then | // If both sensors triggered, then | ||
- | // - Motion stopped | + | // - Motion |
- | // - Position difference is calculated and stored | + | // - Position difference is calculated and stored |
main() | main() | ||
Line 119: | Line 119: | ||
if (mode1==0)// | if (mode1==0)// | ||
{ | { | ||
- | if (s1!=s1_old) //if triggered now | + | if (s1!=s1_old) //if the sensor is triggered now |
{ | { | ||
| | ||
Line 130: | Line 130: | ||
if (mode2==0)// | if (mode2==0)// | ||
{ | { | ||
- | if (s2!=s2_old) //if triggered now | + | if (s2!=s2_old) //if the sensor is triggered now |
{ | { | ||
| | ||
Line 155: | Line 155: | ||
</ | </ | ||
- | The M144.plc procedure uses predefined values as the input pin numbers the alignment sensors connected to | + | The M144.plc procedure uses predefined values as the input pin numbers |
<code C > | <code C > | ||
#include pins.h | #include pins.h | ||
Line 177: | Line 177: | ||
</ | </ | ||
- | Actual input numbers should be defined in define file " | + | Actual input numbers should be defined in the " |
<code C pins.h> | <code C pins.h> | ||
Line 189: | Line 189: | ||
</ | </ | ||
- | You can put numbers directly | + | You can also put numbers directly |
<code C > | <code C > | ||
... | ... | ||
Line 204: | Line 204: | ||
</ | </ | ||
+ | * Motion is stoppped at the moment that both sensors are triggered. This is implemented in the M144.plc procedure. | ||
- | + | The PLC sends message to the Motion controller to end the current motion and jump to the next line of the G-code. | |
- | * Motion stopped at the moment both sensors are triggered. This is implemented in the M144.plc | + | |
- | + | ||
- | PLC sends message to the Motion controller to end the current motion and jump to the next g-code line | + | |
< | < | ||
| | ||
</ | </ | ||
- | * PLC procedure calculates the difference between | + | * PLC procedure calculates the difference between |
< | < | ||
Line 226: | Line 224: | ||
</ | </ | ||
- | * The second motor control temporarily disabled, the first motor only is rotated accordingly calculated adjustment. | + | * The second motor control |
Connect/ | Connect/ | ||
Line 254: | Line 252: | ||
As a result, | As a result, | ||
- | * Code to disconnect motor output#1 is **M210 P0** | + | * Code to disconnect |
- | * Code to connect motor output#1 to axis X is **M210 P1** | + | * Code to connect |
- | * Then the second motor control is activated again and both motors moved together. \\ G-code G28.9 can be used to move axis accordingly | + | * Then the second motor control is activated again and both motors moved together. \\ G-code G28.9 can be used to move the axis according to the register value. \\ < |
- | + | A complete macro for Method #2 of the gantry alignment | |
- | + | ||
- | + | ||
- | A complete macro to gantry alignment (Method #2) is shown below | + | |
<code awk M139> | <code awk M139> | ||
M144 (# Set watching for GANTRY Sensors) | M144 (# Set watching for GANTRY Sensors) | ||
Line 290: | Line 285: | ||
==== Method 2+ ==== | ==== Method 2+ ==== | ||
- | What should be changed if Gantry alignment procedure | + | What should be changed if the Gantry alignment procedure |
- | 1) Let's say Motor outputs #0 and #1 configured as Y. | + | 1) Let's say Motor outputs #0 and #1 are configured as Y. |
{{mycnc: | {{mycnc: | ||
- | 2) Procedure to connect both outputs to Y axis will look as | + | 2) Procedure to connect both outputs to Y axis will look the following: |
<code C M219.plc> | <code C M219.plc> | ||
Line 324: | Line 319: | ||
- | 3) Need to change PLC procedure that looks after sensors to store Y position instead of X. | + | 3) We need to change |
Change procedure name to M145.plc | Change procedure name to M145.plc | ||
Line 332: | Line 327: | ||
// Look after INPUT_GANTRY_S1 & INPUT_GANTRY_S2 input pins | // Look after INPUT_GANTRY_S1 & INPUT_GANTRY_S2 input pins | ||
- | // Position Y is stored in register #801 when sensor s1 triggered | + | // Position Y is stored in register #801 when sensor s1 is triggered |
- | // Position Y is stored in register #802 when sensor s2 triggered | + | // Position Y is stored in register #802 when sensor s2 is triggered |
// If both sensors triggered, then | // If both sensors triggered, then | ||
// - Motion stopped | // - Motion stopped | ||
Line 400: | Line 395: | ||
- | 4) Fix disable motor PLC procedure. Change procedure name to M211 (instead of M210) | + | 4) We need to fix the PLC procedure |
<code C M211.plc> | <code C M211.plc> | ||
Line 430: | Line 425: | ||
G91 G0 Y-1000 F500 (# Move toward Gantry Sensors) | G91 G0 Y-1000 F500 (# Move toward Gantry Sensors) | ||
- | ( It takes a time PLC controller | + | ( There is message delivery |
- | ( updated register | + | ( Need to wait some time till registers |
- | ( Add 0.5 seconds pause to get all the registers | + | ( Add 0.5 seconds pause to get all the registers |
G4 P0.5 (# Pause) | G4 P0.5 (# Pause) |
mycnc/gantry_alignment_macro_wizard.txt · Last modified: 2020/01/31 14:24 by ivan