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 2: changing the command mid-move
The three checks 24a skipped. The same PP move (two turns, 600 rpm, 6000 rpm/s); at tick 1500 (150 ms, mid-cruise) the host changes one thing, four ways, one run each (the traj24 bench with --vel-at / --halt-at / --target-at, every branch checked against the real output). Stop 1: PpModeRun rebuilds the inputs every tick: the speed limit comes from Profile_velocity, or is 0 while the halt flag Halt_running_cmd is set; under host control a new target reaches position_target_last on the next tick (a bus master needs a bit-4 rising edge → episode 25); the planner's memory does not change: 131,072.5 counts at 600 rpm. Stop 2, down to 300 rpm: the third check (too fast) fires and the speed drops 1,310.72 per tick; tick 1999 takes only the gap and lands exactly on 655,360; after 50 ms the normal plan takes over and the move arrives at tick 3500. Stop 3, a halt: the first check fires; it slows by the sign of the speed alone and is done under 1,312 counts/s; the textbook v²/2a gives 196,608.5 but the run stops at 196,476, and 131 of the 132 counts come from the order of two lines (speed first, then the move: a·dt² = 0.131 less each tick, worked out from the code and checked by a float32 replay); the target stays. Stop 4, the target back to 0: the second check (moving away) fires, tick for tick the same arithmetic as the halt, to the same 196,476, then the normal plan back, arriving at tick 4998. Stop 5, target 140,000 (8,927 ahead; stopping takes 65,536): no check fires, the normal plan's Ta is −24.6 ms, and 24a's rounding guard takes 71 plain steps at the deceleration; past the target the second check takes over, stops at the same 196,476 and comes back on a triangle (393.8 rpm), arriving at tick 3812. So far: the stopping distance is a floor and the planner never refuses a target. Not shown: raising the speed (课件 practice), quick stop and the bit-4 edge (→ episode 25), reciprocal_motion.c (→ episode 32). Your turn: halt at 150 ms, resume at 300 ms: 424.7 rpm, 70.8 ms up and down.