Adding a status tab for MESA card

More
8 years 9 months ago #104747 by kor
Hi,
I decided to get familiar with the HAL and the user interface. As an exercise i devided to make a tab showing me the status of my mesa 7i76E input pins. (Which might help me later when I build the complete controll cabinett)
So I made a simple UI with glade having some status leds saved it as mesa7i76E.ui
Code:
<?xml version="1.0" encoding="UTF-8"?> <interface> <requires lib="gtk+" version="2.24"/> <!-- interface-requires gladevcp 0.0 --> <!-- interface-naming-policy project-wide --> <object class="GtkWindow" id="window1"> <property name="can_focus">False</property> <child> <object class="GtkTable" id="table1"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="n_rows">27</property> <property name="n_columns">8</property> <child> <object class="HAL_LED" id="LED_di05"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="led_blink_rate">0</property> <signal name="hal-pin-changed" handler="on_LED_di05_hal_pin_changed" swapped="no"/> </object> <packing> <property name="left_attach">6</property> <property name="right_attach">7</property> <property name="top_attach">21</property> <property name="bottom_attach">22</property> </packing> </child> <child> <object class="HAL_LED" id="LED_di08"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="led_blink_rate">0</property> </object> <packing> <property name="left_attach">6</property> <property name="right_attach">7</property> <property name="top_attach">18</property> <property name="bottom_attach">19</property> </packing> </child> <child> <object class="GtkLabel" id="label1"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="label" translatable="yes">TB6 di08</property> </object> <packing> <property name="left_attach">7</property> <property name="right_attach">8</property> <property name="top_attach">18</property> <property name="bottom_attach">19</property> </packing> </child> <child> <object class="GtkLabel" id="label2"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="label" translatable="yes">TB6 di05</property> </object> <packing> <property name="left_attach">7</property> <property name="right_attach">8</property> <property name="top_attach">21</property> <property name="bottom_attach">22</property> </packing> </child> <child> <object class="GtkLabel" id="label3"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="label" translatable="yes">TB6 ai00</property> </object> <packing> <property name="left_attach">7</property> <property name="right_attach">8</property> <property name="top_attach">26</property> <property name="bottom_attach">27</property> </packing> </child> <child> <placeholder/> </child> ... <child> <placeholder/> </child> </object> </child> </object> </interface>

than I added those lines to the ini:
Code:
#my own panels EMBED_TAB_NAME=7i76E EMBED_TAB_COMMAND=halcmd loadusr -Wn gladevcp gladevcp -c vcp7i76 -x {XID} -u ./gladevcp/hitcounter.py ./mesa7i76E.ui
which made my tab appear :)
Afterwards I made a hal file called mesa7i76E.hal
Code:
# HAL commands for MESA7i76E VCP net LED_di05 hm2_7i76e.0.7i76.0.0.input-05 <= vcp7i76.LED_di05 net LED_di05 hm2_7i76e.0.7i76.0.0.input-08 <= vcp7i76.LED_di08
and finally added the source mesa7i76E.hal to the postgui_call_list.hal
Well the pannel with the 2 leds is there, but it doesn t do anything. :(
did I miss a step or how can I simply show the status of an input pin in the gui?

Please Log in to join the conversation.

More
8 years 9 months ago #104772 by andypugh
If you check Machine->Show Hal Configuration does it appear that the connections have been made?

My suspicion is that the postgui call list isn't being called.

Please Log in to join the conversation.

More
8 years 9 months ago #104779 by kor
I have no idea how it should look.
So under the al configuration I found my vcp7i76 and the 2 LEDs.
for each LED it says owner: 52 Type: bit Dir: in Name: vcp7i76.LED_di0X
So I geuss you are right. But I don't know how it should look like and how to fix it.

Please Log in to join the conversation.

More
8 years 9 months ago #104780 by andypugh
Is your Postgut Hal file referenced in the INI file?

Please Log in to join the conversation.

More
8 years 9 months ago #104781 by kor
Yes in the ini under HAL it says POSTGUI_HALFILE = postgui_call_list.hal

Please Log in to join the conversation.

More
8 years 9 months ago #104783 by BigJohnT
In the show hal configuration add the two input pins to the watch window then toggle the inputs to see if you have it wired up right. If you don't see <== and a signal name after the pin name in the show window then your net line has not been read and no connection has been made. Attach your hal and ini files.

JT

Please Log in to join the conversation.

More
8 years 9 months ago #104784 by andypugh
Do you see the LED_di05 etc signals in the signals section of the HAL config?

You can also try adding the inputs and the leds to the “Watch” tab to make sure that they are actually changing state.

Please Log in to join the conversation.

More
8 years 9 months ago #104785 by kor
Sry bigJohnT I am completly new to this so I don't really now what you want me to do. I am doing this mainly to learn.
Here is my HAL
Code:
# Generated by PNCconf at Fri Jan 19 22:22:46 2018 # Änderungen an dieser Datei werden beim nächsten # overwritten when you run PNCconf again loadrt [KINS]KINEMATICS loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS loadrt hostmot2 loadrt hm2_eth board_ip="192.168.1.121" config="firmware=hm2/7i76/7i76e.BIT num_encoders=1 num_pwmgens=0 num_stepgens=2 sserial_port_0=00xxxx" setp hm2_7i76e.0.watchdog.timeout_ns 5000000 loadrt pid names=pid.x,pid.z,pid.s addf hm2_7i76e.0.read servo-thread addf motion-command-handler servo-thread addf motion-controller servo-thread addf pid.x.do-pid-calcs servo-thread addf pid.z.do-pid-calcs servo-thread addf pid.s.do-pid-calcs servo-thread addf hm2_7i76e.0.write servo-thread setp hm2_7i76e.0.dpll.01.timer-us -50 setp hm2_7i76e.0.stepgen.timer-number 1 # external output signals # external input signals # --- MAX-Z --- net max-z <= hm2_7i76e.0.7i76.0.0.input-04 # --- HOME-Z --- net home-z <= hm2_7i76e.0.7i76.0.0.input-08 # --- CYCLE-START --- net cycle-start <= hm2_7i76e.0.7i76.0.0.input-09 # --- ABORT --- net abort <= hm2_7i76e.0.7i76.0.0.input-10 # --- SINGLE-STEP --- net single-step <= hm2_7i76e.0.7i76.0.0.input-11 #******************* # JOINT X #******************* setp pid.x.Pgain [JOINT_0]P setp pid.x.Igain [JOINT_0]I setp pid.x.Dgain [JOINT_0]D setp pid.x.bias [JOINT_0]BIAS setp pid.x.FF0 [JOINT_0]FF0 setp pid.x.FF1 [JOINT_0]FF1 setp pid.x.FF2 [JOINT_0]FF2 setp pid.x.deadband [JOINT_0]DEADBAND setp pid.x.maxoutput [JOINT_0]MAX_OUTPUT setp pid.x.error-previous-target true setp pid.x.maxerror .0005 net x-index-enable <=> pid.x.index-enable net x-enable => pid.x.enable net x-pos-cmd => pid.x.command net x-vel-cmd => pid.x.command-deriv net x-pos-fb => pid.x.feedback net x-output => pid.x.output # Step Gen signals/setup setp hm2_7i76e.0.stepgen.01.dirsetup [JOINT_0]DIRSETUP setp hm2_7i76e.0.stepgen.01.dirhold [JOINT_0]DIRHOLD setp hm2_7i76e.0.stepgen.01.steplen [JOINT_0]STEPLEN setp hm2_7i76e.0.stepgen.01.stepspace [JOINT_0]STEPSPACE setp hm2_7i76e.0.stepgen.01.position-scale [JOINT_0]STEP_SCALE setp hm2_7i76e.0.stepgen.01.step_type 0 setp hm2_7i76e.0.stepgen.01.control-type 1 setp hm2_7i76e.0.stepgen.01.maxaccel [JOINT_0]STEPGEN_MAXACCEL setp hm2_7i76e.0.stepgen.01.maxvel [JOINT_0]STEPGEN_MAXVEL # ---closedloop stepper signals--- net x-pos-cmd <= joint.0.motor-pos-cmd net x-vel-cmd <= joint.0.vel-cmd net x-output <= hm2_7i76e.0.stepgen.01.velocity-cmd net x-pos-fb <= hm2_7i76e.0.stepgen.01.position-fb net x-pos-fb => joint.0.motor-pos-fb net x-enable <= joint.0.amp-enable-out net x-enable => hm2_7i76e.0.stepgen.01.enable # ---setup home / limit switch signals--- net x-home-sw => joint.0.home-sw-in net x-neg-limit => joint.0.neg-lim-sw-in net x-pos-limit => joint.0.pos-lim-sw-in #******************* # JOINT Z #******************* setp pid.z.Pgain [JOINT_1]P setp pid.z.Igain [JOINT_1]I setp pid.z.Dgain [JOINT_1]D setp pid.z.bias [JOINT_1]BIAS setp pid.z.FF0 [JOINT_1]FF0 setp pid.z.FF1 [JOINT_1]FF1 setp pid.z.FF2 [JOINT_1]FF2 setp pid.z.deadband [JOINT_1]DEADBAND setp pid.z.maxoutput [JOINT_1]MAX_OUTPUT setp pid.z.error-previous-target true setp pid.z.maxerror .0005 net z-index-enable <=> pid.z.index-enable net z-enable => pid.z.enable net z-pos-cmd => pid.z.command net z-vel-cmd => pid.z.command-deriv net z-pos-fb => pid.z.feedback net z-output => pid.z.output # Step Gen signals/setup setp hm2_7i76e.0.stepgen.00.dirsetup [JOINT_1]DIRSETUP setp hm2_7i76e.0.stepgen.00.dirhold [JOINT_1]DIRHOLD setp hm2_7i76e.0.stepgen.00.steplen [JOINT_1]STEPLEN setp hm2_7i76e.0.stepgen.00.stepspace [JOINT_1]STEPSPACE setp hm2_7i76e.0.stepgen.00.position-scale [JOINT_1]STEP_SCALE setp hm2_7i76e.0.stepgen.00.step_type 0 setp hm2_7i76e.0.stepgen.00.control-type 1 setp hm2_7i76e.0.stepgen.00.maxaccel [JOINT_1]STEPGEN_MAXACCEL setp hm2_7i76e.0.stepgen.00.maxvel [JOINT_1]STEPGEN_MAXVEL # ---closedloop stepper signals--- net z-pos-cmd <= joint.1.motor-pos-cmd net z-vel-cmd <= joint.1.vel-cmd net z-output <= hm2_7i76e.0.stepgen.00.velocity-cmd net z-pos-fb <= hm2_7i76e.0.stepgen.00.position-fb net z-pos-fb => joint.1.motor-pos-fb net z-enable <= joint.1.amp-enable-out net z-enable => hm2_7i76e.0.stepgen.00.enable # ---setup home / limit switch signals--- net home-z => joint.1.home-sw-in net z-neg-limit => joint.1.neg-lim-sw-in net max-z => joint.1.pos-lim-sw-in #******************* # SPINDLE S #******************* setp pid.s.Pgain [SPINDLE_9]P setp pid.s.Igain [SPINDLE_9]I setp pid.s.Dgain [SPINDLE_9]D setp pid.s.bias [SPINDLE_9]BIAS setp pid.s.FF0 [SPINDLE_9]FF0 setp pid.s.FF1 [SPINDLE_9]FF1 setp pid.s.FF2 [SPINDLE_9]FF2 setp pid.s.deadband [SPINDLE_9]DEADBAND setp pid.s.maxoutput [SPINDLE_9]MAX_OUTPUT setp pid.s.error-previous-target true net spindle-index-enable <=> pid.s.index-enable net spindle-enable => pid.s.enable net spindle-vel-cmd-rpm => pid.s.command net spindle-vel-fb-rpm => pid.s.feedback net spindle-output <= pid.s.output # ---setup spindle control signals--- net spindle-vel-cmd-rps <= motion.spindle-speed-out-rps net spindle-vel-cmd-rps-abs <= motion.spindle-speed-out-rps-abs net spindle-vel-cmd-rpm <= motion.spindle-speed-out net spindle-vel-cmd-rpm-abs <= motion.spindle-speed-out-abs net spindle-enable <= motion.spindle-on net spindle-cw <= motion.spindle-forward net spindle-ccw <= motion.spindle-reverse net spindle-brake <= motion.spindle-brake net spindle-revs => motion.spindle-revs net spindle-at-speed => motion.spindle-at-speed net spindle-vel-fb-rps => motion.spindle-speed-in net spindle-index-enable <=> motion.spindle-index-enable # ---Setup spindle at speed signals--- sets spindle-at-speed true #****************************** # connect miscellaneous signals #****************************** # ---HALUI signals--- net axis-select-x halui.axis.x.select net jog-x-pos halui.axis.x.plus net jog-x-neg halui.axis.x.minus net jog-x-analog halui.axis.x.analog net x-is-homed halui.joint.0.is-homed net axis-select-z halui.axis.z.select net jog-z-pos halui.axis.z.plus net jog-z-neg halui.axis.z.minus net jog-z-analog halui.axis.z.analog net z-is-homed halui.joint.1.is-homed net jog-selected-pos halui.axis.selected.plus net jog-selected-neg halui.axis.selected.minus net spindle-manual-cw halui.spindle.forward net spindle-manual-ccw halui.spindle.reverse net spindle-manual-stop halui.spindle.stop net machine-is-on halui.machine.is-on net jog-speed halui.axis.jog-speed net MDI-mode halui.mode.is-mdi # ---coolant signals--- net coolant-mist <= iocontrol.0.coolant-mist net coolant-flood <= iocontrol.0.coolant-flood # ---probe signal--- net probe-in => motion.probe-input # ---jogwheel signals to mesa encoder - shared MPG--- net axis-selected-count <= hm2_7i76e.0.encoder.00.count # ---motion control signals--- net in-position <= motion.in-position net machine-is-enabled <= motion.motion-enabled # ---digital in / out signals--- # ---estop signals--- net estop-out <= iocontrol.0.user-enable-out net estop-out => iocontrol.0.emc-enable-in # ---manual tool change signals--- loadusr -W hal_manualtoolchange net tool-change-request iocontrol.0.tool-change => hal_manualtoolchange.change net tool-change-confirmed iocontrol.0.tool-changed <= hal_manualtoolchange.changed net tool-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
and here is my ini:
Code:
# Generated by PNCconf at Fri Jan 19 22:22:46 2018 # Änderungen an dieser Datei werden beim nächsten # overwritten when you run PNCconf again [EMC] MACHINE = my_Lathe_7i76E DEBUG = 0 VERSION = 1.0 [DISPLAY] DISPLAY = axis POSITION_OFFSET = RELATIVE POSITION_FEEDBACK = ACTUAL MAX_FEED_OVERRIDE = 2.000000 MAX_SPINDLE_OVERRIDE = 1.000000 MIN_SPINDLE_OVERRIDE = 0.500000 INTRO_GRAPHIC = linuxcnc.gif INTRO_TIME = 5 PROGRAM_PREFIX = /home/kor/linuxcnc/nc_files INCREMENTS = 5mm 1mm .5mm .1mm .05mm .01mm .005mm LATHE = 1 POSITION_FEEDBACK = ACTUAL DEFAULT_LINEAR_VELOCITY = 6.000000 MAX_LINEAR_VELOCITY = 25.000000 MIN_LINEAR_VELOCITY = 0.500000 DEFAULT_ANGULAR_VELOCITY = 12.000000 MAX_ANGULAR_VELOCITY = 180.000000 MIN_ANGULAR_VELOCITY = 1.666667 EDITOR = gedit GEOMETRY = xyz #my own panels EMBED_TAB_NAME=7i76E EMBED_TAB_COMMAND=halcmd loadusr -Wn gladevcp gladevcp -c vcp7i76 -x {XID} -u ./gladevcp/hitcounter.py ./mesa7i76E.ui [FILTER] PROGRAM_EXTENSION = .png,.gif,.jpg Greyscale Depth Image PROGRAM_EXTENSION = .py Python Script png = image-to-gcode gif = image-to-gcode jpg = image-to-gcode py = python [TASK] TASK = milltask CYCLE_TIME = 0.010 [RS274NGC] PARAMETER_FILE = linuxcnc.var [EMCMOT] EMCMOT = motmod COMM_TIMEOUT = 1.0 SERVO_PERIOD = 1000000 [HOSTMOT2] # **** This is for info only **** # DRIVER0=hm2_eth # BOARD0=7i76e [HAL] HALUI = halui HALFILE = my_Lathe_7i76E.hal HALFILE = custom.hal POSTGUI_HALFILE = postgui_call_list.hal SHUTDOWN = shutdown.hal [HALUI] [KINS] JOINTS = 2 KINEMATICS = trivkins coordinates=XZ [TRAJ] COORDINATES = X Z LINEAR_UNITS = mm ANGULAR_UNITS = degree DEFAULT_LINEAR_VELOCITY = 5.00 MAX_LINEAR_VELOCITY = 50.00 NO_FORCE_HOMING = 1 [EMCIO] EMCIO = io CYCLE_TIME = 0.100 TOOL_TABLE = tool.tbl #******************** # Joint 0 [JOINT_0] #******************** TYPE = LINEAR HOME = 0.0 FERROR = 10.0 MIN_FERROR = 1.0 MAX_VELOCITY = 50.0 MAX_ACCELERATION = 150.0 # The values below should be 25% larger than MAX_VELOCITY and MAX_ACCELERATION # If using BACKLASH compensation STEPGEN_MAXACCEL should be 100% larger. STEPGEN_MAXVEL = 62.50 STEPGEN_MAXACCEL = 187.50 P = 1000.0 I = 0.0 D = 0.0 FF0 = 0.0 FF1 = 1.0 FF2 = 0.0 BIAS = 0.0 DEADBAND = 0.0 MAX_OUTPUT = 0.0 # these are in nanoseconds DIRSETUP = 4000 DIRHOLD = 4000 STEPLEN = 4000 STEPSPACE = 4000 STEP_SCALE = 400.0 MIN_LIMIT = -3000000.0 MAX_LIMIT = 0.01 HOME_OFFSET = 0.0 # Axis X #******************** [AXIS_X] MAX_VELOCITY = 50.0 MAX_ACCELERATION = 150.0 MIN_LIMIT = -3000000.0 MAX_LIMIT = 0.01 #******************** # Joint 1 [JOINT_1] #******************** TYPE = LINEAR HOME = 0.0 FERROR = 10.0 MIN_FERROR = 1.0 MAX_VELOCITY = 50.0 MAX_ACCELERATION = 150.0 # The values below should be 25% larger than MAX_VELOCITY and MAX_ACCELERATION # If using BACKLASH compensation STEPGEN_MAXACCEL should be 100% larger. STEPGEN_MAXVEL = 62.50 STEPGEN_MAXACCEL = 187.50 P = 1000.0 I = 0.0 D = 0.0 FF0 = 0.0 FF1 = 1.0 FF2 = 0.0 BIAS = 0.0 DEADBAND = 0.0 MAX_OUTPUT = 0.0 # these are in nanoseconds DIRSETUP = 4000 DIRHOLD = 4000 STEPLEN = 4000 STEPSPACE = 4000 STEP_SCALE = 400.0 MIN_LIMIT = -1e+11 MAX_LIMIT = 0.01 HOME_OFFSET = 0.000000 HOME_SEARCH_VEL = -1.000000 HOME_LATCH_VEL = -0.500000 HOME_FINAL_VEL = 0.000000 HOME_USE_INDEX = NO # Axis Z #******************** [AXIS_Z] MAX_VELOCITY = 50.0 MAX_ACCELERATION = 150.0 MIN_LIMIT = -1e+11 MAX_LIMIT = 0.01 #******************** # Spindle #******************** [SPINDLE_9] P = 0 I = 0 D = 0 FF0 = 1 FF1 = 0 FF2 = 0 BIAS = 0 DEADBAND = 0 MAX_OUTPUT = 2000

Please Log in to join the conversation.

More
8 years 9 months ago #104786 by kor
Andy under show hal and Signals is a bunch of stuff but no LED_di05 or di08

Please Log in to join the conversation.

More
8 years 9 months ago #104788 by andypugh
Start LinuxCNC from the command line (command "linuxcnc") and see if you get any complaints about files that it can't find.

Also try calling your 7i76E.hal file directly, rather than with the "source" command in a call list. (ie replace the call_list file in the INI with the 7i76E file name)

Please Log in to join the conversation.

Time to create page: 0.059 seconds
Powered by Kunena Forum