This part is for members
Membership opens soon. Leave your email and we'll tell you the day it does. Founding members get the launch price.
Keep watching the free partsTrajectory planning 1: planned again every tick
The first episode of the motion modes section: the host writes one target, the position loop needs the next point to follow every 100 µs, and pos_trajectory_planning draws the path between. Running example: the PP move of episodes 1, 3, 4 and 13, two turns (262,144 counts) at 600 rpm and 6000 rpm/s; the traj24 bench wraps the unchanged planner, records the branch it takes on every tick and checks it against the real output. It opens with the whole planner on one framework page (it keeps no plan: every tick it plans the whole trapezoid again from one position and one speed and takes one step; one call top to bottom, the four branches A–D and which ticks took each), and the so-far and the recap are told on the same page. Then eleven stops, first following tick 0 in the order the code runs: PosSpeedLoopCtrl runs the app layer (AppRun → PpModeRun → PosTrajectoryPlanningHandle) before the position loop, so the point planned this tick is followed in the same tick; it is handed five numbers (target 262,144, profile speed 600 × 131,072/60 = 1,310,720 counts/s, acceleration and deceleration 13,107,200 counts/s², period 100 µs); it keeps only three, q0_int (a 64-bit integer), q0_dec (the fraction) and dq0 (the speed), seeded from the motor at enable and never read from the motor after that; it works out the distance left and the direction, and three checks (halt, moving away, too fast) do not fire (→ 24b); the top speed vf = √(h·a) = 848.5 rpm is capped at 600; three times, Ta = Tv = Td = 0.1 s (the generated code reuses variables, the comments keep the names); this tick falls in the speeding-up part and moves 0.0655 counts; the fraction is rounded into the whole count, reaching 1 on tick 2 (128 turns out a float steps by 2 counts, worked out from the code); the outputs: the position command goes through input shaping (off) into the position loop, the speed becomes feedforward (vff 1), the acceleration feedforward's gain aff is 0, and nobody reads the fraction or state_now. Then across 3000 ticks: the plan itself is not saved, tick 1 works it all out again with Ta exactly one tick shorter; ticks 999 and 1999 each span two parts; tick 3000 reaches past the end and lands on the target. Not shown: there is no jerk limit; changing the command mid-move → 24b. Your turn: half a turn, 424.3 rpm, no cruise.