ATC Project - Debug phase

More
4 years 3 months ago #246591 by spumco
Replied by spumco on topic ATC Project - (Remap Phase)
Thanks.  Where exatly should I put the 'print' statement?  I tried in a few places in stdglue.py and LCNC hung up while starting:

def change_prolog(self, **words):
    print("hello prolog")
    try:
        # this is relevant only when using iocontrol-v2.
        if self.params[5600] > 0.0:
            if self.params[5601] < 0.0:
                self.set_errormsg("Toolchanger hard fault %d" % (int(self.params[5601])))
                return INTERP_ERROR
            print("change_prolog: Toolchanger soft fault %d" % int(self.params[5601]))

LCNC took way longer to load, and threw error "No message text set"

Side Note:
More fiddling with everything right now, and I may have made a bit of progress.  After combing through a bunch of example configs I discovered that some of the numbered parameters referenced in my toolchange.ngc were missing from the linuxcnc.var file.

Specifically, #5170 and #5171, plus #5202-#5207.  #5170 is the current pocket value, and #5171 is ATC is homed, and the others are pocket numbers #13-#18 (example only has 12).

I assumed those would have been created by LCNC on startup, but I guess not.  Didn't find any breadcrumbs left in the example file(s) stating "you have to manually create xxx parameters".

So I manually added those parameters with value = 0 and I'm getting some new behavior:
  • If I reference the ATC, the GUI is now reading the parameters and displaying tool icons in the pockets (wasn't before, ATC widget was empty)
    • the display widget pocket #'s dont match the var file, but at least there's some response from the screen
  • If I adjust the parameter values in the var file, on startup the values are being displayed on the screen widgets and DROs
    • i.e. change #5231 (tool in spindle) to 1, and #5190 (pocket 1 tool number) to 0, on startup the animation widget shows pocket 1 as empty and T1 in the spindle
  • Still getting Named parameter #<selected_pocket> not defined, but

Please Log in to join the conversation.

More
4 years 3 months ago #246612 by andypugh

Thanks.  Where exatly should I put the 'print' statement?  I tried in a few places in stdglue.py and LCNC hung up while starting:
 
That's not as useful as it could be, but does tell us both that the file is being run, and that it is the version of the file that you think it is. 

Please Log in to join the conversation.

More
4 years 3 months ago #246621 by spumco
Replied by spumco on topic ATC Project - (Remap Phase)

Thanks.  Where exatly should I put the 'print' statement?  I tried in a few places in stdglue.py and LCNC hung up while starting:
 
That's not as useful as it could be, but does tell us both that the file is being run, and that it is the version of the file that you think it is.
 

I hadn't even thought of that, thank you.

I've been looking at other configs which are presumably working, I see that in the INI files there's usually another PATH_APPEND = x line under [PYTHON].

Some examples:
[PYTHON]
TOPLEVEL=python/toplevel.py
PATH_APPEND=python


or
[PYTHON]
PATH_PREPEND = python
TOPLEVEL = python/toplevel.py


or
[PYTHON]
TOPLEVEL=./toplevel.py
PATH_APPEND= ./
PATH_APPEND= ../../nc_files/remap_lib/python-stdglue/


or
[PYTHON]
PATH_PREPEND=./python
PATH_APPEND=../../nc_files/remap_lib/python-stdglue/
TOPLEVEL=python/toplevel.py


whereas mine looks like this:
[PYTHON]
# ***leave the following commented out unless you are using the ATC macros***
TOPLEVEL = /home/mill/linuxcnc/configs/HAL_rev32_ATC/python/toplevel.py
PATH_APPEND = /home/mill/linuxcnc/configs/HAL_rev32_ATC/python/


I don't have a PATH_PREPEND, nor do i seem to have a simple PATH_APPEND=python.

LCNC manual for remap has this:

# code specific for this configuration
PATH_PREPEND=./

# generic support code - make sure this actually points to python-stdglue
PATH_APPEND=../../nc_files/remap_lib/python-stdglue/



Am I missing something?

Please Log in to join the conversation.

More
4 years 3 months ago #246643 by andypugh
You are using a private copy of stdglue, so shouldn't need to add that path.

Please Log in to join the conversation.

More
4 years 3 months ago #246644 by spumco
Replied by spumco on topic ATC Project - (Remap Phase)
So path is OK, but stdglue is still not passing global parameters through.

When I do the magic comment for a global parameter, I get an expected result. i.e. #<_tool_in_spindle> = 1

When I do the magic comment for the corresponding local named parameter, I get #<tool_in_spindle> = ######

Do the pound signs indicate anything useful for troubleshooting?

Please Log in to join the conversation.

More
4 years 3 months ago #246646 by andypugh
##### means that the parameter does not exist.
I am unsure whether you would _expect_ a local parameter to be visible outside the creating context.

What happens if you copy the value of the remap-local parameter to a global parameter in the remap routine?

eg, in the remap routine have "#100 = #<tool_in_spindle>" then check #100 in MDI.

Or, add the line

(DEBUG, #<tool_in_spindle>)

At the start of your remap routine.

Please Log in to join the conversation.

More
4 years 3 months ago #246654 by spumco
Replied by spumco on topic ATC Project - (Remap Phase)
Code:
eg, in the remap routine have "#100 = #<tool_in_spindle>" then check #100 in MDI.

Did you mean to change the routine to be #100 = #<_tool_in_spindle> (global)?

 I'll try it when I get home later, but I think I've tried that and got some error.

I just noticed another difference between my stdglue.py and the one in LCNC's sim on github.  The 'standard' one has the following in the change epilog:

Mine (which I'm convinced was lifted from the Gmoccapy tool touch-off example):
Code:
if self.return_value > 0.0:             if self.return_value == 3:                 message = "No tool measurement ! Please take care of the entry in the tool table"                 emccanon.MESSAGE(message)             return INTERP_OK         else:             if self.return_value == -1:                 message = "Searchvel <= 0, not permitted!, Please correct INI Settings."             elif self.return_value == -2:                 message = "Probevel <= 0, not permitted!, Please correct INI Settings."             elif self.return_value == -3:                 message = "Probe contact failiure !!"             else:                 message = "M6 aborted (return code %.1f)" % (self.return_value)             self.set_errormsg(message)             return INTERP_ERROR

The standard version:
Code:
if self.blocks[self.remap_level].builtin_used:             #print "---------- M6 builtin recursion, nothing to do"             yield INTERP_OK         else:             if self.return_value > 0.0:                 # commit change                 self.selected_pocket =  int(self.params["selected_pocket"])                 emccanon.CHANGE_TOOL(self.selected_pocket)                 self.current_pocket = self.selected_pocket                 self.selected_pocket = -1                 self.selected_tool = -1                 # cause a sync()                 self.set_tool_parameters()                 self.toolchange_flag = True                 yield INTERP_EXECUTE_FINISH             else:                 self.set_errormsg("M6 aborted (return code %.1f)" % (self.return_value))                 yield INTERP_ERROR

Raise any red flags?

Please Log in to join the conversation.

More
4 years 3 months ago #246656 by andypugh

Code:
eg, in the remap routine have "#100 = #<tool_in_spindle>" then check #100 in MDI.


Did you mean to change the routine to be #100 = #<_tool_in_spindle> (global)?

No, I was suggesting to make a global copy of the local variable to look at in the global context.

Please Log in to join the conversation.

More
4 years 3 months ago #246657 by spumco
Replied by spumco on topic ATC Project - (Remap Phase)
You know, I just went through the Probe Basic example stdglue and there are a LOT of differences from the latest in LCNC - not just the one I posted above.  And I see a number of changes in github to the file in the past couple of years - meaningful changes, not just documentation updates.

I think I'm going to try using the standard one this evening and see what happens.

Can I delete all the #REMAP=S, #REMAP=T, and # pure python remaps  stuff I don't need?

Please Log in to join the conversation.

More
4 years 3 months ago #246661 by andypugh
You can definitely remove any commented-out entries and you will see no difference in behaviour.
But sometimes they can be useful references for things that you have already tried.

Please Log in to join the conversation.

Time to create page: 0.286 seconds
Powered by Kunena Forum