[Easy Servo] Z Tracking not working

Thanks @FranFran - I will try to find some time to check it out. Unfortunately, I'm fighting with consistent jamming on my printer, so right now I'm unable to do a lot of printing. I can try just moving the hot end to see if things track correctly.

1 Like

@FranFran - I was going to take a look at this, but realized I'm not exactly sure how to install. Clone the devel branch and just zip it as is?

@csete You can go to the plugin manager > get more > install from URL and enter: https://github.com/iFrostizz/OctoPrint-EasyServo/archive/devel.zip

Like so:

@FranFran - I installed the development version, but I'm not seeing the new configuration names. Is that expected?

image
Correct, I forgot them..

There you go, I just pushed the update

@FranFran - Without a picture of the geometry, I took a guess on what I was measuring and gave the development version a shot. Unfortunately, when I engage Z Tracking, it fails to process in the hook and stops the hot end from moving. The error is:

2021-11-02 12:42:54,442 - octoprint.settings - WARNING - Could not convert '38.1' to a valid integer when getting option ['plugins', 'EasyServo', 'xOffsetBed']
2021-11-02 12:42:54,444 - octoprint.util.comm - ERROR - Error while processing hook EasyServo for phase sending and command G0 Z10 F200:
Traceback (most recent call last):
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/util/comm.py", line 4611, in _process_command_phase
    tags=tags,
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/util/__init__.py", line 1737, in wrapper
    return f(*args, **kwargs)
  File "/home/pi/oprint/lib/python3.7/site-packages/EasyServo/__init__.py", line 571, in read_gcode
    args=(yAxis, self.calculateAngle(self.currentZ)))
  File "/home/pi/oprint/lib/python3.7/site-packages/EasyServo/__init__.py", line 591, in calculateAngle
    xOffsetBed * yTiltLength + zValue * math.sqrt(
TypeError: unsupported operand type(s) for *: 'NoneType' and 'int'

My log file is attached.

octoprint.log.zip (24.5 KB)

Hi @csete ,
It looks like you entered a float in the settings, please try using an integer instead. I will do the changes in the plugin to allow floats also

I actually didn't mean to include the decimal. I fixed that, but now I'm seeing a different error:

2021-11-02 13:54:21,554 - octoprint.plugins.tracking - INFO - Sent tracking event printer_connected, payload: {'firmware_name': 'Marlin 2.0.7.2 (Dec 20 2020 18:46:17)', 'printer_port': 'AUTO', 'printer_baudrate': 250000}
2021-11-02 13:56:23,788 - octoprint.util.comm - ERROR - Error while processing hook EasyServo for phase sending and command G0 Z10 F200:
Traceback (most recent call last):
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/util/comm.py", line 4611, in _process_command_phase
    tags=tags,
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/util/__init__.py", line 1737, in wrapper
    return f(*args, **kwargs)
  File "/home/pi/oprint/lib/python3.7/site-packages/EasyServo/__init__.py", line 571, in read_gcode
    args=(yAxis, self.calculateAngle(self.currentZ)))
  File "/home/pi/oprint/lib/python3.7/site-packages/EasyServo/__init__.py", line 592, in calculateAngle
    math.pow(xOffsetBed, 2) - math.pow(yTiltLength, 2) + math.pow(zValue, 2)))))
ValueError: math domain error
2021-11-02 13:56:27,624 - octoprint.util.comm - ERROR - Error while processing hook EasyServo for phase sending and command G0 Z10 F200:
Traceback (most recent call last):
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/util/comm.py", line 4611, in _process_command_phase
    tags=tags,
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/util/__init__.py", line 1737, in wrapper
    return f(*args, **kwargs)
  File "/home/pi/oprint/lib/python3.7/site-packages/EasyServo/__init__.py", line 571, in read_gcode
    args=(yAxis, self.calculateAngle(self.currentZ)))
  File "/home/pi/oprint/lib/python3.7/site-packages/EasyServo/__init__.py", line 592, in calculateAngle
    math.pow(xOffsetBed, 2) - math.pow(yTiltLength, 2) + math.pow(zValue, 2)))))
ValueError: math domain error
2021-11-02 13:56:30,335 - octoprint.util.comm - ERROR - Error while processing hook EasyServo for phase sending and command G0 Z10 F200:
Traceback (most recent call last):
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/util/comm.py", line 4611, in _process_command_phase
    tags=tags,
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/util/__init__.py", line 1737, in wrapper
    return f(*args, **kwargs)
  File "/home/pi/oprint/lib/python3.7/site-packages/EasyServo/__init__.py", line 571, in read_gcode
    args=(yAxis, self.calculateAngle(self.currentZ)))
  File "/home/pi/oprint/lib/python3.7/site-packages/EasyServo/__init__.py", line 592, in calculateAngle
    math.pow(xOffsetBed, 2) - math.pow(yTiltLength, 2) + math.pow(zValue, 2)))))
ValueError: math domain error
2021-11-02 13:56:39,884 - octoprint.server.util.sockjs - INFO - Client connection closed: fe80::4e3:1dfc:e3b7:4777

Latest log attached again
Craig

octoprint.log.zip (30.5 KB)

Hey, this value error maybe means that you entered a null / negative number in the settings.
This is what mine looks like, I should disallow negative number I think:

I'm not seeing any negative numbers. However, my values may be "wrong" since I guessed at what I was measuring:

@csete , your values seems a bit high, I've done a 'simulation' of the system in solidworks, and this is what I'm getting:


And I'm measuring a printer head high of ~900mm at least (the vertical, non-labeled value on the right).
These high values are calculating a negative value under a root, which is why Python complains. My explanation was probably terrible :smiley: So I made you a photo of my setup:

And this is a quick explanation (let O be the bed center, S the servo axis, and C the camera "eye"):

Hope that we can solve this issue !

Now, I could also limit the servo movement in case of a very low "X Offset from bed center" value, which is what happened to you to avoid these types of errors.

@FranFran - Thanks for the pictures. Unfortunately, it appears I have a VERY different setup in comparison.

I guess the question is whether this is going to work and, if so, what measurements would I need to take? In terms of the numbers, I was measuring (in inches) from the current location and converting to mm's.

Thanks again,
Craig

@csete , so it appears that you inverted x and y maybe ?
Your measurements:
X offset: 38mm
Y offset over bed: 457mm
Y offset under bed: 482mm

And that would probably rather looks like:
X offset: 457mm
Y offset over bed: 38mm
Y offset under bed: 0mm? (if the servo is at the same height as the bed, I think that a negative number would work if the servo is over the bed too, maybe...)

Thanks !

I tried those values and, while it made it possible to alter Z with tracking engaged, it still was unable to track the hot end.

Just throwing out an idea that may or may not actually work. Rather than do this via measurements and calculations, would it be possible to instead do it via a process of mapping from the extremes of the position?

  • Have the user adjust to the "bottom" position of the camera using the camera controls
  • Push button to capture current servo positions
  • Have the user adjust to the "top" position of the camera using the camera controls
  • Push button to capture current servo positions

Z-tracking would then interpolate between those values as the hot end moves.

Maybe I'm missing something with this idea, but if it works, it would eliminate having to measure to figure out where the camera should be at any moment.

Craig

That's a brilliant idea, I will look into this solution thanks

By the way, did you made sure that the measurements were correct taking in account the photo I sent you ?
If so, we will go with your solution that looks more intuitive

I tried your guess at a translation. Otherwise, I didn't really know how to translate given how different my setup is from yours.

Your setup isn't much different from mine, Sans titre
The only weird thing is that the Y under bed offset would be negative as the servo axis seems over the bed, but it's hard to see just with a photo. The white lines are where you may place your ruler