diglet48 / restim

MIT License
26 stars 4 forks source link

T-Code Magnitude + Time Interval Handling #12

Open astoniab opened 1 month ago

astoniab commented 1 month ago

According to the T-Code spec, using the magnitude + time interval format should result in the position changing from the current value to the new value over the specified time frame. It does not explicitly state the change in position should be linear, but that seems to be implied here. https://github.com/multiaxis/TCode-Specification?tab=readme-ov-file#magnitude--time-interval

In restim, upon sending the magnitude and time interval, the position jumps close to the max value and then slowly increases to the max value.

For example, if we send the following T-Code commands and observe the behavior in restim.

Reset the alpha axis to position 0 L00 Change the alpha axis position from the current value to the max value over 5 seconds (5000ms) L09I5000

The position can be seen to abruptly jump and then slowly approach the specified value.

Additionally, sending another command for the same channel that is currently changing a position within the interval period results in the new command being "queued" and waiting for the interval to complete before starting the new command. At least that's the effect that's observed when doing so. The T-Code spec does not explicitly say what should happen in that case, but IMO a new command should override any existing commands for a channel and it should execute the new command as soon as the newline character is received. Whatever position the channel is in the when the new command is received should be taken as the starting position for the command.

Interestingly, when these queued commands are executed after the previous command is completed, they do not exhibit the same jumping behavior and change position from the starting value to specified value linearly.

diglet48 commented 1 month ago

Good catch, I will fix this once I find time for coding.