nornagon / saxi

Tools & library for driving the AxiDraw pen plotter
GNU Affero General Public License v3.0
471 stars 55 forks source link

Wrong dimensions in the final plot #120

Open joseedil opened 2 years ago

joseedil commented 2 years ago

Hey, thanks for the great tool.

I'm using saxi on a headless raspberry pi to control an iDraw A3 plotter. The machine uses the Axidraw firmware (currently with v2.6.5, not sure if it will work if I update it).

When using the Axidraw Inkscape plugin (v2.7.0) it correctly prints the SVG. But when using saxi I'm getting a consistent 0.8 scale factor in both X and Y directions. In the picture, it's supposed to make 10mm squares spaced 10mm from the paper border. IMG_4251

On the saxi interface, I disabled 'fit page' and 'crop to margins'. The preview looks OK. Screen Shot 2022-08-27 at 18 26 37

I get the same 0.8 scaling factor if I use 'fit to page' with margins. Screen Shot 2022-08-27 at 18 33 37

I would guess the tool is set to a different turns/mm ratio then the one on my machine.

Am I missing something?

Could you point me to where to look for in the code to help tweak it (I skimmed through it and did not locate where this kind of setting is being handled).

joseedil commented 2 years ago

I updated the EBB firmware to v2.8.1 (latest).

Same thing.

Curiously, when I update the Inkscape plugin to v.3.5.0 (latest), it also gives the strange 0.8 scaling factor.

Surely some parameter changed from one version to the other. I'll keep investigating.

joseedil commented 2 years ago

Ok, found the problem.

In the Inkscape plugin there is a 'native_res_factor' parameter in the axidraw_conf.py file. The default value is 1016.0 and it is used to compute the steps/in rate of the machine.

native_res_factor = 1016.0  
# Motor resolution factor, steps per inch. Default: 1016.0
# Note that resolution is defined along native (not X or Y) axes.
# Resolution is native_res_factor * sqrt(2) steps/inch in Low Resolution  (Approx 1437 steps/in)
#       and 2 * native_res_factor * sqrt(2) steps/inch in High Resolution (Approx 2874 steps/in)

The machine vendor provided a customized plugin. I checked it and the only thing that seems to change is this parameter which is tuned to the value 1270.0.

Indeed, when I configure the latest inkscape plugin to this number the machine prints in the correct size. Also, the 0.8 scale factor is exactly the ratio between these two numbers.

I did not find anywhere in the saxi source code where the steps/in rate is computed to try to fix it.

joseedil commented 2 years ago

I was able to make successful plots with this machine after changing the stepsPerMm parameter to 1.25 * 5. Not submitting a pull request as it will surely break things for Axidraw owners.

Why not expose this setting (or a machine selection setting) on the GUI?

sihil commented 11 months ago

Just dropping in to save someone heading down the rabbit hole I've been pursuing for the last few hours (based on confidence having seen this issue): @joseedil is talking about the original iDraw A3 and not the newer iDraw v2.0 A3.

The newer v2.0 line do not use the EBB protocol but instead use g-code. It cannot currently be hooked up to saxi. 😢

If you have such a plotter and you're trying to use it using tools other than Inkscape then I suggest reading this and this.

thierryc commented 8 months ago

I've delved into this matter and discovered that it's not an issue per se. I currently share a similar requirement, albeit for different reasons. I've developed a customized plotter utilizing the same EBB board.

However, my GT2 motor pulley has 16 teeth, unlike the Axidraw's 20 teeth. This leads to a mathematical variation in accuracy, as I have 6.25 steps per mm compared to the Axidraw's 5 steps per mm. The motor itself boasts 200 steps per rotation.

In response to additional requirements, I've created a fork that hasn't been pushed as a pull request yet. WIP. In this fork, I've incorporated a dropdown menu enabling users to select the device and its associated settings. Feel free to explore it, and any feedback you may have would be greatly appreciated.

node cli.js --firmware-version EBBv13_and_above EB Firmware Version 2.8.1

https://github.com/thierryc/saxi/tree/xylodraw

branch: xylodraw

image

@joseedil the iDraw A3 plotter. your version use probably 16 teeth pulley and a EBB board. Do you know other Axidraw Clones?

joseedil commented 7 months ago

I'm not aware of other clones, but this whole discussion was enlightening. Have been using the axidraw cli since I reported the issue, maybe it's time to try saxi again.

FS-12 commented 3 months ago

I ran into the same issue with my own built pen plotter, controlled by an EBB Board v2.7.: Same wrong 0.8 scaling → a 100 x 100 mm box is drawn 80 x 80 mm

With the Axidraw Inkscape plugin everything turns out correctly. Axidraw Control is v3.9.5. up to date EBB Board firmware is v2.8.1. up to date

I edited the stepsPerMm parameter within planning.js, saved the file and restarted the saxi server, but the change did not show any effect, I get the same dimensions. Can someone give me a hint what I might be missing?

thierryc commented 3 months ago

Hi @FS-12,

Please try using my version and let me know how it works for you:

https://github.com/thierryc/saxi/tree/xylodraw

Using the "Xylodraw" option in the menu should work. Make sure to count your pulley teeth—do you have 16 or 20?

If it doesn't work properly, please let me know. Make sure to set the size correctly, remove the margin, and send me the results you get. I will then try to fix the issue.

FS-12 commented 3 months ago

Hi @thierryc I uninstalled saxi and installed your fork and it works, thanks! You are right, I have 16 teeth GT2 pulleys.

I still don't know why changing the stepsPerMm to 6.25 with a text editor did not show any effect?! But I also dont have much experience with github and forks etc.

thierryc commented 3 months ago

Thank you for your feedback.

What is the name and the version of your plotter? (to add it into the menu)

I will continue to keep my version up to date. My version is an experimental fork for personal Penplot work on my custom plotter (code name Xylodraw). However, if the Saxi author is agreeable, I'd be willing to clean up the code and potentially contribute the configuration menu to the main project.

FS-12 commented 3 months ago

Its based on the A3+ Drawing Machine with some tweaks I did myself and powered by the EBB board.

But I assume that the core difference between all EBB-based plotters is the size (maximum X/Y distances) and pulley teeth (GT2 16/20 teeth → scaling of the drawing influenced by stepsPerMm.

So instead of adding all potential pen plotter options out there it might be a better idea to allow adjustment of these core parameters?!

FS-12 commented 3 months ago

@thierryc Your fork works, thanks! But if I understand everything correctly I simply need to change this stepsPerMm parameter to 6.25 and actually don't need this machine selector dropdown. I have tried this by editing the local file planning.js (saxi > dist > server) with Visual Studio Code but it shows no effect? Do you have an idea what I might be doing wrong?

thierryc commented 3 months ago

@FS-12 You're correct; the dropdown is just a convenient way to switch between machines. All the settings are already in place, and if you have multiple machines, it's an easy way to switch between them. However, you can simply change the stepsPerMm parameter. My SAXI fork version also includes some other custom properties.