File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1168,12 +1168,13 @@ while control_mode > MODE_STOPPED:
11681168 thread_trajectory = run trajectoryThread()
11691169 elif params_mult[2] == TRAJECTORY_MODE_STREAM_END:
11701170 # params_mult[3] is the total count of spline points the producer
1171- # wrote to the trajectory socket since STREAM_START. Convert the
1172- # in-flight sentinel into the remaining unread count:
1173- # M_consumed = STREAMING_SENTINEL - trajectory_points_left
1174- # remaining = params_mult[3] - M_consumed
1175- # = trajectory_points_left + params_mult[3] - STREAMING_SENTINEL
1176- trajectory_points_left = trajectory_points_left + params_mult[3] - STREAMING_SENTINEL
1171+ # wrote to the trajectory socket since STREAM_START. The
1172+ # trajectoryThread has decremented trajectory_points_left once per
1173+ # consumed point starting from STREAMING_SENTINEL, so the consumed
1174+ # count is (STREAMING_SENTINEL - trajectory_points_left). The
1175+ # unread remainder still in the OS socket buffer is therefore
1176+ # the producer's total minus the consumer's consumed count.
1177+ trajectory_points_left = params_mult[3] - (STREAMING_SENTINEL - trajectory_points_left)
11771178 trajectory_streaming = False
11781179 elif params_mult[2] == TRAJECTORY_MODE_CANCEL:
11791180 textmsg("cancel received")
You can’t perform that action at this time.
0 commit comments