Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Near-diagonal motion fails silently #139

Open
ghost opened this issue Nov 22, 2023 · 3 comments
Open

Near-diagonal motion fails silently #139

ghost opened this issue Nov 22, 2023 · 3 comments

Comments

@ghost
Copy link

ghost commented Nov 22, 2023

When attempting to make near-diagonal pen movements, the pen fails to move, though the API gives no indication of the failure. I'm observing this in cncserver version 2.9.1, operating an AxiDraw V3, running EBB firmware 2.8.1.

The easiest way to observe this with the AxiDraw V3 is, with the pen in the home position, is to PUT {x: 50, y: 68.8} (equivalent to 6000 x steps and 5999 y steps) to the /pen endpoint. The pen will fail to move, but the API will return success. Additionally, cncserver will think the pen has moved, making it easy to try to move the pen beyond the physical limits of the machine on subsequent movements. The only indication of an error will be !0 Err: <axis2> step rate < 1.31Hz. outputted to the console.

Similarly, if the pen is at {x: 100, y: 0}, attempting to move to {x: 50, y: 68.8} will fail with !0 Err: <axis1> step rate < 1.31Hz. outputted to the console.

I think I understand why this is happening, and it kinda makes sense. (Have I got it right that each motor moves the pen on orthogonal diagonal axes, rather than xy axes?). But it would be better if the API either returns an error in these cases (either detecting ahead of time that the movement would fail, or checking for this message from the firmware). Or splits the movement into multiple move commands that avoid this issue.

I'll need to implement the latter for my current project, whether that's inside or outside cncserver, so any thoughts on how to approach this would be appreciated.

@oskay
Copy link
Collaborator

oskay commented Nov 22, 2023

Best practice is to check commands for sanity before sending them. (The same type of error can happen on the WaterColorBot as well, though in near-horizontal or near-vertical moves, not near-diagonal.)

In the AxiDraw software, if the command is this close to diagonal, we make it actually diagonal, and keep track of the (very small) position error, so that it is typically corrected for on the subsequent move.

Aside: Error checking the XM command (used in cncserver on AxiDraw) is more difficult than error checking the SM command (used in cncserver on WCB, eggbot), because of the way that the motor step counts are generated. The AxiDraw software does not actually use the XM command for this reason; it calculates the corresponding SM command, checks it for speed limits, and then makes the move as an SM.

@ghost
Copy link
Author

ghost commented Nov 22, 2023

In the AxiDraw software, if the command is this close to diagonal, we make it actually diagonal, and keep track of the (very small) position error, so that it is typically corrected for on the subsequent move.

Ah neat. Is this the check you mean?

It's possible I'm out of my depth, but I'll try and get a PR up soon for a similar check in cncserver.

@oskay
Copy link
Collaborator

oskay commented Nov 22, 2023

Yes, that's one possible way to implement it. The exact check to make is described at http://evil-mad.github.io/EggBot/ebb.html#SM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant