Hi Craig,
What I am trying to do is utilize the "Hardstop Detection" feature in the servos instead of homing switches by creating my own "Reference All" command (whether it be a function, script, etc.). The standard RefAll function does not work as it tries to detect the "All Systems Go" (ASG) command right away and sees it is true (because the motor is in a "ready state" when sitting idle). What I need is the motors to start moving first then start looking for the ASG signal.
In most other cases I agree that this would be doomed to fail. However, the Hardstop Detection function of the Clearpath Servos has some key features that allow this to occur and not "Crash". When the motor has Hardstop Detection initiated, it operates at a user set torque limit to avoid damaging the machine(eg.15%). Then the motor is can be commanded to move and "gently" find the hardstop. Once it does this, it runs an algorithm to "qualify" that it has indeed found the hardstop. Then it ignores any further "move" commands, in the homing direction, and sets the ASG signal high. Once the Jog commands have ceased the motor disables Hardstop Detection and goes to a full run state (accepting further move commands and using 100% torque).
In the motors homing settings, you set:
- The maximum torque when homing (I have it set to 15%)
- this is the torque used to "hold" against the hardstop until it is commanded to move away by the user
- Whether homing is initiated on every enable or only the first enable after power-up
- I have it set to initiate on every enable
- Direction and speed for homing
My intended process flow is something like this,
1. Press onscreen button to start "homing sequence"
- X, Y, and Z motors are all disabled in the button script and register1 is set to a value ("1")
2. The PLC Script
2.1 - IF statement when register1 equals "1" AND register2 equals "0"
2.1.1- Enables the Z motor (initiating hardstop detection)
- Want to home Z first, then X and Y
2.1.2 - Sends a Jog Velocity command to Z motor towards hardstop
- Z starts jogging home
2.1.3 - timer0 is then initiated after 500ms that then sets register2 to a value of "1"
- This is needed to allow the motor to change states and "drop" the ASG signal
2.2 - IF statement when register1, register2, and the Z-ASG signal are all "1"
2.2.1 - stop the Jog Velocity command
2.2.2 - Start a Jog Inc command to move the axis off the hardstop by a specific distance
2.2.3 - Stop the Jog Inc command
. 2.2.4 - Set register1 to "2" and register2 to "0"
2.2.5 - Home the axis in place
2.3 - Sees register1 change to "2" and repeats steps 2.1-2.2.4 for the X axis, then set register1 to "3"
2.3.1 - For step 2.1 & 2.2, register2 would be "2"
2.3.2 - For step 2.1.3, timer1 would be called and set register2 to "2"
2.4 - Sees register1 change to "3" and repeats steps 2.1-2.2.4 for the Y axis, then sets register1 to "4"
2.4.1 - For step 2.1 & 2.2, register2 would be "3"
2.4.2 - For step 2.1.3, timer2 would be called and set register2 to "3"
2.5 - Sees register1 change to "4", sends message box stating, "Homing complete" and sets all registers back to "0"
Hopefully....That all makes sense. I am sure there is a typo or something but the first cup of coffee has not kicked in yet!
Cheers,