[solved] save axis position as offset when pushing a button

More
6 years 6 months ago #164151 by Aciera
I'd like to set a Hal-value (float) to the current absolute axis position when I press a button.

Or to put it differently:

"sets myvalue joint.0.pos-fb" IF 'myhalpin = TRUE"

Can I do this in HAL or do I have to go through classic-ladder?

Thanks

Please Log in to join the conversation.

More
6 years 6 months ago #164155 by PCW
What normally drives joint.0.pos-fb?

Please Log in to join the conversation.

More
6 years 6 months ago #164163 by Aciera
I'm not sure I understand your question.
Maybe I worded my question wrong.
joint.0.pos-fb is an output pin.

So in hal I could do:
sets myvalue 100

but I would like 'myvalue' to store the current value of joint.0.pos-fb when I push a button.

Please Log in to join the conversation.

More
6 years 6 months ago #164167 by PCW
joint.0.pos-fb in an input pin to motion
its normally driven by an encoder position pin

Are you saying you want to override the encoder position?

Please Log in to join the conversation.

More
6 years 6 months ago #164170 by Aciera
Ooops,
no I would actually like to store the present absolute value of my x-axis in a variable when I press a button to use it as an offset. I don't know what I was looking at.
But the question is really how to store a float value in Hal when another pin goes true.

Please Log in to join the conversation.

More
6 years 6 months ago #164172 by tommylight
I think he wants to store the value of FB pin at any given time when he presses a button on a panel, right ?
It would be much easier if you told us what the end result should be, this way we are chasing our tails.

Please Log in to join the conversation.

More
6 years 6 months ago #164179 by Aciera
Well I thought it was a simple thing that would be used all the time. There is not much more to elaborate on but let me try:
I use 5-axis kinematics and need to set the rotation point while running LinuxCNC. In xyzbc-trt kinematics there are two offset-pins in HAL to define the point of rotation for the B-axis. These are set in the INI file but I have a different setup and need to be able set those values during runtime.
So the X and Z axis are jogged to the required position and then the values need to be set.
So the question is: How do I set a HAL float value when I push a button. Either a pysical input or a gladevcp panel button.

Please Log in to join the conversation.

More
6 years 6 months ago #164181 by tommylight
That is more understandable, thank you.
It should be possible, seeing as it uses offsets, but i have no idea how.

Please Log in to join the conversation.

More
6 years 6 months ago #164184 by cmorley
gladevcp with python handler code would do this for a gui solution.
a latching component would be required for a physical dial solution.

Please Log in to join the conversation.

More
6 years 6 months ago #164186 by PCW
You can do it in hal with a mux component:

loadrt mux2
addf mux2.0 servo-thread

net latch mux2.0.in0 mux2.0.out
setp mux2.0.in1 some_value # to set the latch with a constant
or
net offset mux2.0.in1 some_pin # to set the latch with a variable

to set the latch to the you set mux2.0.sel true momentarily

(Note that there is a component for this = sample_hold but only for integers)

Please Log in to join the conversation.

Time to create page: 0.365 seconds
Powered by Kunena Forum