building my first Hal component

More
05 Jan 2011 01:43 #6418 by garymcrobertpdx
I am attempting to build my first Hal component
I have consulted the docs at
linuxcnc.org/docs/html/hal_comp.html#r1_14

I copied the arraydemo code and placed it in a file
named componet-arraydemo

I looked for emc2/src/hal/components but the
/src/hal/components did not exist so I created
the directory structure and placed the file
componet-arraydemo into it.

I opened a terminal and entered the command line
comp --install component-arraydemo.comp
this is was the response it appears nothing happend

me@CNC:~$ comp --compile co,ponent-arraydemo.comp
The program 'comp' can be found in the following packages:
* nmh
* mailutils-mh
Try: sudo apt-get install <selected package>
bash: comp: command not found
me@CNC:~$

I tried several variations on the command line
but faild to get results. An explicit example of how
to make this process work would be very helpful

Thanks

Please Log in or Create an account to join the conversation.

More
05 Jan 2011 06:13 #6419 by garymcrobertpdx
OK figured out that I had to down load and install emc2-dev
Now comp seems to be working but it gives me an error
“Unrecognized file type for mode preprocess “ don’t
know what this exactly means. Could still use a guiding
hand with learning how to do this.

Please Log in or Create an account to join the conversation.

More
05 Jan 2011 10:02 #6420 by andypugh
How did you download it?
sudo apt-get install emc2-dev
should install all required packages. I assume, though, that this is what you did.

You shouldn't actually need to create the src/hal/components tree, I think you can put the .comp file anywhere you want.

Did the error message you posted happen with comp --install foo.comp ? I can imagine you would get that message trying to comp the wrong file (you will, at various points, create a foo.c, foo.o and foo.ko file, and pointing comp at some of these might give the reported error.

Please Log in or Create an account to join the conversation.

More
05 Jan 2011 12:59 #6430 by BigJohnT
When I built a comp I just put the comp file with the other components in emc2-dev/src/hal/components then built EMC2 following these instructions

wiki.linuxcnc.org/cgi-bin/emcinfo.pl?Ins...ilding_emc2_realtime

then looked at my errors in the terminal window... usually syntax errors for me.

John

Please Log in or Create an account to join the conversation.

More
05 Jan 2011 20:07 #6452 by garymcrobertpdx
I found a post here by someone that was experiencing the same problem
And fallowed the instructions he received.

Used ubuntu's system > software sources & the synaptic package manager
to locate and install emc2-div this appeared to work.

According to the comp docs there are several ways to use comp and some
limitations. I tried several combos hoping to stumble onto the correct
arrangement.

The error message was produced on my first attempts at comp. Currently
the error message I receive is “IOError: [Errno 2] No such file or directory:
arraydemo.c “

I have tried tweaking the file name extension and moving the file to several
different directories with no success.

I searched for the directory structure emc2-div/src/hal/components and failed
to find any thing like it. Perhaps comp is not installed after all????

Being a Linux newbie tends to compound these difficulties.

Please Log in or Create an account to join the conversation.

More
05 Jan 2011 23:34 #6455 by BigJohnT
Ok, I'm assuming you have the installed version of EMC2. If so follow the instructions here

wiki.linuxcnc.org/cgi-bin/emcinfo.pl?Installing_EMC2

to download a git copy of the development version or a branch and build it. I'm not sure what you found with the Synaptic Package Manger but that is the wrong way. The files will be installed in your home directory.

John

Please Log in or Create an account to join the conversation.

More
06 Jan 2011 01:31 #6461 by garymcrobertpdx
YES thats what I was in need of, things look more like they should,
now I think I have a chance of making a component.
But as Yogi Berra said "it ain't over till its over"

Many thanks

Please Log in or Create an account to join the conversation.

More
06 Jan 2011 07:00 #6467 by garymcrobertpdx
Still getting no where with this. Tried comp with an existing comp file got the same errors

me@CNC:~$ comp biquad.comp
Traceback (most recent call last):
File "/usr/bin/comp", line 1297, in <module>
main()
File "/usr/bin/comp", line 1266, in main
process(f, mode, outfile)
File "/usr/bin/comp", line 1140, in process
a, b = parse(filename)
File "/usr/bin/comp", line 386, in parse
f = open(filename).read()
IOError: [Errno 2] No such file or directory: 'biquad.comp'

me@CNC:~$ comp --install biquad.comp
Traceback (most recent call last):
File "/usr/bin/comp", line 1297, in <module>
main()
File "/usr/bin/comp", line 1266, in main
process(f, mode, outfile)
File "/usr/bin/comp", line 1140, in process
a, b = parse(filename)
File "/usr/bin/comp", line 386, in parse
f = open(filename).read()
IOError: [Errno 2] No such file or directory: 'biquad.comp'
me@CNC:~$

What am i doing wrong????

Please Log in or Create an account to join the conversation.

More
06 Jan 2011 10:03 #6470 by andypugh
You possibly need to give comp the full path to the .comp file (or possibly issue the comp instruction from within that directory)

Please Log in or Create an account to join the conversation.

More
07 Jan 2011 04:17 #6499 by garymcrobertpdx
OK I have successfully got comp to convert a comp into a c program
not sure if I have seceded in creating a real time component yet.
I will test this soon.

A question since I am writing C code can I do any thing C or are
there significant restrictions. For example can I open a disk file
and read data into an array in my C code which this ultimately
happens in the hal component when it executes,

Again thanks for the patient assistance.

Please Log in or Create an account to join the conversation.

Time to create page: 0.088 seconds
Powered by Kunena Forum