LED panel light for probe

More
16 Apr 2021 11:47 #206101 by russkinch
Hi. I have been using Axis for sometime now and know my way around a little. I had an LED panel light on the axis display for a tool probe. I have since moved over to gmoccapy as planning on using a touch screen only. I cannot for the life of me figure out how to make a panel LED light turn from red to green when to tool height probe works. I know it has to do with HAL pins but I am lost. My probe works in my hal config using probe-in =>motion.probe-input (copied from a auto tool script). But how do I link that to the LED panel light. my glade screen is labelled tool-probe.glade.

Please Log in or Create an account to join the conversation.

More
16 Apr 2021 15:20 #206110 by newbynobi
Replied by newbynobi on topic LED panel light for probe
You need to embed the glade panel in the INI file with the -H option naming a Hal file.
Within that Hal file you need to do the Hal connection, something like the following should do the work:

net probe-in gladevcp.led_probe

if you did not name the glade component different.
Best is to start without the Hal file and open halshow and look there for the exact name of the LED pin.

You may have a look at the Sim config of gmoccapy with tool probe simulation for more details.

Norbert
The following user(s) said Thank You: russkinch

Please Log in or Create an account to join the conversation.

More
24 Apr 2021 15:45 - 24 Apr 2021 15:46 #206956 by russkinch
Replied by russkinch on topic LED panel light for probe
Hi. I tried and it said the pin was not found (led_probe). I have embedded the panel in my .ini file. I have used the -H so it calls tool_sensor.hal and in this file it would link the probe to the led. In the glade file, the led is called HAL_LED id"led_tool_sensor". So I would assume in the tool_sensor.hal file I would put net probe-in gladevcp.led_tool_sensor? in my main hal file it has net probe-in => motion.probe-input.
Last edit: 24 Apr 2021 15:46 by russkinch.

Please Log in or Create an account to join the conversation.

More
24 Apr 2021 20:44 #206967 by newbynobi
Replied by newbynobi on topic LED panel light for probe
One question:

Why does it not find led_probe?
May be, because your one is called led_tool_sensor?

Why did I write, check the pin name?

If you need more help post your config,

Norbert
The following user(s) said Thank You: russkinch

Please Log in or Create an account to join the conversation.

More
26 Apr 2021 19:23 #207157 by russkinch
Replied by russkinch on topic LED panel light for probe
Hi,
Here is my code. This is my main .hal file
# Generated by stepconf 1.1 at Fri Jan 29 10:55:56 2021
# If you make changes to this file, they will be
# overwritten when you run stepconf again
loadrt [KINS]KINEMATICS
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS
loadrt hal_parport cfg="0 out 1 out"
loadrt stepgen step_type=0,0,0
loadrt pwmgen output_type=1
loadrt classicladder_rt numPhysInputs=15 numPhysOutputs=15 numS32in=10 numS32out=10 numFloatIn=10 numFloatOut=10

addf parport.0.read base-thread
addf parport.1.read base-thread
addf stepgen.make-pulses base-thread
addf pwmgen.make-pulses base-thread
addf parport.0.write base-thread
addf parport.1.write base-thread

addf stepgen.capture-position servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf classicladder.0.refresh servo-thread
addf stepgen.update-freq servo-thread
addf pwmgen.update servo-thread

net spindle-cmd-rpm => pwmgen.0.value
net spindle-on <= spindle.0.on => pwmgen.0.enable
net spindle-pwm <= pwmgen.0.pwm
setp pwmgen.0.pwm-freq 100.0
setp pwmgen.0.scale 24000.0
setp pwmgen.0.offset 0.0
setp pwmgen.0.dither-pwm true
net spindle-cmd-rpm     <= spindle.0.speed-out
net spindle-cmd-rpm-abs <= spindle.0.speed-out-abs
net spindle-cmd-rps     <= spindle.0.speed-out-rps
net spindle-cmd-rps-abs <= spindle.0.speed-out-rps-abs
net spindle-at-speed    => spindle.0.at-speed

net probe-in => motion.probe-input


setp parport.0.pin-01-out-invert 1
net spindle-pwm     => parport.0.pin-01-out
setp parport.0.pin-02-out-invert 1
net xstep           => parport.0.pin-02-out
net xdir            => parport.0.pin-03-out
setp parport.0.pin-04-out-invert 1
net ystep           => parport.0.pin-04-out
net ydir            => parport.0.pin-05-out
setp parport.0.pin-06-out-invert 1
net zstep           => parport.0.pin-06-out
net zdir            => parport.0.pin-07-out
net astep           => parport.0.pin-08-out
net adir            => parport.0.pin-09-out
net xenable         => parport.0.pin-14-out
net spindle-on      => parport.0.pin-17-out
setp parport.1.pin-14-out-invert 1
net flood <= iocontrol.0.coolant-flood => parport.1.pin-14-out


net estop-ext       <= parport.0.pin-10-in
net home-x          <= parport.1.pin-10-in
net home-y          <= parport.1.pin-11-in
net home-z          <= parport.1.pin-12-in
net probe-in	    <= parport.1.pin-13-in-not




setp stepgen.0.position-scale [JOINT_0]SCALE
setp stepgen.0.steplen 5000
setp stepgen.0.stepspace 5000
setp stepgen.0.dirhold 20000
setp stepgen.0.dirsetup 20000
setp stepgen.0.maxaccel [JOINT_0]STEPGEN_MAXACCEL
net xpos-cmd joint.0.motor-pos-cmd => stepgen.0.position-cmd
net xpos-fb stepgen.0.position-fb => joint.0.motor-pos-fb
net xstep <= stepgen.0.step
net xdir <= stepgen.0.dir
net xenable joint.0.amp-enable-out => stepgen.0.enable
net home-x => joint.0.home-sw-in

setp stepgen.1.position-scale [JOINT_1]SCALE
setp stepgen.1.steplen 5000
setp stepgen.1.stepspace 5000
setp stepgen.1.dirhold 20000
setp stepgen.1.dirsetup 20000
setp stepgen.1.maxaccel [JOINT_1]STEPGEN_MAXACCEL
net ypos-cmd joint.1.motor-pos-cmd => stepgen.1.position-cmd
net ypos-fb stepgen.1.position-fb => joint.1.motor-pos-fb
net ystep <= stepgen.1.step
net ydir <= stepgen.1.dir
net yenable joint.1.amp-enable-out => stepgen.1.enable
net home-y => joint.1.home-sw-in

setp stepgen.2.position-scale [JOINT_2]SCALE
setp stepgen.2.steplen 5000
setp stepgen.2.stepspace 5000
setp stepgen.2.dirhold 20000
setp stepgen.2.dirsetup 20000
setp stepgen.2.maxaccel [JOINT_2]STEPGEN_MAXACCEL
net zpos-cmd joint.2.motor-pos-cmd => stepgen.2.position-cmd
net zpos-fb stepgen.2.position-fb => joint.2.motor-pos-fb
net zstep <= stepgen.2.step
net zdir <= stepgen.2.dir
net zenable joint.2.amp-enable-out => stepgen.2.enable
net home-z => joint.2.home-sw-in

net estop-out <= iocontrol.0.user-enable-out
net estop-ext => iocontrol.0.emc-enable-in

# create signals for tool loading loopback
net tool-prep-loop iocontrol.0.tool-prepare iocontrol.0.tool-prepared
net tool-change-loop iocontrol.0.tool-change iocontrol.0.tool-changed

# Load Classicladder without GUI (can reload LADDER GUI in AXIS GUI
loadusr classicladder --nogui custom.clp

this is my tool_senor.glade file
<?xml version="1.0"?>
<interface>
  <requires lib="gtk+" version="2.16"/>
  <!-- interface-requires gladevcp 0.0 -->
  <!-- interface-naming-policy project-wide -->
  <object class="GtkWindow" id="window1">
    <child>
      <object class="GtkFrame" id="frm_tool_sensor">
        <property name="visible">True</property>
        <property name="label_xalign">0.5</property>
        <child>
          <object class="GtkAlignment" id="ali_tool_sensor">
            <property name="visible">True</property>
            <property name="top_padding">5</property>
            <property name="bottom_padding">5</property>
            <property name="left_padding">5</property>
            <property name="right_padding">5</property>
            <child>
              <object class="GtkVBox" id="vbox_tool_sensor">
                <property name="visible">True</property>
                <child>
                  <object class="GtkHBox" id="hbox_tool_sensor">
                    <property name="visible">True</property>
                    <child>
                      <object class="GtkLabel" id="lbl_tool_sensor">
                        <property name="visible">True</property>
                        <property name="label" translatable="yes">Probe:</property>
                      </object>
                      <packing>
                        <property name="expand">False</property>
                        <property name="fill">False</property>
                        <property name="position">0</property>
                      </packing>
                    </child>
                    <child>
                      <object class="HAL_LED" id="led_tool_sensor">
                        <property name="visible">True</property>
                        <property name="pick_color_on">#0000ffff0000</property>
                        <property name="pick_color_off">#ffff00000000</property>
                      </object>
                      <packing>
                        <property name="position">1</property>
                      </packing>
                    </child>
                  </object>
                  <packing>
                    <property name="expand">False</property>
                    <property name="fill">False</property>
                    <property name="position">0</property>
                  </packing>
                </child>
              </object>
            </child>
          </object>
        </child>
        <child type="label">
          <object class="GtkLabel" id="lbl_frm_tool_sensor">
            <property name="visible">True</property>
            <property name="label" translatable="yes">&lt;b&gt;Tool Probe&lt;/b&gt;</property>
            <property name="use_markup">True</property>
          </object>
        </child>
      </object>
    </child>
  </object>
</interface>

I hope this makes sense? I have a file also called tool-sensor.hal which is where I need the code to turn the LED light to green once the tool probe touches (shorts) and then back to red when its off the tool probe.

Please Log in or Create an account to join the conversation.

More
26 Apr 2021 19:32 #207158 by newbynobi
Replied by newbynobi on topic LED panel light for probe
Please poat also the INI file and the tool-sensor.hal file, the file you posted looks good so far, as it does not contain any connection to the LED.

Norbert

Please Log in or Create an account to join the conversation.

More
28 Apr 2021 15:17 #207310 by russkinch
Replied by russkinch on topic LED panel light for probe
hi,
here is my ini file
# General section -------------------------------------------------------------
[EMC]
VERSION = 1.1
MACHINE =               6040 Tool sensor
DEBUG =               0


# for details see nc_files/subroutines/maco_instructions.txt
[MACROS]
MACRO = i_am_lost
MACRO = halo_world
MACRO = jog_around
MACRO = increment xinc yinc
MACRO = go_to_position X-pos Y-pos Z-pos

# Sections for display options ------------------------------------------------
[DISPLAY]
DISPLAY = gmoccapy
# We do explicit give an preference file here, because otherwise 
# the sim may not work on other computers. That is also the reason
# we use the prefix para, so it will not be ignored from git
PREFERENCE_FILE_PATH = gmoccapy_tool_sensor.para

EMBED_TAB_NAME = Tool Sensor
EMBED_TAB_LOCATION = box_right
EMBED_TAB_COMMAND = gladevcp -x {XID} tool_sensor.glade

EMBED_TAB_NAME = Part Probe
EMBED_TAB_LOCATION = ntb_preview
EMBED_TAB_COMMAND = gladevcp -x {XID} gmoccapy2.glade

# Cycle time, in milliseconds, that display will sleep between polls
CYCLE_TIME =            100

# Highest value that will be allowed for feed override, 1.0 = 100%
MAX_FEED_OVERRIDE =     1.5
MAX_SPINDLE_OVERRIDE =  1.2
MIN_SPINDLE_OVERRIDE =  0.5

# Prefix to be used
PROGRAM_PREFIX = /home/linuxcnc/linuxcnc/nc_files

# Introductory graphic
INTRO_GRAPHIC = linuxcnc.gif
INTRO_TIME = 5

# list of selectable jog increments
INCREMENTS = 1.0 mm, 0.1 mm, 0.01 mm, 0.001 mm

[FILTER]
PROGRAM_EXTENSION = .png,.gif,.jpg Grayscale Depth Image
PROGRAM_EXTENSION = .py Python Script
png = image-to-gcode
gif = image-to-gcode
jpg = image-to-gcode
py = python

# Task controller section -----------------------------------------------------
[RS274NGC]

PARAMETER_FILE = sim.var
SUBROUTINE_PATH = macros

# optional features - a bit mask to selectively turn on experimental/dubious features
# see 
# RETAIN_G43           0x00000001
# OWORD_N_ARGS         0x00000002
# INI_VARS             0x00000004
# HAL_PIN_VARS         0x00000008
# NO_DOWNCASE_OWORD    0x00000010
# turn on all optional features

# turn on optional features in this case just INI reading 
FEATURES=12

ON_ABORT_COMMAND=O <on_abort> call 

# parameters exposed by change_prolog/evaluated by change_epilog:
#    #<tool_in_spindle>
#    #<selected_tool>
#    #<current_pocket>
#    #<selected_pocket>
REMAP=M6  modalgroup=6 prolog=change_prolog ngc=change epilog=change_epilog

# accessible in interp as #<_[section]name>
# start of tool length touchoff probe
[EMCMOT]
EMCMOT =              motmod
COMM_TIMEOUT =          1.0
BASE_PERIOD  =          35000
SERVO_PERIOD =          1000000

# Hardware Abstraction Layer section --------------------------------------------------
[TASK]
TASK =                  milltask
CYCLE_TIME =            0.001

# Part program interpreter section --------------------------------------------
[HAL]

HALFILE = 6040_Tool_sensor.hal
HALFILE = tool-sensor.hal

# Single file that is executed after the GUI has started.
POSTGUI_HALFILE = gmoccapy_postgui.hal

HALUI = halui

# Trajectory planner section --------------------------------------------------
[HALUI]
#No Content

[TRAJ]
COORDINATES =      X Y Z 
LINEAR_UNITS =     mm
ANGULAR_UNITS =    degree
DEFAULT_LINEAR_VELOCITY = 29.0
MAX_LINEAR_VELOCITY = 29.0
POSITION_FILE =    position.txt


[EMCIO]
EMCIO = 		io
CYCLE_TIME =    0.100

# tool table file
TOOL_TABLE = tool.tbl

[KINS]
KINEMATICS = trivkins coordinates=xyz
JOINTS = 3

[AXIS_X]
MAX_VELOCITY = 31
MAX_ACCELERATION = 220.0
MIN_LIMIT = -0.1
MAX_LIMIT = 370.0

[JOINT_0]
TYPE = LINEAR
HOME = 0.0
MIN_LIMIT = -0.1
MAX_LIMIT = 370.0
MAX_VELOCITY = 31
MAX_ACCELERATION = 220.0
STEPGEN_MAXACCEL = 500
SCALE = 319
FERROR = 1
MIN_FERROR = .25
HOME_OFFSET = -2
HOME_SEARCH_VEL = 31
HOME_LATCH_VEL = 1.500000
HOME_SEQUENCE = 1

[AXIS_Y]
MAX_VELOCITY = 31
MAX_ACCELERATION = 220.0
MIN_LIMIT = -580		
MAX_LIMIT = 1

[JOINT_1]
TYPE = LINEAR
HOME = 0.0
MIN_LIMIT = -580
MAX_LIMIT = 1
MAX_VELOCITY = 31
MAX_ACCELERATION = 220.0
STEPGEN_MAXACCEL = 500
SCALE = 320
FERROR = 1
MIN_FERROR = .25
HOME_OFFSET = 2
HOME_SEARCH_VEL = -31
HOME_LATCH_VEL = 5.500000
HOME_SEQUENCE = 2

[AXIS_Z]
MAX_VELOCITY = 15
MAX_ACCELERATION = 200.0
MIN_LIMIT = -120.0
MAX_LIMIT = 0.001

[JOINT_2]
TYPE = LINEAR
HOME = 0
MIN_LIMIT = -120.0
MAX_LIMIT = 0.001
MAX_VELOCITY = 15
MAX_ACCELERATION = 200.0
STEPGEN_MAXACCEL = 500
SCALE = 400
FERROR = 1
MIN_FERROR = .25
HOME_OFFSET = 2
HOME_SEARCH_VEL = -29
HOME_LATCH_VEL = 1.500000
HOME_SEQUENCE = 0

# section for main IO controller parameters -----------------------------------
[TOOLSENSOR]
X = 22
Y = -517  
Z = -80
# abort change if no toolsensor contact after this probe distance
MAXPROBE =  -11

# this is not named TOOL_CHANGE_POSITION  on purpose - canon uses it and will
# interfere
[CHANGE_POSITION]
X = 22
Y = -517
Z = 0

# the Python plugins serves interpreter and task
[PYTHON]
PATH_PREPEND = python
TOPLEVEL = python/toplevel.py
LOG_LEVEL = 8

# Motion control section ------------------------------------------------------

my tool-sensor.hal is blank as it was the example off linuxcnc and had a button instead of the probe. But here it is.
net tool_sensor tool_sensor.btn_tool_sensor_sim 
net tool_sensor motion.probe-input 
net tool_sensor tool_sensor.led_tool_sensor

Please Log in or Create an account to join the conversation.

More
06 May 2021 08:12 #208078 by guido-52
Replied by guido-52 on topic LED panel light for probe
Has your problem already been solved?

I don't see a reference to the hal file in your ini file

I also had this problem and finally (with help from the forum) solved it as;

In the ini-file
- EMBED_TAB_COMMAND = gladevcp -x {XID} -H paneel.hal ./GLADE/paneel1.glade
(glade file in folder "GLADE")

connections in paneel.hal
(no reference to hal file in other hal's)

Please Log in or Create an account to join the conversation.

More
06 May 2021 21:05 #208159 by newbynobi
Replied by newbynobi on topic LED panel light for probe
That's exactly what I mentioned in my first post in this thread.
I did ask if the - H option is used and there is no reference in the inin file

Norbert

Please Log in or Create an account to join the conversation.

Moderators: newbynobi
Time to create page: 0.348 seconds
Powered by Kunena Forum