# single-axis trajectory planning question

07 May 2022 10:52 #242226 by zhuck
Hello everyone:
Project needs to support two application scenarios as follows:
1. Multi-axis interpolate independently at different speeds and move at the same time.
2. Each axis can perform trajectory planning independently, without affecting each other.

For example G code:
G01 X10 F100
G01 Y20 F50
Expect XY axis to be able to move at the same time at the set speed

Questions are as follows:
How to implement single-axis trajectory planning in the trajectory planning module, I need everyone's help, thank you!

09 May 2022 00:33 #242337 by andypugh
Have a look at simple-tp and extrajoints.

linuxcnc.org/docs/stable/html/man/man9/simple_tp.9.html

However, the G-code you show will not have the affect you need. G-code only executes a line when the previous line has completed.

There are ways round this. Would it be acceptable for the G-code to be:

M100 P0 Q100
M100 P1 Q50

?

09 May 2022 03:03 #242345 by zhuck
hello This is a great idea

User-defined code M100,.
if M100 and G01 exist at the same time, can it achieve the purpose of N30, N40 program line?

;XY axis can move at the same time
N10 M100 P0 S10 Q50
N20 M100 P1 S20 Q100
;N30, N40 expect that after both N10 and N20 move in place, the Z and U axes will be executed in sequence;
N30 G01 Z10 F100
N40 G01 U10 F100
...
M2

If N30 and N40 cannot meet the demand, my idea is to use M100, and add a motion waiting and non-waiting in M100, which can support simultaneous motion and axis sequential motion.

09 May 2022 10:33 #242370 by andypugh
To start one axis, then move the other and wait you would

M100
G1

To start two axes, then wait for the third:

M100
M100
G1

You should be able to create (for example) M100 as a move-no-wait and M101 as a move-and-wait. Though waiting for motion to complete by polling in a while-loop in a bash script isn't a very elegant solution. Using G1 / G0 is probably better.

If you need more complex motion, then I would look at modifying simple_tp (or limit3, which does much the same thing) to add a position feedback timeout (or whatever else it takes to detect failure) that then set HAL pins that the running G-code can check for. In the same was as the probe codes return success or failure.