- Posts: 40
- Thank you received: 12
Is there a bug in the carousel component or am I doing it wrong ATC Denford
- Adam Maszynotwór
- Topic Author
- Offline
- Senior Member
-
Less
More
1 year 6 months ago - 1 year 6 months ago #327342
by Adam Maszynotwór
Is there a bug in the carousel component or am I doing it wrong ATC Denford was created by Adam Maszynotwór
Hello, I'm starting to restore a lathe from scrap.
My problem is ATC (we'll get to the original ATC when I start the model)
Test model:
Step PIN8 dir PIN9 LPT stepper motor
Microstep 1600
4 pockets
1 gome sensor (pocket 1)
Head lock by left rotation (example video from the web)
Component linuxcnc.org/docs/html/man/man9/carousel.9.html
Basic lathe configuration
Symptoms:
T1M6 after starting linuxcnc looks for HOME and rewinds (strangely but it does rewind)
Each successive tool, e.g. T3M6, no longer rewinds
When I start from T2 M6 it passes HOME (activating it) but no longer rewinds while in position
My observations:
Dir changes but there is no movement. which means that there are no pulses flowing to PIN 8.
M66 waits for READY signal even though nothing is happening. Only after time has elapsed does the DIR state change and then it is READY
all files below
As you know I am not strong in HAL and in English please write as if to a child
[/code][/code]
My problem is ATC (we'll get to the original ATC when I start the model)
Test model:
Step PIN8 dir PIN9 LPT stepper motor
Microstep 1600
4 pockets
1 gome sensor (pocket 1)
Head lock by left rotation (example video from the web)
Component linuxcnc.org/docs/html/man/man9/carousel.9.html
Basic lathe configuration
Symptoms:
T1M6 after starting linuxcnc looks for HOME and rewinds (strangely but it does rewind)
Each successive tool, e.g. T3M6, no longer rewinds
When I start from T2 M6 it passes HOME (activating it) but no longer rewinds while in position
My observations:
Dir changes but there is no movement. which means that there are no pulses flowing to PIN 8.
M66 waits for READY signal even though nothing is happening. Only after time has elapsed does the DIR state change and then it is READY
all files below
As you know I am not strong in HAL and in English please write as if to a child
Code:
O<changetool> sub
(debug, Tool change to T#<_selected_tool>)
M68 E0 Q#<_selected_tool> ; Wybierz kieszeń
M64 P0 ; Włącz karuzelę
G4 P2
; Czekaj max 15s na ready (z timeoutem)
M66 P0 L3 Q15
; Jeśli timeout, zatrzymaj karuzelę i zgłoś błąd
O100 if [#5399 EQ 0] (if timeout)
M65 P0
(msg, Toolchange FAILED - Timeout)
M99
O100 endif
M65 P0 ; Wyłącz karuzelę
(debug, Tool change OK)
O<changetool> endsub
M2
Code:
[code][code]loadrt stepgen step_type=0,0,0
loadrt carousel pockets=4 encoding=counts dir=1 num_sense=1
addf carousel.0 servo-thread
setp stepgen.2.steplen 1
setp stepgen.2.stepspace 0
setp stepgen.2.dirhold 35000
setp stepgen.2.dirsetup 35000
setp stepgen.2.maxvel 100
setp stepgen.2.maxaccel 150
setp stepgen.2.position-scale 1
net astep stepgen.2.step => parport.0.pin-08-out
setp parport.0.pin-08-out-reset 1
#net adir stepgen.2.dir => parport.0.pin-09-out
net adir carousel.0.motor-rev => parport.0.pin-09-out
#Konfiguracja carousel
setp carousel.0.scale 400
setp carousel.0.width 10
setp carousel.0.fwd-dc 10
setp carousel.0.rev-dc 100
setp carousel.0.rev-pulse 10
#Połączenie carousel z stepgen
net carousel-pos-cmd carousel.0.counts-target => stepgen.2.position-cmd
net carousel-counts carousel.0.counts <= stepgen.2.counts
net carousel-ready carousel.0.ready => iocontrol.0.tool-changed motion.digital-in-00
#net carousel-dir stepgen.2.dir <= carousel.0.motor-rev
net carousel-enable carousel.0.enable <= motion.digital-out-00
net carousel-enable stepgen.2.enable <= motion.digital-out-00
net carousel-pocket carousel.0.pocket-number <= iocontrol.0.tool-prep-number
net carousel-ready carousel.0.ready => iocontrol.0.tool-changed
net home-signal carousel.0.sense-0 <= parport.0.pin-10-in
#Toolchange
net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
all files below
Last edit: 1 year 6 months ago by Adam Maszynotwór.
Please Log in or Create an account to join the conversation.
- Adam Maszynotwór
- Topic Author
- Offline
- Senior Member
-
Less
More
- Posts: 40
- Thank you received: 12
1 year 6 months ago #327369
by Adam Maszynotwór
Replied by Adam Maszynotwór on topic Is there a bug in the carousel component or am I doing it wrong ATC Denford
I'm not good at typical programming languages. I'm best at G-code.
Here, G4 has to be because after reaching the pocket, the READY pin is active so the toolchange procedure runs without moving the engine
Yes, I know that ATC is not a priority, but I'm asking in advance (I'll eventually write ATC on CL .. I think that thanks to the knowledge I've gained from trying to start CAROUSEL, I'll manage, and if not, I'll treat it as an axis and use g-code)
This machine is a challenge because:
I've never used a tool magazine
I've never done anything on servos
I didn't have a Mesa card either
and here it will be all
GUI AXIS
Here, G4 has to be because after reaching the pocket, the READY pin is active so the toolchange procedure runs without moving the engine
Yes, I know that ATC is not a priority, but I'm asking in advance (I'll eventually write ATC on CL .. I think that thanks to the knowledge I've gained from trying to start CAROUSEL, I'll manage, and if not, I'll treat it as an axis and use g-code)
This machine is a challenge because:
I've never used a tool magazine
I've never done anything on servos
I didn't have a Mesa card either
and here it will be all
GUI AXIS
Please Log in or Create an account to join the conversation.
- Adam Maszynotwór
- Topic Author
- Offline
- Senior Member
-
Less
More
- Posts: 40
- Thank you received: 12
1 year 6 months ago #327391
by Adam Maszynotwór
Replied by Adam Maszynotwór on topic Is there a bug in the carousel component or am I doing it wrong ATC Denford
I have a few observations:
no pulses are generated for reverse movement when the magazine turns in one direction the stepgen.2.position-cmd value changes by 400 then stepgen.2.position-fb and carousel.0.counts tend to this value. when the moment comes for reverse movement nothing changes in the three above parameters. despite the fact that the Dir pin changes there are no pulses - so for some reason the carousel component does not add pulses resulting from the set carousel reversing time. N .rev-pulse .
I do not know how the mechanism should work the instruction says carousel.N.rev-pulse float in
The duration in seconds for which a ratchet changer (Boxford, Emco) should pulse the reverse pin to lock the holder.
on logic so pulses in an indefinite number for a specified time possibly some mathematics could calculate that if someone wants the reversing to last 5 sec. and the pulse frequency is known, stepgen.2.position-cmd should be increased by the result of these calculations and the pulsation command should be issued.
no pulses are generated for reverse movement when the magazine turns in one direction the stepgen.2.position-cmd value changes by 400 then stepgen.2.position-fb and carousel.0.counts tend to this value. when the moment comes for reverse movement nothing changes in the three above parameters. despite the fact that the Dir pin changes there are no pulses - so for some reason the carousel component does not add pulses resulting from the set carousel reversing time. N .rev-pulse .
I do not know how the mechanism should work the instruction says carousel.N.rev-pulse float in
The duration in seconds for which a ratchet changer (Boxford, Emco) should pulse the reverse pin to lock the holder.
on logic so pulses in an indefinite number for a specified time possibly some mathematics could calculate that if someone wants the reversing to last 5 sec. and the pulse frequency is known, stepgen.2.position-cmd should be increased by the result of these calculations and the pulsation command should be issued.
Please Log in or Create an account to join the conversation.
1 year 6 months ago #327398
by PCW
Replied by PCW on topic Is there a bug in the carousel component or am I doing it wrong ATC Denford
loadrt carousel pockets=4 encoding=counts dir=1 num_sense=1
I know nothing about the carousel component but should that be dir=2 ?
I know nothing about the carousel component but should that be dir=2 ?
The following user(s) said Thank You: tommylight
Please Log in or Create an account to join the conversation.
- Adam Maszynotwór
- Topic Author
- Offline
- Senior Member
-
Less
More
- Posts: 40
- Thank you received: 12
1 year 6 months ago #327412
by Adam Maszynotwór
Replied by Adam Maszynotwór on topic Is there a bug in the carousel component or am I doing it wrong ATC Denford
dir=2 is for a revolver of this type i.e. working in two directions and blocked mechanically or in a way other than changing the direction of rotation. generally dir=2 works. if I set it, the magazine rotates in two directions and looks for the shortest path to the tool.
by the way, I will add a fragment of the analysis that GROK did based on github.com/LinuxCNC/linuxcnc/blob/v2.9.2...onents/carousel.comp
by the way, I will add a fragment of the analysis that GROK did based on github.com/LinuxCNC/linuxcnc/blob/v2.9.2...onents/carousel.comp
Please Log in or Create an account to join the conversation.
- Adam Maszynotwór
- Topic Author
- Offline
- Senior Member
-
Less
More
- Posts: 40
- Thank you received: 12
1 year 6 months ago - 1 year 6 months ago #327413
by Adam Maszynotwór
Replied by Adam Maszynotwór on topic Is there a bug in the carousel component or am I doing it wrong ATC Denford
Below is the translated and polished version of your analysis, ready to be posted on the LinuxCNC forum. It retains all the technical details, observations, and context while being concise and clear for the community. I've formatted it to fit a typical forum post structure, focusing on your issue with the carousel component and the lack of reverse motion in REV_TIME.Forum Post: Lack of Reverse Motion in carousel Component (counts Mode, rev-pulse)Title: No Reverse Motion in carousel Component with counts Mode and rev-pulseBody:Hello everyone,Thank you for the help so far. I'm working on a toolchanger carousel with 8 pockets, driven by a stepper motor (1600 steps/rev, scale=200) in LinuxCNC (version [insert your version, e.g., 2.9.2]). I'm using the carousel component in counts mode (encoding=counts, dir=1) with a physical homing sensor on parport.0.pin-10-in. Homing works correctly, but subsequent M6 tool changes fail to perform the reverse motion (rev-pulse=2.0), even though carousel.0.motor-rev changes state. Below, I've analyzed the carousel component's source code to understand how the reverse motion (for locking) should work and why it’s not generating pulses on parport.0.pin-08-out in REV_TIME with stepgen in position mode (step_type=0).Analysis of Reverse Motion Mechanism1. Documentation on rev-pulseFrom the carousel component documentation:text
Copy
text
Copy
Interpretation:
Copy
What happens:
Copy
What happens:
Copy
Copy
Code:
pin in float rev-pulse """The duration in seconds for which a ratchet changer (Boxford, Emco) should pulse the reverse pin to lock the holder""";
Copy
Code:
For tool changers which lock the carousel against a stop the \fBrev-pulse\fR pin can be set to a non-zero value. The motor-rev pin will then be set for this many seconds at the completion of the tool search and at the same time the reverse duty/cycle velocity value will be sent to the motor-vel pin.
- rev-pulse defines the duration (in seconds) that the motor-rev pin is active (TRUE) to perform a reverse motion to lock the carousel (e.g., for ratchet-type changers like Boxford or Emco).
- During this time, motor-vel is set to rev-dc (reverse velocity), suggesting the reverse motion is intended for velocity control (e.g., DC motors or stepgen in velocity mode).
- The documentation does not mention updating counts-target in REV_TIME, which is critical for counts mode with stepgen in position mode.
- carousel.0.rev-pulse=2.0 (2 seconds of reverse motion).
- carousel.0.rev-dc=-0.5 (reverse velocity, 50% of max velocity).
- stepgen.2.maxvel=80 (80 pulses/second).
- encoding=counts, dir=1 (unidirectional carousel).
- stepgen.2 in position mode (step_type=0), driven by carousel.0.counts-target.
- After reaching the target pocket (e.g., T1 M6), the carousel should perform a reverse motion for 2 seconds, generating pulses on parport.0.pin-08-out (e.g., 80 pulses, calculated as 2.0 * 80 * 0.5).
Copy
Code:
case 2: // moving if ((current_position != mod_pocket) && enable){ deb = debounce; return; } else if (deb-- > 0) { return; } if (rev_pulse > 0){ motor_fwd = 0; motor_rev = 1; motor_vel = rev_dc; timer = rev_pulse; state = 3; } else if (decel_time > 0) { // stop and prepare for alignment motor_vel = 0; timer = decel_time; state = 5; } else { motor_fwd = 0; motor_rev = 0; motor_vel = hold_dc; active = 0; if (enable && current_position == mod_pocket) ready = 1; state = 9; } break;
- If rev_pulse > 0 (in my case, 2.0), the component:
- Sets motor-fwd=0, motor-rev=1 (activates reverse direction, seen on parport.0.pin-09-out).
- Sets motor-vel=rev-dc (in my case, -0.5 for reverse velocity).
- Initializes the timer to rev-pulse (2.0 seconds).
- Transitions to REV_TIME (state 3).
- Key Issue: It does not update counts-target, which drives stepgen.2.position-cmd in position mode.
Copy
Code:
case 3: // timed reverse pulse timer -= fperiod; if (timer > 0) return; state = 9; motor_fwd = 0; motor_rev = 0; motor_vel = hold_dc; active = 0; if (enable) ready = 1; break;
- The timer counts down rev-pulse (2.0 seconds) in thread cycles (fperiod, typically 1 ms in the servo thread).
- During this time, motor-rev=1 and motor-vel=rev-dc (set in the MOVE state) remain active.
- When the timer expires (timer <= 0):
- Motion stops: motor-fwd=0, motor-rev=0, motor-vel=hold-dc (likely 0 in my case).
- Sets active=0 and ready=1 (signals tool change completion).
- Transitions to WAIT_ENABLE_FALSE (state 9).
- Key Issue: There is no update to counts-target in REV_TIME, so stepgen.2 in position mode does not receive a new target position, resulting in no pulses on parport.0.pin-08-out.
Copy
Code:
case 'C': // encoder or stepgen counts. new_pos = current_position; if (homed){ int c; int t; int w = width / 2; c = (counts - base_counts); t = floor(((float)c + w) / scale); if (c >= (t * scale - w) && c <= (t * scale + w)) { new_pos = 1 + (t % inst_pockets); if (new_pos < 1) new_pos += inst_pockets; } align_pin = (c % scale <= 2 && c % scale >= -2); }
- counts-target is updated in the DIR_CHOOSE state (state 1) for forward motion:
c
CopyCode:counts_target += (mod_pocket - current_position) * scale; - In REV_TIME, counts-target remains unchanged, so stepgen.2.position-cmd equals stepgen.2.position-fb, resulting in no pulses.
- The documentation suggests motor-vel and motor-rev are primarily for velocity control (e.g., DC motors or stepgen in velocity mode, step_type=1).
- In my setup, stepgen.2 is in position mode (step_type=0), where motion depends on the difference between position-cmd and position-fb, and motor-vel is ignored.
- This explains why motor-rev=1 and motor-vel=-0.5 do not generate pulses – stepgen.2 waits for a change in position-cmd (i.e., carousel.0.counts-target).
- A timed reverse pulse: After reaching the pocket, the component sets motor-rev=1 and motor-vel=rev-dc for rev-pulse seconds (2.0 seconds).
- Intended for ratchet-type changers where reverse motion locks the carousel against a mechanical stop (e.g., a pawl).
- Assumes motion control via motor-vel and motor-rev, suitable for:
- DC motors (with PWM).
- stepgen in velocity mode (velocity-cmd).
- Carousels with position sensors where the exact number of pulses is not critical.
- In counts mode with stepgen in position mode, reverse motion does not occur because counts-target is not updated in REV_TIME.
- carousel.0.motor-rev changes to TRUE, and carousel.0.motor-vel to -0.5 in REV_TIME.
- However, stepgen.2.position-cmd, stepgen.2.position-fb, and carousel.0.counts remain unchanged.
- No pulses are generated on parport.0.pin-08-out because stepgen.2 in position mode does not receive a new position-cmd value.
- Is the carousel component in counts mode supposed to update counts-target in REV_TIME to enable reverse motion in position mode? If not, how should reverse motion be configured?
- Has anyone used the carousel component in counts mode with rev-pulse for a stepper-driven carousel? If so, could you share your configuration?
- Would modifying the carousel component to update counts-target in REV_TIME (e.g., based on rev-pulse, rev-dc, and maxvel) be a reasonable solution, or is there a better approach?
Last edit: 1 year 6 months ago by Adam Maszynotwór.
The following user(s) said Thank You: tommylight
Please Log in or Create an account to join the conversation.
Time to create page: 0.147 seconds