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

More
16 Apr 2020 15:08 - 17 Apr 2020 05:17 #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
Last edit: 17 Apr 2020 05:17 by Aciera.

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

More
16 Apr 2020 15:24 #164155 by PCW
What normally drives joint.0.pos-fb?

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

More
16 Apr 2020 16:07 - 16 Apr 2020 16:11 #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.
Last edit: 16 Apr 2020 16:11 by Aciera.

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

More
16 Apr 2020 17:13 #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 or Create an account to join the conversation.

More
16 Apr 2020 17:41 #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 or Create an account to join the conversation.

More
16 Apr 2020 17:43 #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 or Create an account to join the conversation.

More
16 Apr 2020 17:59 - 16 Apr 2020 18:01 #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.
Last edit: 16 Apr 2020 18:01 by Aciera.

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

More
16 Apr 2020 18:06 #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 or Create an account to join the conversation.

More
16 Apr 2020 18:12 #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.
The following user(s) said Thank You: tommylight, Aciera

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

More
16 Apr 2020 18:29 - 16 Apr 2020 18:30 #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)
Last edit: 16 Apr 2020 18:30 by PCW.
The following user(s) said Thank You: Aciera

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

Time to create page: 0.084 seconds
Powered by Kunena Forum