Carousel - dont work w/o trigger
04 Jan 2023 19:07 #260951
by zz912
Carousel - dont work w/o trigger was created by zz912
Hello,
We have Brother Tc-211.
I has rotary ATC.
I use HAL component carousel.
Binary encoder 4 bit, w/o trigger bit.
Controlled by asynchronous motor.
Pin for controller - carousel.0.motor-fwd and carousel.0.motor-rev
My problem is that the encoder doesn't have a trigger bit, so sometimes some bits are read faster than others. The carousel component is confused by this.
So we have a problem when moving from position 9 to 8 and from position 3 to 2.
Why is this so:
9 = 2^3+0+0+2^0
8 = 2^3+0+0+0
3 = 0+0+2^1+2^0
2 = 0+0+2^1+0
When I want the revolver, let it turn from position 9 to 8 or from position 3 to 2. Then the engine starts and immediately stops. A situation occurs when, due to manufacturing tolerances, bit ^0 (2^0=1) turns on one millisecond before the rest of the bit, and the program thinks it is already in the position where it should be (but physically it is not) and turns off the rotation relay.
Any Idea what should I do now?
We have Brother Tc-211.
I has rotary ATC.
I use HAL component carousel.
Binary encoder 4 bit, w/o trigger bit.
Controlled by asynchronous motor.
Pin for controller - carousel.0.motor-fwd and carousel.0.motor-rev
My problem is that the encoder doesn't have a trigger bit, so sometimes some bits are read faster than others. The carousel component is confused by this.
So we have a problem when moving from position 9 to 8 and from position 3 to 2.
Why is this so:
9 = 2^3+0+0+2^0
8 = 2^3+0+0+0
3 = 0+0+2^1+2^0
2 = 0+0+2^1+0
When I want the revolver, let it turn from position 9 to 8 or from position 3 to 2. Then the engine starts and immediately stops. A situation occurs when, due to manufacturing tolerances, bit ^0 (2^0=1) turns on one millisecond before the rest of the bit, and the program thinks it is already in the position where it should be (but physically it is not) and turns off the rotation relay.
Any Idea what should I do now?
Attachments:
Please Log in or Create an account to join the conversation.
04 Jan 2023 20:36 - 04 Jan 2023 21:40 #260960
by PCW
Replied by PCW on topic Carousel - dont work w/o trigger
Normally they use Gray code to avoid this sort of issue.
What about a say 10 ms debounce of all the bits?
(might need a integer debounce component instead of bit debounce)
An integer debounce component would need to sample an input integer
N times without change before updating its output by copying its
input to output.
What about a say 10 ms debounce of all the bits?
(might need a integer debounce component instead of bit debounce)
An integer debounce component would need to sample an input integer
N times without change before updating its output by copying its
input to output.
Last edit: 04 Jan 2023 21:40 by PCW.
Please Log in or Create an account to join the conversation.
05 Jan 2023 17:14 #261009
by zz912
Replied by zz912 on topic Carousel - dont work w/o trigger
It did not help:
I am in position 3 and I want move to position 2.
ATC descends from position 3 and stops.
ATC generally works, but some positions do nonsense.
# nacteni komponenty debounce
loadrt debounce cfg=4
addf debounce.0 servo-thread
setp debounce.0.delay 10
# vstup komponenty debounce
net atc-bit0 => debounce.0.0.in
net atc-bit1 => debounce.0.1.in
net atc-bit2 => debounce.0.2.in
net atc-bit3 => debounce.0.3.in
# vystup komponenty debounce
net atc-deb-bit0 <= debounce.0.0.out
net atc-deb-bit1 <= debounce.0.1.out
net atc-deb-bit2 <= debounce.0.2.out
net atc-deb-bit3 <= debounce.0.3.out
# spojeni nactenych bitu a komponenty carousel
net atc-deb-bit0 => carousel.0.sense-0
net atc-deb-bit1 => carousel.0.sense-1
net atc-deb-bit2 => carousel.0.sense-2
net atc-deb-bit3 => carousel.0.sense-3
I am in position 3 and I want move to position 2.
ATC descends from position 3 and stops.
ATC generally works, but some positions do nonsense.
Attachments:
Please Log in or Create an account to join the conversation.
05 Jan 2023 20:54 #261032
by PCW
Replied by PCW on topic Carousel - dont work w/o trigger
Yes, I would expect a BIT debounce to fail
What I expect is needed is an integer debounce
(so its impossible to get transient wrong encoder counts)
What I expect is needed is an integer debounce
(so its impossible to get transient wrong encoder counts)
The following user(s) said Thank You: zz912
Please Log in or Create an account to join the conversation.
05 Jan 2023 21:52 #261038
by zz912
Replied by zz912 on topic Carousel - dont work w/o trigger
I studied source code carousel.comp. I will try modify and I will make feedback.
Please Log in or Create an account to join the conversation.
07 Jan 2023 05:17 #261152
by zz912
Replied by zz912 on topic Carousel - dont work w/o trigger
I solved it.
I made a modification to the carousel component. The original solution worked in such a way that moving from the first position to the second position was only about checking whether it is already in the correct position. I have several phases. The first stage is to leave the first position. I check if the position is already 0 and I don't care how the read position changes. In the second phase, I just check that the position is zero. In the third phase, I check that the position has changed to anything else and stop the engine. The fourth stage is just waiting. The fifth phase decides whether we are in the right position or whether to continue in the right position.
I made a modification to the carousel component. The original solution worked in such a way that moving from the first position to the second position was only about checking whether it is already in the correct position. I have several phases. The first stage is to leave the first position. I check if the position is already 0 and I don't care how the read position changes. In the second phase, I just check that the position is zero. In the third phase, I check that the position has changed to anything else and stop the engine. The fourth stage is just waiting. The fifth phase decides whether we are in the right position or whether to continue in the right position.
The following user(s) said Thank You: akb1212, tommylight
Please Log in or Create an account to join the conversation.
29 Jan 2023 17:53 #263173
by zz912
Replied by zz912 on topic Carousel - dont work w/o trigger
I made Draft Pull Request here:
github.com/LinuxCNC/linuxcnc/pull/2310
github.com/LinuxCNC/linuxcnc/pull/2310
Please Log in or Create an account to join the conversation.
Time to create page: 0.131 seconds