Discussion:
[Emc-users] Persistent tool number
propcoder
2013-07-21 07:19:20 UTC
Permalink
I almost finished my rack tool changer setup using development branch
and remap of M6.

What I miss now is tool number persistence between sessions. I tried to
add #5400 (tool_in_spindle) to .var file. It does update the tool number
on the file, but it does not take this value on start-up.

I think my client will not like tool collisions.. :)
What would you recommend?
Andy Pugh
2013-07-21 09:43:45 UTC
Permalink
Post by propcoder
tried to
add #5400 (tool_in_spindle) to .var file. It does update the tool number
on the file, but it does not take this value on start-up.
I don't know if this will work, but I would be trying an M61 T#5400 in the STARTUP_GCODES in the INI.
propcoder
2013-07-22 10:02:06 UTC
Permalink
I added one line to my .ini file like this:

[RS274NGC]
RS274NGC_STARTUP_CODE = M61 Q2

And it does not start:

Print file information:
RUN_IN_PLACE=no
LINUXCNC_DIR=
LINUXCNC_BIN_DIR=/usr/bin
LINUXCNC_TCL_DIR=/usr/lib/tcltk/linuxcnc
LINUXCNC_SCRIPT_DIR=
LINUXCNC_RTLIB_DIR=/usr/realtime-2.6.32-122-rtai/modules/linuxcnc
LINUXCNC_CONFIG_DIR=
LINUXCNC_LANG_DIR=/usr/share/linuxcnc/tcl/msgs
INIVAR=inivar
HALCMD=halcmd
LINUXCNC_EMCSH=/usr/bin/wish8.5
LINUXCNC - 2.6.0-pre0-4596-g9419289
Machine configuration directory is
'/home/cnc/linuxcnc/configs/sim2.6/remap/rack-toolchange'
Machine configuration file is 'racktoolchange.ini'
INIFILE=/home/cnc/linuxcnc/configs/sim2.6/remap/rack-toolchange/racktoolchange.ini
PARAMETER_FILE=sim_mm.var
TASK=milltask
HALUI=halui
DISPLAY=axis
Starting LinuxCNC...
Starting LinuxCNC server program: linuxcncsvr
Loading Real Time OS, RTAPI, and HAL_LIB modules
Starting LinuxCNC IO program: io
io started
halcmd loadusr io started
Starting HAL User Interface program: halui
Starting TASK program: milltask
task pid=5054
Starting DISPLAY program: axis
emcTaskInit: using builtin interpreter
waiting for s.axes
waiting for s.axes
waiting for s.axes
waiting for s.axes
waiting for s.axes
waiting for s.axes
waiting for s.axes
waiting for s.axes
waiting for s.axes
Shutting down and cleaning up LinuxCNC...
Killing task linuxcncsvr, PID=5001
Killing task milltask, PID=5054
Timeout, trying kill -9
Removing HAL_LIB, RTAPI, and Real Time OS modules
Removing NML shared memory segments
Cleanup done

Debug file information:
Can not find -sec MOT -var MOT -num 1
Can not find -sec IO -var IO -num 1
Can not find -sec LINUXCNC -var NML_FILE -num 1
Can not find -sec EMC -var NML_FILE -num 1
A configuration error is preventing LinuxCNC from starting.
More information may be available when running from a terminal.
5001
PID TTY STAT TIME COMMAND
5054
PID TTY STAT TIME COMMAND
5054 ? R 0:06 milltask -ini
/home/cnc/linuxcnc/configs/sim2.6/remap/rack-toolchange/racktoolchange.ini
PID TTY STAT TIME COMMAND
5054 ? R 0:06 milltask -ini
/home/cnc/linuxcnc/configs/sim2.6/remap/rack-toolchange/racktoolchange.ini
PID TTY STAT TIME COMMAND
5054 ? R 0:06 milltask -ini
/home/cnc/linuxcnc/configs/sim2.6/remap/rack-toolchange/racktoolchange.ini
PID TTY STAT TIME COMMAND
5054 ? R 0:06 milltask -ini
/home/cnc/linuxcnc/configs/sim2.6/remap/rack-toolchange/racktoolchange.ini
PID TTY STAT TIME COMMAND
5054 ? R 0:06 milltask -ini
/home/cnc/linuxcnc/configs/sim2.6/remap/rack-toolchange/racktoolchange.ini
PID TTY STAT TIME COMMAND
5054 ? R 0:06 milltask -ini
/home/cnc/linuxcnc/configs/sim2.6/remap/rack-toolchange/racktoolchange.ini
PID TTY STAT TIME COMMAND
5054 ? R 0:06 milltask -ini
/home/cnc/linuxcnc/configs/sim2.6/remap/rack-toolchange/racktoolchange.ini
PID TTY STAT TIME COMMAND
5054 ? R 0:07 milltask -ini
/home/cnc/linuxcnc/configs/sim2.6/remap/rack-toolchange/racktoolchange.ini
PID TTY STAT TIME COMMAND
5054 ? R 0:07 milltask -ini
/home/cnc/linuxcnc/configs/sim2.6/remap/rack-toolchange/racktoolchange.ini
PID TTY STAT TIME COMMAND
5054 ? R 0:07 milltask -ini
/home/cnc/linuxcnc/configs/sim2.6/remap/rack-toolchange/racktoolchange.ini
PID TTY STAT TIME COMMAND
5054 ? R 0:07 milltask -ini
/home/cnc/linuxcnc/configs/sim2.6/remap/rack-toolchange/racktoolchange.ini
PID TTY STAT TIME COMMAND
5054 ? R 0:07 milltask -ini
/home/cnc/linuxcnc/configs/sim2.6/remap/rack-toolchange/racktoolchange.ini
PID TTY STAT TIME COMMAND
5054 ? R 0:07 milltask -ini
/home/cnc/linuxcnc/configs/sim2.6/remap/rack-toolchange/racktoolchange.ini
PID TTY STAT TIME COMMAND
5054 ? R 0:07 milltask -ini
/home/cnc/linuxcnc/configs/sim2.6/remap/rack-toolchange/racktoolchange.ini
PID TTY STAT TIME COMMAND
5054 ? R 0:07 milltask -ini
/home/cnc/linuxcnc/configs/sim2.6/remap/rack-toolchange/racktoolchange.ini
PID TTY STAT TIME COMMAND
5054 ? R 0:08 milltask -ini
/home/cnc/linuxcnc/configs/sim2.6/remap/rack-toolchange/racktoolchange.ini
PID TTY STAT TIME COMMAND
5054 ? R 0:08 milltask -ini
/home/cnc/linuxcnc/configs/sim2.6/remap/rack-toolchange/racktoolchange.ini
PID TTY STAT TIME COMMAND
5054 ? R 0:08 milltask -ini
/home/cnc/linuxcnc/configs/sim2.6/remap/rack-toolchange/racktoolchange.ini
PID TTY STAT TIME COMMAND
5054 ? R 0:08 milltask -ini
/home/cnc/linuxcnc/configs/sim2.6/remap/rack-toolchange/racktoolchange.ini
PID TTY STAT TIME COMMAND
/usr/bin/linuxcnc: line 396: 5054 Killed $EMCTASK -ini
"$INIFILE"
Stopping realtime threads
Unloading hal components

Kernel message information:
[ 4167.850578] I-pipe: Domain RTAI registered.
[ 4167.850591] RTAI[hal]: <3.8.1> mounted over IPIPE-NOTHREADS 2.6-03.
[ 4167.850595] RTAI[hal]: compiled with gcc version 4.4.3 (Ubuntu
4.4.3-4ubuntu5) .
[ 4167.850679] RTAI[hal]: mounted (IPIPE-NOTHREADS, IMMEDIATE (INTERNAL
IRQs DISPATCHED), ISOL_CPUS_MASK: 0).
[ 4167.850683] PIPELINE layers:
[ 4167.850688] f9b8ae20 9ac15d93 RTAI 200
[ 4167.850692] c085cb20 0 Linux 100
[ 4167.882666] RTAI[malloc]: global heap size = 2097152 bytes, <BSD>.
[ 4167.882898] RTAI[sched]: IMMEDIATE, MP, USER/KERNEL SPACE: <with RTAI
OWN KTASKs>, kstacks pool size = 524288 bytes.
[ 4167.882909] RTAI[sched]: hard timer type/freq = APIC/12477250(Hz);
default timing: periodic; linear timed lists.
[ 4167.882915] RTAI[sched]: Linux timer freq = 250 (Hz), TimeBase freq =
1596961000 hz.
[ 4167.882920] RTAI[sched]: timer setup = 999 ns, resched latency = 2944 ns.
[ 4167.883034] RTAI[usi]: enabled.
[ 4167.950258] RTAI[math]: loaded.
[ 4176.885745] RTAI[math]: unloaded.
[ 4176.930135] SCHED releases registered named ALIEN RTGLBH
[ 4176.960379] RTAI[malloc]: unloaded.
[ 4177.060047] RTAI[sched]: unloaded (forced hard/soft/hard transitions:
traps 0, syscalls 0).
[ 4177.063958] I-pipe: Domain RTAI unregistered.
[ 4177.064069] RTAI[hal]: unmounted.
Post by Andy Pugh
Post by propcoder
tried to
add #5400 (tool_in_spindle) to .var file. It does update the tool number
on the file, but it does not take this value on start-up.
I don't know if this will work, but I would be trying an M61 T#5400 in the STARTUP_GCODES in the INI.
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
Michael Haberler
2013-07-22 14:37:41 UTC
Permalink
Post by Andy Pugh
Post by propcoder
tried to
add #5400 (tool_in_spindle) to .var file. It does update the tool number
on the file, but it does not take this value on start-up.
I don't know if this will work, but I would be trying an M61 T#5400 in the STARTUP_GCODES in the INI.
very unlikely that it will, the interpreter environment is severely limited in this phase - a user-defined startup and shutdown sequence on my long-term list of dead bodies with a smell and due for removal

for now, since you are using remapping, you could look into saving and restoring the toolnumber in some ini file through Python methods - for instance in the main section of the TOPLEVEL file

-m
Post by Andy Pugh
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Emc-users mailing list
https://lists.sourceforge.net/lists/listinfo/emc-users
propcoder
2013-07-28 10:04:14 UTC
Permalink
This looks too complex for me now. Besides, it may be useful to save
some parameters without using remap.

Can I save / restore toolnumber using Parameter saver component? I can't
find any hal input pin to which I could connect paramsaver.outvalueS-000
for example.

http://wiki.linuxcnc.org/cgi-bin/wiki.pl?ContributedComponents#Parameter_Saver
Post by Michael Haberler
for now, since you are using remapping, you could look into saving and restoring the toolnumber in some ini file through Python methods - for instance in the main section of the TOPLEVEL file
Michael Haberler
2013-07-28 11:10:15 UTC
Permalink
the issue with this approach is: the interpreter is the wrong place to apply initial tool state start conditions

assume you somehow set the initial tool number in the interpreter and then you turn the machine on:

- you have state of the machine, and state of the interpreter.
- the interpreter initially sync()s to the machine state
- the change of interpreter state gets overwritten right away

with the current hoplelessly convoluted tool logic, the only realistic chance I have verified to work is to implement saving and restoring of initial tool state for nonrandom TC's is in src/emc/iotask/iocontrol* proper

an outline:

- add an ini option to trigger iocontrol to save tool number somewhere - suggestion: start with a separate ini file
- on shutdown, make iocontrol save the tool number if option set
- on startup, if option present, inspect the saved state and set initial tool number plus offsets

this will cause the interpreter to pick up the saved tool number and offsets on initial sync()


- Michael
Post by Andy Pugh
Post by propcoder
tried to
add #5400 (tool_in_spindle) to .var file. It does update the tool number
on the file, but it does not take this value on start-up.
I don't know if this will work, but I would be trying an M61 T#5400 in the STARTUP_GCODES in the INI.
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Emc-users mailing list
https://lists.sourceforge.net/lists/listinfo/emc-users
Loading...