задать движение через внешний скрипт?

Обсуждение установки, настройки и использования LinuxCNC. Вопросы по Gкоду.
magrelo
Кандидат
Сообщения: 42
Зарегистрирован: 27 ноя 2015, 11:53
Репутация: 0
Настоящее имя: Andrey
Контактная информация:

задать движение через внешний скрипт?

Сообщение magrelo »

Стоит задача: по M101 команде через bash скрипт запустить свою программу по анализу изображения с камеры, которая возвращает значение смещения станка и сместиться в новую позицию. Станок сконфигурирован для работы с mesa7i76.

Пытаюсь для начала просто в M101 задать перемещение в координату, или поменять значение 0 в системе координат G54.
В MDI режиме это все делается. А можно ли из внешнего скрипта задать движение в точку или задать новый ноль?
Типа halcmd setp что_то_там_внутри новые координаты???
Понимания совместной работы внутренних компонентов в плане задания движения пока не достаточно :(.

И еще непонятно как hal командой имитировать нажатие кнопки в верхнем тулбаре (пересчитать текущий файл [ctrl + R]), чтобы графическое отображение траектории переместилось в соответствие с новой системой координат по G10.
nkp
Мастер
Сообщения: 8340
Зарегистрирован: 28 ноя 2011, 00:25
Репутация: 1589
Контактная информация:

Re: задать движение через внешний скрипт?

Сообщение nkp »

в M101:

Код: Выделить всё

#!/usr/bin/python

import linuxcnc
c = linuxcnc.command() 


c.mode(linuxcnc.MODE_MDI)
c.wait_complete() 
c.mdi("G0 X10")
http://linuxcnc.org/docs/2.7/html/confi ... rface.html
nkp
Мастер
Сообщения: 8340
Зарегистрирован: 28 ноя 2011, 00:25
Репутация: 1589
Контактная информация:

Re: задать движение через внешний скрипт?

Сообщение nkp »

файл M101 должен быть исполниямым,
и лежать в папке,указанной в ини файле :
PROGRAM_PREFIX = /путь/к/папке
magrelo
Кандидат
Сообщения: 42
Зарегистрирован: 27 ноя 2015, 11:53
Репутация: 0
Настоящее имя: Andrey
Контактная информация:

Re: задать движение через внешний скрипт?

Сообщение magrelo »

делать через python я бы сам не догадался, спасибо )))
т.е. через halcmd такие вещи вообще нельзя делать или это как один из вариантов?
Отдельно сам скрипт работает, если в свойствах файла указать - что программа для запуска python.
А вот из linuxcnc не хочет пока..
исполняемыми можно делать сценарии оболочки #!/bin/bash
как быть с pythonом буду разбираться
magrelo
Кандидат
Сообщения: 42
Зарегистрирован: 27 ноя 2015, 11:53
Репутация: 0
Настоящее имя: Andrey
Контактная информация:

Re: задать движение через внешний скрипт?

Сообщение magrelo »

Все работает, просто я python непривильно писал ).
А по второму вопросу про нажатие кнопки в верхнем тулбаре (пересчитать текущий файл [ctrl + R]), чтобы графическое отображение траектории переместилось в соответствие с измененной системой координат. Как это сделать через python? Как эта команда может называться?
nkp
Мастер
Сообщения: 8340
Зарегистрирован: 28 ноя 2011, 00:25
Репутация: 1589
Контактная информация:

Re: задать движение через внешний скрипт?

Сообщение nkp »

как бы должно было бы так работать:

Код: Выделить всё

def user_live_update():       
    if ucomp["filereload"] == 1:
        root_window.event_generate("<<btn-reload-file>>")


if hal_present == 1 :
    ucomp = hal.component("axisui.user")
    ucomp.newpin("m-p",hal.HAL_BIT,hal.HAL_IN)
    ucomp.newpin("filereload",hal.HAL_BIT,hal.HAL_IN)
    ucomp.ready()

root_window.bind("<<btn-reload-file>>", commands.reload_file)
(это в .axisrc файл писать)
но не работает - какая то ошибка с progress:

Код: Выделить всё

 File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1413, in __call__
    return self.func(*args)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1988, in reload_file
    reload_file()
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1698, in reload_file
    open_file_guts(loaded_file, False, False)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1164, in open_file_guts
    root_window.tk.call("destroy", ".info.progress")
Аватара пользователя
Serg
Мастер
Сообщения: 21923
Зарегистрирован: 17 апр 2012, 14:58
Репутация: 5183
Заслуга: c781c134843e0c1a3de9
Настоящее имя: Сергей
Откуда: Москва
Контактная информация:

Re: задать движение через внешний скрипт?

Сообщение Serg »

nkp писал(а):но не работает - какая то ошибка с progress:
Ты специально не скопипастил начало сообщения об ошибке, чтобы мы сами угадали? :)
Я не Христос, рыбу не раздаю, но могу научить, как сделать удочку...
nkp
Мастер
Сообщения: 8340
Зарегистрирован: 28 ноя 2011, 00:25
Репутация: 1589
Контактная информация:

Re: задать движение через внешний скрипт?

Сообщение nkp »

UAVpilot писал(а):Ты специально не скопипастил начало сообщения об ошибке, чтобы мы сами угадали?

Код: Выделить всё

nkp@nkp-desktop:~/linuxcnc-reverse-run/scripts$ ./linuxcnc
LINUXCNC - 2.7.0~pre7
using image /home/nkp/linuxcnc/configs/G71/G71.gif
Machine configuration directory is '/home/nkp/linuxcnc/configs/G71'
Machine configuration file is 'G71.ini'
Starting LinuxCNC...
Found file(REL): ./core_sim.hal
/home/nkp/linuxcnc/configs/G71/G71.ini:98: executing 'import sys
sys.path.insert(0,"python")'
PythonPlugin: Python  '2.7.3 (default, Oct 26 2016, 21:19:34) 
[GCC 4.6.3]'
RTAPI: ERROR: Unexpected realtime delay on task 1
This Message will only display once per session.
Run the Latency Test and resolve before continuing.

/home/nkp/linuxcnc/configs/G71/G71.ini:98: executing 'import sys
sys.path.insert(0,"python")'
PythonPlugin: Python  '2.7.3 (default, Oct 26 2016, 21:19:34) 
[GCC 4.6.3]'
is_callable(remap.g712) = TRUE
is_callable(__init__) = FALSE
/home/nkp/linuxcnc/configs/G71/G71.ini:98: executing 'import sys
sys.path.insert(0,"python")'
PythonPlugin: Python  '2.7.3 (default, Oct 26 2016, 21:19:34) 
[GCC 4.6.3]'
is_callable(remap.g712) = TRUE
radeon: Acquired access to Hyper-Z.
task: main loop took 0.010889 seconds
task: main loop took 0.013789 seconds
task: main loop took 0.013829 seconds
task: main loop took 0.018516 seconds
/home/nkp/linuxcnc/configs/G71/G71.ini:98: executing 'import sys
sys.path.insert(0,"python")'
PythonPlugin: Python  '2.7.3 (default, Oct 26 2016, 21:04:23) 
[GCC 4.6.3]'
is_callable(remap.g712) = TRUE
is_callable(__init__) = FALSE
is_callable(oword.taper-thread) = FALSE
task: main loop took 0.013123 seconds
task: main loop took 0.013335 seconds
/home/nkp/linuxcnc/configs/G71/G71.ini:98: executing 'import sys
sys.path.insert(0,"python")'
PythonPlugin: Python  '2.7.3 (default, Oct 26 2016, 21:04:23) 
[GCC 4.6.3]'
is_callable(remap.g712) = TRUE
is_callable(__init__) = FALSE
is_callable(oword.taper-thread) = FALSE
task: main loop took 0.013918 seconds
task: main loop took 0.013660 seconds
task: main loop took 0.013786 seconds
task: main loop took 0.013765 seconds
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1413, in __call__
    return self.func(*args)
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 498, in callit
    func(*args)
  File "/home/nkp/linuxcnc-reverse-run/lib/python/vcpparse.py", line 154, in updater
    a.update(pycomp)
  File "/home/nkp/linuxcnc-reverse-run/lib/python/pyvcp_widgets.py", line 1494, in update
    pycomp[self.halpin+"-f"]=self.get()
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 2746, in get
    value = self.tk.call(self._w, 'get')
TclError: invalid command name ".176157580.176232780.176337804.176338124"
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1413, in __call__
    return self.func(*args)
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 498, in callit
    func(*args)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 775, in update
    root_window.update_idletasks()
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 919, in update_idletasks
    self.tk.call('update', 'idletasks')
TclError: can't invoke "update" command:  application has been destroyed
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1413, in __call__
    return self.func(*args)
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 498, in callit
    func(*args)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 513, in actual_tkRedraw
    self.tkRedraw_ortho()
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 475, in tkRedraw_ortho
    self.redraw_ortho()
  File "/home/nkp/linuxcnc-reverse-run/lib/python/rs274/glcanon.py", line 312, in inner
    self.activate()
  File "/home/nkp/linuxcnc-reverse-run/lib/python/rs274/OpenGLTk.py", line 223, in activate
    self.tk.call(self._w, 'makecurrent')
TclError: invalid command name ".pane.top.right.fpreview.170406700"
can't read "data(pages)": no such variable
    while executing
"foreach page $data(pages) {
        Widget::destroy $path.f$page
    }"
    (procedure "NoteBook::_destroy" line 5)
    invoked from within
"NoteBook::_destroy .#BWidget.#Class#NoteBook"
    (command bound to event)
Exception _tkinter.TclError: 'can\'t invoke "winfo" command:  application has been destroyed' in <bound method Progress.__del__ of <__main__.Progress instance at 0xabd9c8c>> ignored
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1413, in __call__
    return self.func(*args)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1988, in reload_file
    reload_file()
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1698, in reload_file
    open_file_guts(loaded_file, False, False)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1164, in open_file_guts
    root_window.tk.call("destroy", ".info.progress")
TclError: can't invoke "destroy" command:  application has been destroyed
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1413, in __call__
    return self.func(*args)
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 498, in callit
    func(*args)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 775, in update
    root_window.update_idletasks()
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 919, in update_idletasks
    self.tk.call('update', 'idletasks')
TclError: can't invoke "update" command:  application has been destroyed
Exception _tkinter.TclError: 'can\'t invoke "winfo" command:  application has been destroyed' in <bound method Progress.__del__ of <__main__.Progress instance at 0xabd9a2c>> ignored
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1413, in __call__
    return self.func(*args)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1988, in reload_file
    reload_file()
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1698, in reload_file
    open_file_guts(loaded_file, False, False)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1164, in open_file_guts
    root_window.tk.call("destroy", ".info.progress")
TclError: can't invoke "destroy" command:  application has been destroyed
Exception _tkinter.TclError: 'can\'t invoke "winfo" command:  application has been destroyed' in <bound method Progress.__del__ of <__main__.Progress instance at 0xabd982c>> ignored
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1413, in __call__
    return self.func(*args)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1988, in reload_file
    reload_file()
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1698, in reload_file
    open_file_guts(loaded_file, False, False)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1164, in open_file_guts
    root_window.tk.call("destroy", ".info.progress")
TclError: can't invoke "destroy" command:  application has been destroyed
Exception _tkinter.TclError: 'can\'t invoke "winfo" command:  application has been destroyed' in <bound method Progress.__del__ of <__main__.Progress instance at 0xabd962c>> ignored
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1413, in __call__
    return self.func(*args)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1988, in reload_file
    reload_file()
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1698, in reload_file
    open_file_guts(loaded_file, False, False)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1164, in open_file_guts
    root_window.tk.call("destroy", ".info.progress")
TclError: can't invoke "destroy" command:  application has been destroyed
Exception _tkinter.TclError: 'can\'t invoke "winfo" command:  application has been destroyed' in <bound method Progress.__del__ of <__main__.Progress instance at 0xabd942c>> ignored
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1413, in __call__
    return self.func(*args)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1988, in reload_file
    reload_file()
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1698, in reload_file
    open_file_guts(loaded_file, False, False)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1164, in open_file_guts
    root_window.tk.call("destroy", ".info.progress")
TclError: can't invoke "destroy" command:  application has been destroyed
Exception _tkinter.TclError: 'can\'t invoke "winfo" command:  application has been destroyed' in <bound method Progress.__del__ of <__main__.Progress instance at 0xabd922c>> ignored
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1413, in __call__
    return self.func(*args)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1988, in reload_file
    reload_file()
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1698, in reload_file
    open_file_guts(loaded_file, False, False)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1164, in open_file_guts
    root_window.tk.call("destroy", ".info.progress")
TclError: can't invoke "destroy" command:  application has been destroyed
Exception _tkinter.TclError: 'can\'t invoke "winfo" command:  application has been destroyed' in <bound method Progress.__del__ of <__main__.Progress instance at 0xabd902c>> ignored
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1413, in __call__
    return self.func(*args)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1988, in reload_file
    reload_file()
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1698, in reload_file
    open_file_guts(loaded_file, False, False)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1164, in open_file_guts
    root_window.tk.call("destroy", ".info.progress")
TclError: can't invoke "destroy" command:  application has been destroyed
Exception _tkinter.TclError: 'can\'t invoke "winfo" command:  application has been destroyed' in <bound method Progress.__del__ of <__main__.Progress instance at 0xabd2e0c>> ignored
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1413, in __call__
    return self.func(*args)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1988, in reload_file
    reload_file()
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1698, in reload_file
    open_file_guts(loaded_file, False, False)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1164, in open_file_guts
    root_window.tk.call("destroy", ".info.progress")
TclError: can't invoke "destroy" command:  application has been destroyed
Exception _tkinter.TclError: 'can\'t invoke "winfo" command:  application has been destroyed' in <bound method Progress.__del__ of <__main__.Progress instance at 0xabd2c0c>> ignored
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1413, in __call__
    return self.func(*args)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1988, in reload_file
    reload_file()
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1698, in reload_file
    open_file_guts(loaded_file, False, False)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1164, in open_file_guts
    root_window.tk.call("destroy", ".info.progress")
TclError: can't invoke "destroy" command:  application has been destroyed
Exception _tkinter.TclError: 'can\'t invoke "winfo" command:  application has been destroyed' in <bound method Progress.__del__ of <__main__.Progress instance at 0xabd288c>> ignored
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1413, in __call__
    return self.func(*args)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1988, in reload_file
    reload_file()
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1698, in reload_file
    open_file_guts(loaded_file, False, False)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1164, in open_file_guts
    root_window.tk.call("destroy", ".info.progress")
TclError: can't invoke "destroy" command:  application has been destroyed
Exception _tkinter.TclError: 'can\'t invoke "winfo" command:  application has been destroyed' in <bound method Progress.__del__ of <__main__.Progress instance at 0xabd250c>> ignored
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1413, in __call__
    return self.func(*args)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1988, in reload_file
    reload_file()
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1698, in reload_file
    open_file_guts(loaded_file, False, False)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1164, in open_file_guts
    root_window.tk.call("destroy", ".info.progress")
TclError: can't invoke "destroy" command:  application has been destroyed
Exception _tkinter.TclError: 'can\'t invoke "winfo" command:  application has been destroyed' in <bound method Progress.__del__ of <__main__.Progress instance at 0xabd218c>> ignored
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1413, in __call__
    return self.func(*args)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1988, in reload_file
    reload_file()
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1698, in reload_file
    open_file_guts(loaded_file, False, False)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1164, in open_file_guts
    root_window.tk.call("destroy", ".info.progress")
TclError: can't invoke "destroy" command:  application has been destroyed
Exception _tkinter.TclError: 'can\'t invoke "winfo" command:  application has been destroyed' in <bound method Progress.__del__ of <__main__.Progress instance at 0xabcadec>> ignored
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1413, in __call__
    return self.func(*args)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1988, in reload_file
    reload_file()
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1698, in reload_file
    open_file_guts(loaded_file, False, False)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1164, in open_file_guts
    root_window.tk.call("destroy", ".info.progress")
TclError: can't invoke "destroy" command:  application has been destroyed
Exception _tkinter.TclError: 'can\'t invoke "winfo" command:  application has been destroyed' in <bound method Progress.__del__ of <__main__.Progress instance at 0xabcaaac>> ignored
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1413, in __call__
    return self.func(*args)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1988, in reload_file
    reload_file()
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1698, in reload_file
    open_file_guts(loaded_file, False, False)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1164, in open_file_guts
    root_window.tk.call("destroy", ".info.progress")
TclError: can't invoke "destroy" command:  application has been destroyed
Exception _tkinter.TclError: 'can\'t invoke "winfo" command:  application has been destroyed' in <bound method Progress.__del__ of <__main__.Progress instance at 0xabca76c>> ignored
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1413, in __call__
    return self.func(*args)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1988, in reload_file
    reload_file()
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1698, in reload_file
    open_file_guts(loaded_file, False, False)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1164, in open_file_guts
    root_window.tk.call("destroy", ".info.progress")
TclError: can't invoke "destroy" command:  application has been destroyed
Exception _tkinter.TclError: 'can\'t invoke "winfo" command:  application has been destroyed' in <bound method Progress.__del__ of <__main__.Progress instance at 0xabca42c>> ignored
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1413, in __call__
    return self.func(*args)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1988, in reload_file
    reload_file()
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1698, in reload_file
    open_file_guts(loaded_file, False, False)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1164, in open_file_guts
    root_window.tk.call("destroy", ".info.progress")
TclError: can't invoke "destroy" command:  application has been destroyed
Exception _tkinter.TclError: 'can\'t invoke "winfo" command:  application has been destroyed' in <bound method Progress.__del__ of <__main__.Progress instance at 0xabca0ec>> ignored
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1413, in __call__
    return self.func(*args)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1988, in reload_file
    reload_file()
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1698, in reload_file
    open_file_guts(loaded_file, False, False)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1164, in open_file_guts
    root_window.tk.call("destroy", ".info.progress")
TclError: can't invoke "destroy" command:  application has been destroyed
Exception _tkinter.TclError: 'can\'t invoke "winfo" command:  application has been destroyed' in <bound method Progress.__del__ of <__main__.Progress instance at 0xabc3d8c>> ignored
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1413, in __call__
    return self.func(*args)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1988, in reload_file
    reload_file()
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1698, in reload_file
    open_file_guts(loaded_file, False, False)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1164, in open_file_guts
    root_window.tk.call("destroy", ".info.progress")
TclError: can't invoke "destroy" command:  application has been destroyed
Exception _tkinter.TclError: 'can\'t invoke "winfo" command:  application has been destroyed' in <bound method Progress.__del__ of <__main__.Progress instance at 0xabc3a4c>> ignored
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1413, in __call__
    return self.func(*args)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1988, in reload_file
    reload_file()
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1698, in reload_file
    open_file_guts(loaded_file, False, False)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1164, in open_file_guts
    root_window.tk.call("destroy", ".info.progress")
TclError: can't invoke "destroy" command:  application has been destroyed
Exception _tkinter.TclError: 'can\'t invoke "winfo" command:  application has been destroyed' in <bound method Progress.__del__ of <__main__.Progress instance at 0xabc374c>> ignored
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1413, in __call__
    return self.func(*args)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1988, in reload_file
    reload_file()
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1698, in reload_file
    open_file_guts(loaded_file, False, False)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1164, in open_file_guts
    root_window.tk.call("destroy", ".info.progress")
TclError: can't invoke "destroy" command:  application has been destroyed
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1413, in __call__
    return self.func(*args)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1988, in reload_file
    reload_file()
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1698, in reload_file
    open_file_guts(loaded_file, False, False)
  File "/home/nkp/linuxcnc-reverse-run/bin/axis", line 1164, in open_file_guts
    root_window.tk.call("destroy", ".info.progress")
TclError: can't invoke "destroy" command:  application has been destroyed
Shutting down and cleaning up LinuxCNC...
task: 15029 cycles, min=0.000024, max=0.018516, avg=0.002067, 48 latency excursions (> 10x expected cycle time of 0.001000s)
is_callable(__delete__) = FALSE
ULAPI: WARNING: module 'HAL_classicladder' failed to delete shmem 03
ERROR CLASSICLADDER-   Error intializing classicladder user module.
nkp@nkp-desktop:~/linuxcnc-reverse-run/scripts$ 
Аватара пользователя
Serg
Мастер
Сообщения: 21923
Зарегистрирован: 17 апр 2012, 14:58
Репутация: 5183
Заслуга: c781c134843e0c1a3de9
Настоящее имя: Сергей
Откуда: Москва
Контактная информация:

Re: задать движение через внешний скрипт?

Сообщение Serg »

Код: Выделить всё

...
Exception in Tkinter callback
...
TclError: invalid command name ".176157580.176232780.176337804.176338124"
...
Так понятнее? :)
Я не Христос, рыбу не раздаю, но могу научить, как сделать удочку...
nkp
Мастер
Сообщения: 8340
Зарегистрирован: 28 ноя 2011, 00:25
Репутация: 1589
Контактная информация:

Re: задать движение через внешний скрипт?

Сообщение nkp »

UAVpilot писал(а):Так понятнее?
нет ;)
поиск по подобным ошибкам говорит ,что обращаемся к элементу(окну?) ,который уже уничтожен...
получается ,что нам ,как бы,нужно только один раз вызвать функцию перезагрузки нашего файла жкода,а мы,
вставив ее user_live_update() вызываем ее в цикле...

попробовав как то так:

Код: Выделить всё

ste = 1
def user_live_update():
    global ste       
    if ucomp["filereload"] :
        if ste:
            ste -= ste     
            reload_file()
    else:
        ste = 1

if hal_present == 1 :
    ucomp = hal.component("axisui.user")
    ucomp.newpin("filereload",hal.HAL_BIT,hal.HAL_IN)
    ucomp.ready()
оно заработало лучше,но кнопка PyVCP (net btn1 axisui.user.filereload pyvcp.x-plus) странно ведет себя - "отпускается" не сразу
может ,если активировать пин axisui.user.filereload не от кнопки панели , то и все будет нормально ...
Аватара пользователя
Serg
Мастер
Сообщения: 21923
Зарегистрирован: 17 апр 2012, 14:58
Репутация: 5183
Заслуга: c781c134843e0c1a3de9
Настоящее имя: Сергей
Откуда: Москва
Контактная информация:

Re: задать движение через внешний скрипт?

Сообщение Serg »

nkp писал(а):поиск по подобным ошибкам говорит ,что обращаемся к элементу(окну?) ,который уже уничтожен...
Примерно так. В чистом Tcl/Tk это означает ошибку программиста. C TkInter сложнее - там есть прослойка для связи с Python, возможно в ней что-то не так, я ей в кишочки не заглядывал...
nkp писал(а):кнопка PyVCP (net btn1 axisui.user.filereload pyvcp.x-plus) странно ведет себя - "отпускается" не сразу
Возможно программа в это время чем-то занята и не выполняет обновление виджета.
Я не Христос, рыбу не раздаю, но могу научить, как сделать удочку...
magrelo
Кандидат
Сообщения: 42
Зарегистрирован: 27 ноя 2015, 11:53
Репутация: 0
Настоящее имя: Andrey
Контактная информация:

Re: задать движение через внешний скрипт?

Сообщение magrelo »

В продолжение темы: внешний скрипт по М101 команде срабатывает, программа на python захватывает видео картинку, определяет координаты и станок смещается, все работает ))). При захвате картинки остается файл img.jpg с изображением того что захватывалось. Теперь пытаюсь эту картинку приладить в glade панель. Я правильно думаю что надо создать виджет (не hal) который отображает img.jpg а потом найти и переопределить функцию update_widget какую-нить, чтобы вызывать ее после того, как img.jpg поменялся при новом вызове M101?
Ответить

Вернуться в «LinuxCNC»