- Posts: 4819
- Thank you received: 2177
Problems with including comp userspace application file to LinuxCNC project
3 years 2 months ago #279551
by Aciera
Replied by Aciera on topic Problems with including comp userspace application file to LinuxCNC project
I'm not familiar with that pendant so I'm afraid I can't really help much with that issue. You might want to open a new topic with an appropriate title to reach more users.
Please Log in or Create an account to join the conversation.
3 years 2 months ago #279647
by Aciera
Replied by Aciera on topic Problems with including comp userspace application file to LinuxCNC project
I'm sorry I forgot the debug questions. I'm not much of a programmer but you can enable debug levels in the ini like this:
[EMC]
# Version of this INI file
VERSION = 1.1
# Name of machine, for use with display, etc.
MACHINE = LinuxCNC-HAL-SIM-AXIS
# Debug level, 0 means no messages. See src/emc/nml_int/emcglb.h for others
#define EMC_DEBUG_CONFIG 0x00000002
#define EMC_DEBUG_VERSIONS 0x00000008
#define EMC_DEBUG_TASK_ISSUE 0x00000010
#define EMC_DEBUG_NML 0x00000040
#define EMC_DEBUG_MOTION_TIME 0x00000080
#define EMC_DEBUG_INTERP 0x00000100
#define EMC_DEBUG_RCS 0x00000200
#define EMC_DEBUG_INTERP_LIST 0x00000800
#define EMC_DEBUG_IOCONTROL 0x00001000
#define EMC_DEBUG_OWORD 0x00002000
#define EMC_DEBUG_REMAP 0x00004000
#define EMC_DEBUG_PYTHON 0x00008000
#define EMC_DEBUG_NAMEDPARAM 0x00010000
#define EMC_DEBUG_GDBONSIGNAL 0x00020000
#define EMC_DEBUG_PYTHON_TASK 0x00040000
#define EMC_DEBUG_ALL 0x7FFFFFFF /* it's an int for %i to work
DEBUG = 0x00002000
#DEBUG = 0
Not sure how to get that to write to a file other than:
linuxcnc > output.txt
As for own code, I usually heavily use print() for python or rtapi_print() for kinematic components.
[EMC]
# Version of this INI file
VERSION = 1.1
# Name of machine, for use with display, etc.
MACHINE = LinuxCNC-HAL-SIM-AXIS
# Debug level, 0 means no messages. See src/emc/nml_int/emcglb.h for others
#define EMC_DEBUG_CONFIG 0x00000002
#define EMC_DEBUG_VERSIONS 0x00000008
#define EMC_DEBUG_TASK_ISSUE 0x00000010
#define EMC_DEBUG_NML 0x00000040
#define EMC_DEBUG_MOTION_TIME 0x00000080
#define EMC_DEBUG_INTERP 0x00000100
#define EMC_DEBUG_RCS 0x00000200
#define EMC_DEBUG_INTERP_LIST 0x00000800
#define EMC_DEBUG_IOCONTROL 0x00001000
#define EMC_DEBUG_OWORD 0x00002000
#define EMC_DEBUG_REMAP 0x00004000
#define EMC_DEBUG_PYTHON 0x00008000
#define EMC_DEBUG_NAMEDPARAM 0x00010000
#define EMC_DEBUG_GDBONSIGNAL 0x00020000
#define EMC_DEBUG_PYTHON_TASK 0x00040000
#define EMC_DEBUG_ALL 0x7FFFFFFF /* it's an int for %i to work
DEBUG = 0x00002000
#DEBUG = 0
Not sure how to get that to write to a file other than:
linuxcnc > output.txt
As for own code, I usually heavily use print() for python or rtapi_print() for kinematic components.
Please Log in or Create an account to join the conversation.
3 years 1 month ago #279663
by smal
Replied by smal on topic Problems with including comp userspace application file to LinuxCNC project
Finally after spend more than 3 working days of experimenting and studying LinuxCNC I have found a way. To minimize the loss of time for other users of LinuxCNC which are interested in the same I will make a detailed description how to do it.
First: never put a userspace application into this folder: /linuxcnc-dev/src/hal/components/. This is to be meant for realtime stuff, ether single c file or comp file, and for that documented mechanism works very fine.For userspace application the appropriate folder is /linuxcnc-dev/src/hal/user_comps/. There are some other examples which can be taken as a reference. There are comp files, folders (subprojects) with more than one c file which is very convenient if added userspace subapplication has several c and h files.
While adding one comp file the according Submakefile should be corrected otherwise there will be no compile.
I have taken this project as a reference: huanyang-vfd. I have changed all the necessary notations and names to aaaa. You will find all the files in the attachment. Notice: also the Submakefile should be corrected in case of any file name changes. Make a folder aaaa in user_comps and copy in the files.To be able to compile aaaa subproject from main Makefile (/linuxcnc-dev/src/) this should be corrected:
->add new line to linenumber 179 (or after: hal/user_comps/huanyang-vfd \) and copy to it:
hal/user_comps/aaaa \
Reference document: wiki.linuxcnc.org/cgi-bin/wiki.pl?MakefileDeMystified
At this point should be possible to compile aaaa subproject with make, sudo make setuid.
Next step is to add loadusr aaaa to active hal file. In my case it is cooling.hal:
# Fake the existence of coolant options
#loadrt and2 count=3
#addf and2.0 servo-thread
#addf and2.1 servo-thread
#net flood iocontrol.0.coolant-flood => and2.0.in0
#net mist iocontrol.0.coolant-mist => and2.0.in1
#net lube iocontrol.0.lube => and2.1.in0
loadrt counter
loadusr aaaa
Next step is to open a new terminal and start the LinuxCNC (scripts folder):
~/linuxcnc-dev/scripts$ ./linuxcnc '/home/smal/linuxcnc-dev/configs/sim/axis/axis_mm.ini'
If you see something like that:
Found file(REL): ./cooling.hal
Notice: this is module aaaa!
note: MAXV max: 53.340 units/sec 3200.400 units/min
Then you have successfully included your userspace subapplication into LinuxCNC.
First: never put a userspace application into this folder: /linuxcnc-dev/src/hal/components/. This is to be meant for realtime stuff, ether single c file or comp file, and for that documented mechanism works very fine.For userspace application the appropriate folder is /linuxcnc-dev/src/hal/user_comps/. There are some other examples which can be taken as a reference. There are comp files, folders (subprojects) with more than one c file which is very convenient if added userspace subapplication has several c and h files.
While adding one comp file the according Submakefile should be corrected otherwise there will be no compile.
I have taken this project as a reference: huanyang-vfd. I have changed all the necessary notations and names to aaaa. You will find all the files in the attachment. Notice: also the Submakefile should be corrected in case of any file name changes. Make a folder aaaa in user_comps and copy in the files.To be able to compile aaaa subproject from main Makefile (/linuxcnc-dev/src/) this should be corrected:
->add new line to linenumber 179 (or after: hal/user_comps/huanyang-vfd \) and copy to it:
hal/user_comps/aaaa \
Reference document: wiki.linuxcnc.org/cgi-bin/wiki.pl?MakefileDeMystified
At this point should be possible to compile aaaa subproject with make, sudo make setuid.
Next step is to add loadusr aaaa to active hal file. In my case it is cooling.hal:
# Fake the existence of coolant options
#loadrt and2 count=3
#addf and2.0 servo-thread
#addf and2.1 servo-thread
#net flood iocontrol.0.coolant-flood => and2.0.in0
#net mist iocontrol.0.coolant-mist => and2.0.in1
#net lube iocontrol.0.lube => and2.1.in0
loadrt counter
loadusr aaaa
Next step is to open a new terminal and start the LinuxCNC (scripts folder):
~/linuxcnc-dev/scripts$ ./linuxcnc '/home/smal/linuxcnc-dev/configs/sim/axis/axis_mm.ini'
If you see something like that:
Found file(REL): ./cooling.hal
Notice: this is module aaaa!
note: MAXV max: 53.340 units/sec 3200.400 units/min
Then you have successfully included your userspace subapplication into LinuxCNC.
The following user(s) said Thank You: Aciera
Please Log in or Create an account to join the conversation.
Time to create page: 0.151 seconds