- Posts: 161
- Thank you received: 0
Learning HAL, examples of my coding - thoughts please and guidance
Coudl people tell me if I'm on the right track.
The above links (net) the signal in emcmot.0.pos-cmd on the pin joint.0.motor-pos-cmd (which is an output) to the pin pid.0.command
Questions: Is this link just in hal, so this is something internally for linux cnc to sort out. Essentially saying share information
Does this determine the motor running in position mode as I can’t see it defined anywhere else in HAL or INI
It also links signal in motor.0.pos-fb (which is an encoder position feedback i think) to the 7i96’s stepgen operator pin (00 lets say x axis) the motors feedback pin and to PID number one’s linked feedback (so it can do it’s PID loop thingy?).
Questions: Am I correct in thinking this net has linked one signal in to three pins, one on the 7i96 and two in linux cnc.
It links motor.0.command which is given through pin pid.0.output to the 7i96’s stepgen #00 Velocity-cmd
So essentially motor command says go to x10. First net gives that to PID0
At the same time the feedback reads your not there
Motor command gets the info which says your not equal to x10; move in the direction of x10.
This loops until x=10
Is that correct?
So say I wanted this particular stepgen to run in velocity mode for a spindle
Questions on the above:
- Do I need to tell linuxcnc that the stepgen is in velocity mode? Something like:
loadrt stepgen step_type=type0, type0, type0, type0 ctrl_type=typep, typep, typep, typev
See linuxcnc.org/docs/html/man/man9/stepgen.9.html as ref where I got this info
Do I need to set some pins and their value?
Cheers
Jools
Please Log in to join the conversation.
- Todd Zuercher
- Offline
- Platinum Member
-
- Posts: 4739
- Thank you received: 2
Please Log in to join the conversation.
- Todd Zuercher
- Offline
- Platinum Member
-
- Posts: 4739
- Thank you received: 2
Also your "sets emcmot.0.enable FALSE" command is superfluous, and will likely set an alarm and maybe prevent Linuxcnc from starting, because you can't sets a value to a signal if it is connected to an output, which you do on the next line.
Please Log in to join the conversation.
Todd Zuercher wrote: Also the "newsig" command is depreciated, and is not nessisary. simply using a net command will create the signal. My understanding is that it once was nessisary but that hasn't been true for a very long time, (before I started using Linuxcnc.)
Also your "sets emcmot.0.enable FALSE" command is superfluous, and will likely set an alarm and maybe prevent Linuxcnc from starting, because you can't sets a value to a signal if it is connected to an output, which you do on the next line.
Hi Todd
This is strange because those bits of HAL were generated by the 7i96 tool and not myself. I changed the top one to create the bottom one
Please Log in to join the conversation.
- Todd Zuercher
- Offline
- Platinum Member
-
- Posts: 4739
- Thank you received: 2
A signal connects one output pin (whether from an internal Linuxcnc source or an outside source) to as many input pins as you like. in the case of your stepgen's position feedback it is connected to both Linuxcnc's joint position feedback and the pid position feedback much like the encoder for a servo would be. Hopefully that answers your first two questions.
No, you don't need to tell Linuxcnc that the stepgen is using a velocity command. But you do have to configure it's connection to Linuxcnc like a servo connection, and that should done for you by the configuration wizard (I've only used Pncconfig not the new config tool for the 7i96) The wizard for the 7i96 is rather new, hopefully there aren't too many bugs still in it.
Please Log in to join the conversation.
- Todd Zuercher
- Offline
- Platinum Member
-
- Posts: 4739
- Thank you received: 2
jools wrote: Hi Todd
This is strange because those bits of HAL were generated by the 7i96 tool and not myself. I changed the top one to create the bottom one
Yes, sorry, I spouted off before looking it over very carefully, but those signal names do almost look like hal pin names.
Please Log in to join the conversation.
Todd Zuercher wrote:
jools wrote: Hi Todd
This is strange because those bits of HAL were generated by the 7i96 tool and not myself. I changed the top one to create the bottom one
Yes, sorry, I spouted off before looking it over very carefully, but those signal names do almost look like hal pin names.
:laugh: no probs
Please Log in to join the conversation.
