custom hal component failed to compile, undeclared (first use in this function)

More
3 years 10 months ago #259404 by smc.collins
I'll look into the pin setting issue, but this is following the design of the original code.

according to the hal comp docs, it just renames the declared variables, if they are named properly, shouldn't the parser just roll iver them ??

there's a lot of wonky behavior here, and i don't write c or python so I'm green here

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

More
3 years 10 months ago #259412 by Henk
Hi. The pin names in the .comp file cannot contain hyphens. Change them to underscores.

After compiling, the pins will be renamed so that in hal the names will have hyphens instead.
The following user(s) said Thank You: smc.collins

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

More
3 years 10 months ago #259419 by phillc54
To be more specific, where the pin name is first declared it can be a hyphen but any reference to it in the code needs to be an underscore. I normally use underscores in the declaration as well as it is less confusing (for me at least)

Not sure where your code is at now but I also noticed in the original code that where Strobe-Switch-1, turret-unlocked, and turret-locked are declared the semicolon is missing from the end of the line.
 

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

More
3 years 10 months ago #259427 by rodw
Also, using a int for the equates as I suggested won't work as they are bits. I think you would need a bool. Also for the #defines, don't use brackets.

I also wonder if the python preprocessing by halcompile ignores the # thinking its a comment/

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

More
3 years 10 months ago #259501 by smc.collins
someone make this make sense

component Cinturnchanger // """This component controls the Cincinannati Milacron Cinturn 12u and maybe other similar lathes. This is a highly modified and""";

pin in bit toolchange

pin in s32 toolnumber
pin in s32 currenttoolnumber
pin out bit toolchanged = false

pin out bit delaystart = false
pin in bit delaydone = false


this fails like so

halcompile --compile Cinturnchanger.comp
Cinturnchanger.comp:3:1: Trying to find one of TSTRING, STRING, ";"
Traceback (most recent call last):
File "/usr/bin/halcompile", line 1508, in <module>
main()
File "/usr/bin/halcompile", line 1478, in main
process(f, mode, outfile)
File "/usr/bin/halcompile", line 1332, in process
a, b = parse(filename)
File "/usr/bin/halcompile", line 436, in parse
p = _parse('File', a + "\n\n", filename)
File "/usr/bin/halcompile", line 424, in _parse
return runtime.wrap_error_reporter(P, rule)
File "/usr/lib/python2.7/dist-packages/yapps/runtime.py", line 440, in wrap_error_reporter
print_error(e, parser._scanner)
File "/usr/lib/python2.7/dist-packages/yapps/runtime.py", line 420, in print_error
scanner.print_line_with_pointer(pos)
File "/usr/lib/python2.7/dist-packages/yapps/runtime.py", line 230, in print_line_with_pointer
print >>out, '> ',text
TypeError: unsupported operand type(s) for >>: 'builtin_function_or_method' and 'file'


this compiles just fine, someone, make it make sense


component oracchanger """This component controls the Orac Lathe
Auto Tool Changer. M6 calls this""";

pin in bit toolchange "Receives signal that tool change required";
pin in s32 toolnumber """Receives Tx data (tool number requested)
Only allows 1-8""";
pin in s32 currenttoolnumber "Receives old tool number";
pin out bit toolchanged = false "Sends signal when tool change finished";

pin out bit delaystart = false "Starts timerdelay";
pin in bit delaydone =false "Signals timer finished";

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

More
3 years 10 months ago - 3 years 10 months ago #259520 by smc.collins
ok made some progress, the tool change iocontrol calls need revisiting, and for some reason VScode is polluting files. so had to rebuild all of my work in geany which wasn't very difficult. I do have it building now. I need to work on my hal configuration to get the tool change calls working properly.

I'm finding some of these a bit confusing.

could someone please clear up the meaning of these parameters please , and which are required to make this work. I don't know if I should link the pocket or the tool ?  I can't prep tools, I can't prep pockets etc. So I am trying to figure out specifically which IO pins I need to connect to the new hal component.

iocontrol.0.tool-change (Bit, Out) TRUE when a tool change is requested 
this goes to the hal component to signal a tool change, requested by motion control ?


iocontrol.0.tool-changed (Bit, In) Should be driven TRUE when a tool change is completed.
this comes from the hal component to signal the tool is changed , signal goes to motion control ?


iocontrol.0.tool-number (s32, Out) Current tool number
the current tool number from the hal component piped to motion control ?


iocontrol.0.tool-prep-number (s32, Out) The number of the next tool, from the RS274NGC T-word
next tool ? or is this the requested tool ? is the motion control doing look ahead ? or is this a gcode tool prep call ? IE large chain
style tool changer or large magazine unit etc ??


iocontrol.0.tool-prep-pocket (s32, Out) This is the pocket number (location in the tool storage mechanism) of the tool requested by the most recent T-word.
this is the location in a large tool magazine ? or is this a duplicate tool call ???


iocontrol.0.tool-prepare (Bit, Out) TRUE when a Tn tool prepare is requested
is this coming from the hal component or the motion control ? what is it preparing ? isn't this already handeled by the tool request and tool request s32 number ?


iocontrol.0.tool-prepared (Bit, In) Should be driven TRUE when a tool prepare is completed.
this is coming from the hal component to the motion control ? to indicate the tool is finished ?


I am asking because it seems a lot has changed sine the original component was drafted and as such, there is some terminology difference. Just trying to figure out what exactly I need to be sending and receiving to get this thing to show me the next bug.
Attachments:
Last edit: 3 years 10 months ago by smc.collins.

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

Time to create page: 0.548 seconds
Powered by Kunena Forum