@@ -5015,76 +5015,6 @@ STATIC int tpHandleSplitCycle(TP_STRUCT * const tp, TC_STRUCT * const tc,
50155015 if (junction_vel < 0.0 ) junction_vel = 0.0 ;
50165016 }
50175017
5018- // PREDICT_SPIKE: log junction velocity mismatch prediction.
5019- // NOTE: canonical_feed_scale is the feed override knob position at
5020- // junction time (from emcmotStatus->feed_scale), NOT the feed the
5021- // machine is actually running at. The machine only changes feed
5022- // through branches — if no branch was taken at the knob's feed,
5023- // the machine is still at the profile's feed. Comparing prof_feed
5024- // vs canon_feed is therefore unreliable for classification.
5025- if (GET_TRAJ_PLANNER_TYPE () == 2 &&
5026- __atomic_load_n (& nexttc -> shared_9d .profile .valid , __ATOMIC_ACQUIRE )) {
5027- double _pred_v0 = nexttc -> shared_9d .profile .v [0 ];
5028- double _pred_gap = junction_vel - _pred_v0 ;
5029- if (fabs (_pred_gap ) > 0.3 ) {
5030- double _pred_feed = nexttc -> shared_9d .canonical_feed_scale ;
5031- double _pred_prof_feed = nexttc -> shared_9d .profile .computed_feed_scale ;
5032- double _pred_prev_feed = tc -> shared_9d .canonical_feed_scale ;
5033- double _pred_feed_err = (_pred_feed > 0.001 ) ?
5034- fabs (_pred_prof_feed - _pred_feed ) / _pred_feed : 0.0 ;
5035- rtapi_print_msg (RTAPI_MSG_ERR ,
5036- "PREDICT_SPIKE seg=%d: v0-mismatch "
5037- "jv=%.3f v0=%.3f gap=%.3f "
5038- "prof_feed=%.3f knob_feed=%.3f prev_feed=%.3f "
5039- "feed_err=%.1f%%\n" ,
5040- nexttc -> id , junction_vel , _pred_v0 , _pred_gap ,
5041- _pred_prof_feed , _pred_feed , _pred_prev_feed ,
5042- _pred_feed_err * 100.0 );
5043- }
5044- }
5045-
5046- // SPIKE_DBG: log junction velocity mismatch at segment handoff.
5047- // src: 1=DS, 2=cursor, 4=fwd, 5=alt, 6=hold, 7=backtrack, 8=bkwd_fixup, 9=head
5048- if (GET_TRAJ_PLANNER_TYPE () == 2 &&
5049- __atomic_load_n (& nexttc -> shared_9d .profile .valid , __ATOMIC_ACQUIRE )) {
5050- double _dbg_v0 = nexttc -> shared_9d .profile .v [0 ];
5051- double _dbg_gap = junction_vel - _dbg_v0 ;
5052- if (fabs (_dbg_gap ) > 0.3 ) {
5053- double _dbg_feed = nexttc -> shared_9d .canonical_feed_scale ;
5054- double _dbg_prev_feed = tc -> shared_9d .canonical_feed_scale ;
5055- double _dbg_prof_feed = nexttc -> shared_9d .profile .computed_feed_scale ;
5056- double _dbg_prev_aev = tc -> shared_9d .achieved_exit_vel ;
5057- double _dbg_prev_fv = atomicLoadDouble (& tc -> shared_9d .final_vel );
5058- double _dbg_prev_fvl = atomicLoadDouble (& tc -> shared_9d .final_vel_limit );
5059- int _dbg_src = nexttc -> shared_9d .profile .dbg_src ;
5060- double _dbg_v0_req = nexttc -> shared_9d .profile .dbg_v0_req ;
5061- // Predecessor profile data: what vf did tc's profile actually achieve?
5062- double _dbg_prev_prof_vf = tc -> shared_9d .profile .valid
5063- ? tc -> shared_9d .profile .v [RUCKIG_PROFILE_PHASES ] : -1.0 ;
5064- int _dbg_prev_src = tc -> shared_9d .profile .dbg_src ;
5065- double _dbg_prev_prof_feed = tc -> shared_9d .profile .computed_feed_scale ;
5066- rtapi_print_msg (RTAPI_MSG_ERR ,
5067- "SPIKE_DBG seg %d->%d: jv=%.3f v0=%.3f gap=%.3f "
5068- "src=%d v0_req=%.3f "
5069- "feed=%.3f prev_feed=%.3f prof_feed=%.3f "
5070- "prev_term=%d kink=%.3f maxvel=%.3f target=%.4f "
5071- "prev_aev=%.3f prev_fv=%.3f prev_fvl=%.3f "
5072- "prev_type=%d next_type=%d\n" ,
5073- tc -> id , nexttc -> id , junction_vel , _dbg_v0 , _dbg_gap ,
5074- _dbg_src , _dbg_v0_req ,
5075- _dbg_feed , _dbg_prev_feed , _dbg_prof_feed ,
5076- tc -> term_cond , nexttc -> kink_vel , nexttc -> maxvel ,
5077- nexttc -> target ,
5078- _dbg_prev_aev , _dbg_prev_fv , _dbg_prev_fvl ,
5079- tc -> motion_type , nexttc -> motion_type );
5080- rtapi_print_msg (RTAPI_MSG_ERR ,
5081- " PREV_PROF seg %d: kink=%.3f maxvel=%.3f "
5082- "prof_vf=%.3f src=%d prof_feed=%.3f\n" ,
5083- tc -> id , tc -> kink_vel , tc -> maxvel ,
5084- _dbg_prev_prof_vf , _dbg_prev_src , _dbg_prev_prof_feed );
5085- }
5086- }
5087-
50885018 int mode = 0 ;
50895019 tpUpdateCycle (tp , nexttc , next2tc , & mode );
50905020
0 commit comments