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