topic_solved Parallel tasking
Is there any way to execute a command during a G0/G1 insruction?
I'd like to do a specific action when the X axis has reached a defined position, while the X axis motor is traveling at full speed.
I am using a Duet 2 Wifi board, firmware version 3.1.1.
Is it possible ?
It really depends on the type of command. What action do you have in mind?
I will use the G0 command to travel from X = 0 to X = 100 (millimeters) . When X has reached 50 millimeters, I'd like to turn on the Fan 2.
is there any reason why you can't split the G0 command into two commands and put the M106 command between them?
I'm doing a 3-axis stapler with an electric trigger. The electric trigger needs a pulse in order to work. I want to staple the paper block every 100 millimeters during the G0 command (while the stapler is moving at full speed).
gnydick last edited by
@Anthoval if your kinematics are solid, you can configure high jerk and acceleration and you'll barely notice any pause.
Even without high jerk and acceleration, the motion should be continuous provided you don't have a M400, G4 or similar command between the two G1 moves.
To generate a pulse without using G4 you could use something like this:
G1 X100 F4000
M42 P0 S1
M42 P0 S0
M42 P0 S1
M42 P0 S0
and so on.
Another way would be to set up the port using M670, then you can do this:
G1 X100 F4000 P0
G1 X101 P1
G2 X200 P0
G1 X201 P1
If the motion is continuous bewteen two G1 commands, it should be fine. I'm going to try what has been suggested.
From what I understand, there's no way of doing any parallel tasking with the Duet boards, only a very quick series of commands.
There is a small amount of parallel tasking that can be done using the daemon.g file, but I don't think it's appropriate for this purpose. There is another form that allows the Z axis to move independently (height following mode), but again that's not appropriate here.
We have plans to implement multiple independent but synchronised GCode streams on Duet 3 in the future, but that won't be implemented for some time.
Motion is as continuous as possible between adjacent G1 commands. If the G1 commands are in the same direction, then motion should be continuous provided that the print head is up to speed at the end of the first one, and the second one does not require more deceleration that is possible in the length of the move. If you put other commands between the two G1 commands, then motion may stop depending on the command. M42 commands will not cause a stop.
I just thought of another way to operate your stapler: put the machine in laser mode using M452, configure the laser output to operate the stapler, then do this:
G1 X100 F4000 S0
G1 X101 S1
G2 X200 S0
G1 X201 S1
and so on.
I'll try it and give a feedback afterwards. Thanks!
After running multiples tests at a reasonnable speed (Feedrate : 15000 mm/min), I can tell that the motion is continuous between multiple G0/G1 commands!
By the way, I don't understand how the "T" parameter from the M670 works (when using the "P" parameter in a G1 command). I thought at first that is was the delay between the beginning of the movement and the beginning of the output being set to '1'. But when testing with multiple values for "T", the output was always set to '1' immediatly after the beginning of the G1 command.
Edit : The "T" parameter appears to be important when using the P1 parameter with a G1 command on a very short distance. Reduce the "T" value if you're looking to trigger an output to '1' on a short distance and high speed (30 mm and 15000 mm/min).