Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error at the end of a remapped m6 #217

Closed
dhweizel opened this issue Dec 9, 2016 · 6 comments
Closed

error at the end of a remapped m6 #217

dhweizel opened this issue Dec 9, 2016 · 6 comments

Comments

@dhweizel
Copy link

dhweizel commented Dec 9, 2016

I just changed to master. The machine uses a m6 remap copied of the vismach sample and works ok on 2.7 and now , on master, raises an error at the end of the tool change.

emc/task/emctask.cc 397: interp_error: exception during generator call: TypeError: 'NoneType' object is not callable

exception during generator call: TypeError: 'NoneType' object is not callable

Interpreter stack: - int Interp::pycall(setup_pointer, context_pointer, const char*, const char*, in - int Interp::execute_return(setup_pointer, context_pointer, int) - int Interp::convert_control_functions(block_pointer, setup_pointer) - int Interp::_execute(const char*)
emcTaskPlanExecute((null)) returned 5

There is the same error in the vismach sample : Here are the steps I follow to reproduce the issue:

  1. linuxcnc sim.axis.vismach.VMC_toolchange/vmc_index.ini
  2. home all
  3. t10m6

the ini file says:
REMAP=M6 modalgroup=6 prolog=change_prolog ngc=toolchange epilog=change_epilog
There is no error if I delete epilog=change_epilog

The error apears to be related to change_epilog of stdglue.py

in the line 198 : return INTERP_EXECUTE_FINISH

if I change to : return INTERP_OK it works as expected

I don't know the implications of the change but I found this return vaue used in another stdglue.py file in the master (gmoccapy)

edit: typo

@andypugh
Copy link
Collaborator

andypugh commented Dec 9, 2016

I don't really understand remap and/or stdglue.py but I have a feeling that INTERP_EXECUTE_FINISH is intended to cause a "synch" after a tool change, ie make sure that the readeahed queue is emptied and recalculated with new tool data.

I don't think we are seeing the line where the actual error occurs in any of the messages. But I could be wrong.

@dhweizel
Copy link
Author

dhweizel commented Dec 10, 2016

If I undertand correctly the error is related to the re execution of the epilog.
I traced back the apparition of the error to this commit of the file src/emc/rs274ngc/interp_o_word.cc

44377d8

When a python epilog returns INTERP_EXECUTE_FINISH:

  • Set the executing block call type to CT_REMAP so the next read()
    skips, and
  • Return control to task.

The next call to execute() will resume epilog execution.

Signed-off-by: John Morris john@zultron.com

@zultron
Copy link
Contributor

zultron commented Dec 10, 2016

@dhweizel Thanks for reporting this. I'm going to have a little trouble finding time to look at this before January, but I'll try. I'm very sorry you must have had to look at this extremely hairy part of the codebase!

@dhweizel
Copy link
Author

@zultron Thanks for your quick response. I wish to add that Andy found that the error shows more easy if you just just open sim/remap/rack
toolchange because the preview.

The code IS very complex but the variety of different log functions amazed me

@zultron
Copy link
Contributor

zultron commented Jan 4, 2017

@dhwiezel, the error turns out to be in stdglue.py in the change_epilog() function, which was not properly written as a python generator function. You can fix the function by replacing all return INTERP_* lines with yield INTERP_*, as I did in PR #221 (which should automatically close this issue as soon as it is merged).

Thanks again for the hard work you did to track down and report this problem. That made it a lot easier to reproduce and fix.

@dhweizel
Copy link
Author

dhweizel commented Jan 4, 2017

Good news !!!
I'm glad I was able to help.

@cradek cradek closed this as completed in 3b5c5d9 Jan 4, 2017
zultron added a commit to zultron/machinekit that referenced this issue Nov 19, 2017
The functionality to return `INTERP_EXECUTE_FINISH` in a python remap
function has always existed, but was broken until PR
LinuxCNC#135.

The fix revealed a bug in the standard remap `change_epilog()`
function, which was not written as a python generator function.

Thanks to @dhwiezel for discovering and reporting this bug.  Fixes
LinuxCNC#217.

Signed-off-by: John Morris john@zultron.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants