Independent operations



  • Is there a way for Duet to do a set of operations from a short macro that doesn't hold up the rest of the machine while that macro is being performed?

    Maybe every time a specific endstop input is triggered this separate sequence is performed.



  • "independent" is a very slippery concept in a machine that has a look-ahead based motion planner. The best answer is "maybe" without knowing some specifics.

    Let's assume the machine is executing a sequence of G-Code statements that involve coordinated linear motion with X, Y, and Z (sometimes just a subset). What is it you wish to happen in "parallel"? It can't be moves on those axis, that's physically impossible to "parallel" because the machine can only be in one place at any given instant.

    So what should be happening alongside the main motion?



  • @Danal

    I want to feed colorant into my extrusion barrel, one granule per revolution of the main screw. My current concept is to use a mini linear actuator stepper to pull a pin to get the granule then push the granule into the barrel.

    I can make a separate circuit board just to do this, but I've got an axis to spare on my Duet 2 system, and it would save me developing that board.



  • Got it. What makes the main screw turn?



  • @Danal said in Independent operations:

    Got it. What makes the main screw turn?

    A gear reduced stepper motor



  • @JRDM said in Independent operations:

    A gear reduced stepper motor

    Driven as an axis from the duet? Or driven by something else?



  • @Danal said in Independent operations:

    @JRDM said in Independent operations:

    A gear reduced stepper motor

    Driven as an axis from the duet? Or driven by something else?

    That is my primary extruder axis on Duet.



  • The reason for the questions: I believe you can drive that as another axis, no firmware mods necessary, and no 'sensing' of a full rotation.

    Say your main extruder is E and the color pellet is C (why not?) Generate your G-Code just like you always do, then post process it with a short PERL or Python script that tracks how far E has extruded, and puts in a Cnnn at the appropriate points (just adds it at the end of an existing move statement).

    Where 'nnn' increments enough to eject exactly one pellet.



  • could this not be achieved by tool mixing ratios, or driving multiple motors with different steps/mm settings?

    some of the hard core multi motor/multi tool gurus might be able to come up with some suggestions?


  • administrators

    @JRDM said in Independent operations:

    Is there a way for Duet to do a set of operations from a short macro that doesn't hold up the rest of the machine while that macro is being performed?

    Maybe every time a specific endstop input is triggered this separate sequence is performed.

    It depends on the commands. Currently, there is only one primary movement queue, so if the macro involves movement then the operations in the macro will be queued along with other moves.

    There is already support in RRF3 for multiple movement queues. Currently there is a primary movement queue and a much shorter secondary movement queue. The secondary movement queue is used only when the Z axis is put into height following mode. However, on Duet 3 there is enough memory to have two (or even more) full length movement queues. So I envisage a GCode command to assign individual axes and extruders to a movement queue, which would allow independent operations.



  • @bearer said in Independent operations:

    could this not be achieved by tool mixing ratios, or driving multiple motors with different steps/mm settings?

    some of the hard core multi motor/multi tool gurus might be able to come up with some suggestions?

    That would work great if the E position continuously increments. Unfortunately, it will not work with 'relative' E moves where the gcode file also contains periodic resets to zero of the E values. Which is most slicers.

    Of course, this can be turned off, that is E forced to be cumulative (not relative). However, this whole relative/reset scheme originated because of rounding errors on the very large decimal numbers that occur during long prints.

    So... definitely define the color motor as an axis. Either set a mixing ration and use absolute E, or post-process with a script that "keeps track" even across the resets.



  • As a (retired) mechanical engineer, I can't help but think of mechanical solutions. So if the OP used absolute extrusion and drove a second extruder motor using an appropriate mixing ratio, it would increment by nn steps each time an extrusion event occurred. So if that second motor was connected to a shaft with a cam, and that cam triggered a switch, then effectively he'd have a (mechanical) means of summing the extruder moves until a total is reached, without the need for any post processing. The count would automatically reset as the shaft continued to rotate and the cam releases the switch.

    Alternatively, instead of driving a cam, use a disc with two holes in it which will take 1 grain of colourant set at 180 degrees apart and two flat plates either side of that disc. The upper plate has a single hole and the grains would be loaded into to hopper. As the disc rotates, the hole gets uncovered and a single grain drop in. The second plate has a single hole set 180 degrees from the upper plate hole. As the disc rotates further, and second hole is uncovered, the grain falls out (and somehow gets added to the contents of the extrusion barrel but without know more about that barrel mechanism, I can't elaborate).

    Just a couple of ideas......



  • @bearer said in Independent operations:

    could this not be achieved by tool mixing ratios, or driving multiple motors with different steps/mm settings?

    some of the hard core multi motor/multi tool gurus might be able to come up with some suggestions?

    I already have mixing working, but that's a cross-feed into my extruder's throat.

    But I think this sequence is more complicated. On some cue (or step count or every Ymm of screw advance, I want to retract a linear actuator by X mm, operate a solenoid then un-retract to push the colorant pellet into the barrel. And I don't want this interrupting a print.

    I'm starting to think a separate board might be easier at least for the short term.


  • administrators

    @JRDM, this may be possible in RRF3 within the next few weeks. I'm not sure yet whether we will be able to support it on Duet 3, or it will need the additional memory available on Duet 3.

    Are you able to rig up a sensor to indicate when a new colourant pellet is needed?



  • @dc42 said in Independent operations:

    @JRDM, this may be possible in RRF3 within the next few weeks. I'm not sure yet whether we will be able to support it on Duet 3, or it will need the additional memory available on Duet 3.

    Are you able to rig up a sensor to indicate when a new colourant pellet is needed?

    Sounds interesting. I don't have Duet 3 yet though.

    I expect yes, I believe I can get a sensor to trigger at the appropriate shaft rotation. I will need to make that happen one way or another.



  • @JRDM said in Independent operations:

    But I think this sequence is more complicated. On some cue (or step count or every Ymm of screw advance, I want to retract a linear actuator by X mm, operate a solenoid then un-retract to push the colorant pellet into the barrel. And I don't want this interrupting a print.

    That is exactly what a post-proc script could be written to do. And post-proc can be automated into most slicers. Hardware wise, let's assume the solenoid is hardware triggered by the retract of the linear. Then all the firmware needs to do is retract the linear and put it back, while printing moves proceed. Yes?

    Given the above, here is an example. All G1 moves are from the slicer. The C moves are added by the script. Nothing stops; the C moves occur in parallel with the other moves.

    ; hundreds or thousands of lines above this example
    G92 E0                          ; Resets E position to zero as far as firmware is concerned. 
                                    ;However, script would keep accumulating.
    M83 ;relative extrusion mode
    G1 F2400 E-6.5
    ;LAYER_COUNT:171
    ;LAYER:10
    G0 F3600 X-0.094 Y-12.132 Z0.21
    G1 F2400 E6.5
    G1 F1800 X0.014 Y-12.135 E0.00539
    G1 X0.75 Y-12.143 E0.03672
    G1 X1.006 Y-12.138 E0.01277
    G1 X2.61 Y-12.062 E0.08011 C20   ; Script inserted these C moves, because TOTAL move of E exceeded a configured value as of this G1 command
    G1 X3.106 Y-12.044 E0.02476 C-20 ;Script inserted c
    G1 X3.2 Y-12.04 E0.00469
    G1 X3.563 Y-12.019 E0.01814
    G1 X3.69 Y-12.009 E0.00636
    G1 X4.185 Y-11.966 E0.02479
    G1 X4.587 Y-11.913 E0.02023
    G1 X5.079 Y-11.824 E0.02494
    G1 X5.122 Y-11.816 E0.00218
    ; Hundreds or thousands of lines below this extract
    


  • Or, to your point a totally independent solution. A microswitch that clicks once per rotation. An arduino with a simple script... linear out, solenoid on, solenoid off, linear in, with appropriate delays.

    Either path is great.



  • @Danal said in Independent operations:

    Or, to your point a totally independent solution. A microswitch that clicks once per rotation. An arduino with a simple script... linear out, solenoid on, solenoid off, linear in, with appropriate delays.

    Either path is great.

    I'm currently leaning to an Arduino with a custom shield. It's more platform independent anyway.



  • If you do decide to go Duet, here is a working perl program that does what you desire. It has been lightly tested. Let me know if you choose to use it.

    use strict;
    # change these values as desired
    my $Elimit = 100;
    my $ColorAxis = "C";
    my $Cdistance = 20;
    # Normally, Don't change anything after this line
    
    my $filename = shift or die "Usage: $0 FILENAME\n";
    open(my $fh, '<:encoding(UTF-8)', $filename)
      or die "Could not open file '$filename' $!";
    
    my $Etot = 0;
    my $Cinserted = 0;
    
    while (my $row = <$fh>) {
      chomp $row;
      if (my $a = $row =~ m/(.*?)([\ \d])(E)([\.\d]*)(.*)/) {
      	$Etot += $4;
        if ($Etot > $Elimit) {
        	$Etot = 0;
        	$Cinserted = 1;
        	print "$1$2$3$4 C$Cdistance $5\n";
        }
        if ($Cinserted) {
        	$Cinserted = 0;
        	print "$1$2$3$4 C-$Cdistance $5\n";
        }
      } else {
      	print "$row\n";
      }
    }
    


  • @deckingman said in Independent operations:

    Alternatively, instead of driving a cam, use a disc with two holes in it which will take 1 grain of colourant set at 180 degrees apart and two flat plates either side of that disc. The upper plate has a single hole and the grains would be loaded into to hopper. As the disc rotates, the hole gets uncovered and a single grain drop in. The second plate has a single hole set 180 degrees from the upper plate hole. As the disc rotates further, and second hole is uncovered, the grain falls out (and somehow gets added to the contents of the extrusion barrel but without know more about that barrel mechanism, I can't elaborate).

    This actually sounds pretty darn good. To the original requirement: Geared 1:1 with the auger.


Log in to reply