MarkSlat / OctoPrint-Hologram

A simple OctoPrint plugin to display a render based on the preloaded G-code.
GNU Affero General Public License v3.0
7 stars 1 forks source link

Cannot lock in plate area - Failed to save points #4

Open bleuthoot-sven opened 3 months ago

bleuthoot-sven commented 3 months ago

When I try to lock in the plate are, the plugin reports a "Failed to save points!" The octopi log gives me the following error:

2024-05-22 15:18:25,004 - octoprint.server.api - ERROR - Error while executing SimpleApiPlugin hologram
Traceback (most recent call last):
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/server/api/__init__.py", line 161, in pluginCommand
 response = api_plugin.on_api_command(command, data)
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/util/__init__.py", line 1686, in wrapper
 return f(*args, **kwargs)
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_hologram/__init__.py", line 89, in on_api_command
 return self.save_points(data)
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_hologram/__init__.py", line 137, in save_points
 elevation, azimuth, roll, focal_length, scale = utils.optimize_projection(converted_points, printer_dims)
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_hologram/utils.py", line 285, in optimize_projection
 result = basinhopping(compute_error, initial_params, minimizer_kwargs=minimizer_kwargs, niter=5, stepsize=0.5, callback=callback)
  File "/home/pi/oprint/lib/python3.7/site-packages/scipy/optimize/_basinhopping.py", line 700, in basinhopping
 accept_tests, disp=disp)
  File "/home/pi/oprint/lib/python3.7/site-packages/scipy/optimize/_basinhopping.py", line 72, in __init__
 minres = minimizer(self.x)
  File "/home/pi/oprint/lib/python3.7/site-packages/scipy/optimize/_basinhopping.py", line 292, in __call__
 return self.minimizer(self.func, x0, **self.kwargs)
  File "/home/pi/oprint/lib/python3.7/site-packages/scipy/optimize/_minimize.py", line 624, in minimize
 callback=callback, **options)
  File "/home/pi/oprint/lib/python3.7/site-packages/scipy/optimize/lbfgsb.py", line 308, in _minimize_lbfgsb
 finite_diff_rel_step=finite_diff_rel_step)
  File "/home/pi/oprint/lib/python3.7/site-packages/scipy/optimize/optimize.py", line 262, in _prepare_scalar_function
 finite_diff_rel_step, bounds, epsilon=epsilon)
  File "/home/pi/oprint/lib/python3.7/site-packages/scipy/optimize/_differentiable_functions.py", line 140, in __init__
 self._update_fun()
  File "/home/pi/oprint/lib/python3.7/site-packages/scipy/optimize/_differentiable_functions.py", line 233, in _update_fun
 self._update_fun_impl()
  File "/home/pi/oprint/lib/python3.7/site-packages/scipy/optimize/_differentiable_functions.py", line 137, in update_fun
 self.f = fun_wrapped(self.x)
  File "/home/pi/oprint/lib/python3.7/site-packages/scipy/optimize/_differentiable_functions.py", line 134, in fun_wrapped
 return fun(np.copy(x), *args)
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_hologram/utils.py", line 247, in compute_error
 ax.set_proj_type(proj_type='persp', focal_length=focal_length)
TypeError: set_proj_type() got an unexpected keyword argument 'focal_length'

I am using a Raspberry Pi 4 Model B with 2GB of RAM.

MarkSlat commented 3 months ago

That's interesting, I wonder did everything install properly especially the matplotlib toolkit. Maybe a reinstall might fix it. Did the fail to save points happen as soon as the lock in points was clicked?

bleuthoot-sven commented 1 month ago

That's interesting, I wonder did everything install properly especially the matplotlib toolkit. Maybe a reinstall might fix it. Did the fail to save points happen as soon as the lock in points was clicked?

Hey, sorry for the very late response. I got distracted and basically completely forgot to respond to this question.

Anyway, I've tried reinstalling the plugin completely and follow the instructions to install the plugin properly. I got the same result as mentioned above.