Getting error when installing a homebrew component

More
06 Jun 2014 02:37 #47733 by Mr. Technical
Hi Guys,

A friend and I have been working on a tool changing component for my lathe and using the oracchanger component as a jumping off point to design it. We've covered some ground, but are hitting an error when trying to install it. The error says:' ValueError: need more than one value to unpack'

Any idea what's causing that?

Mr. Technical

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

More
06 Jun 2014 13:23 - 06 Jun 2014 14:48 #47743 by ArcEye
The error is coming from comp

There is a syntax error in the file which is preventing it parsing.

Post the toolchanger comp

regards
Last edit: 06 Jun 2014 14:48 by ArcEye.

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

More
06 Jun 2014 20:27 #47754 by Mr. Technical
Hi ArcEye,

Here's what we've got so far. As I said, it's adapted from the oracchanger comp that you built. I'm sure we've got a long way to go with it, but any pointers are much appreciated.

Mr. Technical
Attachments:

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

More
06 Jun 2014 20:46 #47755 by Mr. Technical
I just caught something. I need to make the component and the file name match. Strike 1. What else am I missing?

Mr. Technical

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

More
06 Jun 2014 21:32 #47758 by ArcEye
The error comes from line 411 of comp (the program not your comp file
def parse(filename):
    initialize()
    f = open(filename).read()
    a, b = f.split("\n;;\n", 1)
    p = _parse('File', a + "\n\n", filename)
    if not p: raise SystemExit, 1

So it is connected to the filename, but not what you think, yes you are right the component and filename must be the same.

The problem is you have used a windoze editor and the file is littered with ^M symbols, which are completely throwing the parser out.

Open in gedit, do File > SaveAs and below the file listing change Line Ending to Linux/Unix and then save

regards

PS

You have a variable called state

That name is protected, because it is the name given to the struct containing the created pins etc, use another name

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

More
07 Jun 2014 04:02 #47763 by Mr. Technical
Thanks for the info, ArcEye. I have made the changes that you suggested. I changed the file name to pumachanger.txt, did a ctrl-H to replace every instance of 'state' with 'status', and resaved it with the correct linux line endings.

Now I'm getting the following errors when I try to compile it:

pumachanger.comp: In function ‘_’:
pumachanger.comp:195: error: implicit declaration of function ‘motor_freehwheel’
pumachanger.comp:196: error: ‘state’ undeclared (first use in this function)
pumachanger.comp:196: error: (Each undeclared identifier is reported only once
pumachanger.comp:196: error: for each function it appears in.)
pumachanger.comp:246: error: implicit declaration of function ‘turret_is_within_3mm’
pumachanger.comp:269: error: ‘turret_state’ undeclared (first use in this function)
make[2]: *** [/tmp/tmpSg27_Q/pumachanger.o] Error 1
make[1]: *** [_module_/tmp/tmpSg27_Q] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-122-rtai'
make: *** [modules] Error 2

What have I done now?

Mr. Technical

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

More
07 Jun 2014 05:30 #47764 by Mr. Technical
Kind of answering my own question here, but I've been fiddling with the file to get it to compile. Here's what it looks like now. It does in fact compile, but with 2 warnings:

make KBUILD_EXTRA_SYMBOLS=/usr/realtime-2.6.32-122-rtai/modules/linuxcnc/Module.symvers -C /usr/src/linux-headers-2.6.32-122-rtai SUBDIRS=`pwd` CC=gcc V=0 modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-122-rtai'
CC [M] /tmp/tmpXtpmLR/pumachanger.o
pumachanger.comp: In function ‘turret_is_within_3mm’:
pumachanger.comp:99: warning: control reaches end of non-void function
pumachanger.comp: In function ‘motor_freewheel’:
pumachanger.comp:89: warning: control reaches end of non-void function
Building modules, stage 2.
MODPOST 1 modules
CC /tmp/tmpXtpmLR/pumachanger.mod.o
LD [M] /tmp/tmpXtpmLR/pumachanger.ko
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-122-rtai'

I've not really been working on the logic of things, more just debugging.

How can I clear these two warnings?

Mr. Technical
Attachments:

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

More
07 Jun 2014 13:16 #47766 by ArcEye
Hi

pumachanger.comp:99: warning: control reaches end of non-void function
pumachanger.comp: In function ‘motor_freewheel’:


You have declared a function which returns bool, but it does not return anything

Your earlier error with implicit declaration is because you have a typo in the function name you are calling
ie. motor_freehwheel(false);

I would advise that you bring the functions inline, within the main switch() block, but see how it works first

regards

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

More
09 Jun 2014 21:05 - 09 Jun 2014 21:05 #47813 by andypugh

pumachanger.comp:99: warning: control reaches end of non-void function


The functions need to return _something_ if they are non-void.

So, change "return" to "return 0" or "return 1" as required.
Last edit: 09 Jun 2014 21:05 by andypugh.

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

More
24 Jun 2014 21:27 #48224 by Mr. Technical
I think I have addressed the fixes that you mentioned, and am now trying to net the pins together.

As I understand it, the iocontrol.0.tool-prep-number is netted to the tool-number signal
Whenever a tool number is called from MDI, iocontrol.0.tool-prep-number updates the tool-number signal. I'd like to tie that signal into my pumachanger function via the toolnumber pin, so:

In the custom_postgui hal file, I typed:
net tool-number <= pumachanger.toolnumber

Once I do that, I get this message:

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
custom_postgui.hal:67: Pin 'toolnumber' does not exist
4859
PID TTY STAT TIME COMMAND
4930
PID TTY STAT TIME COMMAND
Stopping realtime threads
Unloading hal components

This is confusing because I can see those pins and signals listed in the HAL Configuration window if I comment that line out.
By the way, I have added the pumachanger function to the servo-thread by entering the following at the end of the custom_postgui hal file:
addf pumachanger servo-thread

Any ideas on what I'm doing wrong?
Attachments:

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

Time to create page: 0.144 seconds
Powered by Kunena Forum