stepgen for dummies
23 Jun 2019 14:57 #137655
by felixcnc
stepgen for dummies was created by felixcnc
Hello,
As usual I am asking the very basic questions (sorry about this), but LinuxCNC is so vast that sometimes I feel overwhelmed about the amount of information I found but my lack of knowledge makes difficult to get to the right answer.
I've been reading : linuxcnc.org/docs/html/hal/rtcomps.html#...tcomps.html#_stepgen and even though it's very clear it does not fit exactly what I need to do.
Basically what I want to do is to create ONE very simple stepgen that takes a float and encodes that into two pins, I have created this very simple HAL code:
I was able to start halscope and retrieve information from stepgen.0.dir and stepgen.0.step however I am not 100% if I am things right.
For example if I write:
setp stepgen.0.position-cmd 1
I see the stepgen.0.dir and stepgen.0.step to change its value (if I set the value to other values sometimes it changes the values sometimes it doesnt).
So my question is.... if I use net to wire the setp stepgen.0.position-cmd 1 with a Joint position output from any of the kinematic examples , is that the right way to OUTPUT the movement through the step generator?
p.s. I hope I was clear, otherwise, please ask me and I'll be happy to clarify myself. And again, please forgive if I ask the obvious things, but I'm still ramping up on this.
Thank you very much
Kind regards
As usual I am asking the very basic questions (sorry about this), but LinuxCNC is so vast that sometimes I feel overwhelmed about the amount of information I found but my lack of knowledge makes difficult to get to the right answer.
I've been reading : linuxcnc.org/docs/html/hal/rtcomps.html#...tcomps.html#_stepgen and even though it's very clear it does not fit exactly what I need to do.
Basically what I want to do is to create ONE very simple stepgen that takes a float and encodes that into two pins, I have created this very simple HAL code:
loadrt threads name1=probando period1=1000000
loadrt stepgen step_type=0
net direccion stepgen.0.dir
net paso stepgen.0.step
setp stepgen.0.position-scale 10000
setp stepgen.0.enable 1
addf stepgen.update-freq probando
addf stepgen.make-pulses probando
start
I was able to start halscope and retrieve information from stepgen.0.dir and stepgen.0.step however I am not 100% if I am things right.
For example if I write:
setp stepgen.0.position-cmd 1
I see the stepgen.0.dir and stepgen.0.step to change its value (if I set the value to other values sometimes it changes the values sometimes it doesnt).
So my question is.... if I use net to wire the setp stepgen.0.position-cmd 1 with a Joint position output from any of the kinematic examples , is that the right way to OUTPUT the movement through the step generator?
p.s. I hope I was clear, otherwise, please ask me and I'll be happy to clarify myself. And again, please forgive if I ask the obvious things, but I'm still ramping up on this.
Thank you very much
Kind regards
Please Log in or Create an account to join the conversation.
23 Jun 2019 15:56 #137658
by PCW
Replied by PCW on topic stepgen for dummies
Yes, something like
net some_appropriate_signal_name joint.0.motor-pos-cmd stepgen.0.position-cmd
Note
1. signal names are arbitrary (but chosen for readability)
2. you can use stepconf created hal files as examples
net some_appropriate_signal_name joint.0.motor-pos-cmd stepgen.0.position-cmd
Note
1. signal names are arbitrary (but chosen for readability)
2. you can use stepconf created hal files as examples
Please Log in or Create an account to join the conversation.
23 Jun 2019 19:59 #137664
by felixcnc
Replied by felixcnc on topic stepgen for dummies
Ahhh, yes, I saw that "net" is not only to wire things , but also since it creates a virtual pin when you use it, it is used to "alias" other pins as well.
Thanks for the advise.
Thanks for the advise.
Please Log in or Create an account to join the conversation.
23 Jun 2019 20:08 - 23 Jun 2019 20:18 #137665
by PCW
Replied by PCW on topic stepgen for dummies
Right though strictly, its not really a pin but rather a signal
I think of signals as "wires"
so
net blue_wire out_pin_a
...
net blue_wire in_pin_b
connects the pins out_a and in_b with the wire blue_wire
or the equivalent
net blue_wire out_pin_a in_pin_b
or
net blue_wire out_pin_a => in_pin_b
The => is just for looks to give the person reading the hal file a hint about the direction of data flow.
in fact its really just a special inline comment.
I think of signals as "wires"
so
net blue_wire out_pin_a
...
net blue_wire in_pin_b
connects the pins out_a and in_b with the wire blue_wire
or the equivalent
net blue_wire out_pin_a in_pin_b
or
net blue_wire out_pin_a => in_pin_b
The => is just for looks to give the person reading the hal file a hint about the direction of data flow.
in fact its really just a special inline comment.
Last edit: 23 Jun 2019 20:18 by PCW. Reason: clarify more
The following user(s) said Thank You: HueyHQ
Please Log in or Create an account to join the conversation.
Time to create page: 0.067 seconds