There are plenty of components to achieve nearly anything in Linuxcnc, but as far as i can understand from your posts, the best way of handling this is writing a new component that would incorporate all the interlocks and checks required.
Here is an example of such a component for THC control on plasma cutters
Code:
component torchud "Torch Up Down";
description
"""
torch up down by voltage calculated from encoder velocity
""";
license "GPLv2 or greater";
option singleton yes;
// Input Pins
pin in bit enable "enable up/down";
pin in float encoder_in "connect to encoder.nn.velocity";
pin in float voltage_offset "to set 0 volts";
pin in float voltage_scale "to set correct voltage";
pin in float setpoint "setpoint voltage";
pin in float tolerance "deviation from setpoint before up/down";
pin in float arc_ok_min "min voltage to generate arc ok signal";
pin in float arc_ok_max "max voltage to genarate arc ok signal";
// Output Pins
pin out float arc_voltage "calculated arc voltage";
pin out bit move_up "arc voltage is too low";
pin out bit move_down "arc voltage is too high";
pin out bit arc_ok "signal that arc volatage is ok";
function _;
;;
#include "rtapi_math.h"
FUNCTION(_) {
arc_voltage = (encoder_in - voltage_offset) * voltage_scale;
if(arc_voltage < 0){arc_voltage = 0;}
if(enable && arc_voltage > arc_ok_min && arc_voltage < arc_ok_max){
arc_ok = 1;
}else{
arc_ok = 0;
}
if(enable && arc_voltage > setpoint + tolerance && arc_voltage > arc_ok_min && arc_voltage < arc_ok_max){
move_down = 1;
}else{
move_down = 0;
}
if(enable && arc_voltage < setpoint - tolerance && arc_voltage > arc_ok_min && arc_voltage < arc_ok_max){
move_up = 1;
}else{
move_up = 0;
}
}
This requires the dev part of LinuxCNC installed
sudo apt-get install linuxcnc-uspace-dev
if using the userspace version of Linuxcnc, or RT-Preempt version, and subsequently
sudo halcompile --install name_of_component.comp
The setting the connections in hal file.