- TAMV = Tool Alignment with Machine Vision.
Fully automated process that uses a camera to calculate ‘G10 Xnnn Ynnn’ commands that go in your config.g to correctly set the X Y alignment for correct tool-to-tool behavior when printing.
- ZTATP = Z Tool Align with Touch Plate.
Fully automated process that uses a touch plate to calculate ‘G10 Znnn’ commands that go in your config.g to correctly set the Z alignment for tool-to-tool correct behavior when printing. It also sets the bed-to-tool-zero spacing!
ZTATP Wiki Page here
Special note to AVOID MACHINE DAMAGE
TAMV will move your tools around in ways that may be different than day-to-day printing.
In particular, if your camera is anywhere beyond the Y coordinate of the parking stalls for other tools, collisions could occur. To ensure this does not happen, two things must be true:
- TAMV expects a tool change, as initiated by a T0 or T1 or so forth, will not cause a collision, no matter where the tool is when the tool change initiates.
It is entirely possible that your tool change macros do not ensure this today, particularly when a ‘current tool’ is beyond the Y line of the parking stalls at the moment a tool change is initiated.
- TAMV itself will always “manhattan move”, that is move in square blocks, and will move X (only!) first, they Y (only!) as required to get FROM wherever the tool is after a Tx, TO the camera.
If (big IF) your tool change macros end with the tool at a ‘safe Y’, then ‘Manhattan moves’ will always prevent collisions. In fact, this form of move is best practice within your tool change macros.
Please read this section for more information.
- Rasberry Pi 3B or 4B, with USB attached camera (no Picam at this time).
- Almost any webcam with auto-exposure and the ability to focus within a few centimeters of the lens will work. Logitech C270 is one that is known to have a threaded lens and a case that can be removed and replaced with a printed case.
- A Duet printer, reachable from the Pi by network, running V2 or V3 firmware
- May run on Duet3+Pi; does NOT require that configuration, run on any Pi.
Useful Links for TAMV
- Set up headless Raspberry Pi VNC
- VNC Viewer for Windows (freeware)
- PuTTY SSH client for Windows (freeware)
Installation steps for TAMV
- Enable boot to desktop and VNC for your Raspberry Pi
- Connect to the Raspberry Pi using VNC Viewer on Windows
- Install the OpenCV libraries and dependencies
- Install the TAMV script
- Install the DuetWebAPI library
- (pending) Modify Python path variables to access DuetWebAPI from TAMV
- (pending) Webcam mounting and TAMV preparation
- (pending) Running TAMV calibration for the first time
- (pending) Post calibration checklist
What you’ll need before you start
- A Raspberry Pi with a working installation of Raspbian, with an internet connection from the Pi
- Your SUDO user of choice (default is usually the “pi” user) and SUDO password (default is “raspberry”) with SSH login
- An SSH client of your choosing, such as Windows 10 built in ‘winterm’ and ‘ssh’ or install PuTTY
- A VNC client of your choosing, such as VNC Viewer
Enable boot to desktop and VNC for your Raspberry Pi
- Login via SSH to your Raspberry Pi and and run the Raspberry Pi config tool using the command:
sudo raspi-configRunning raspi-config
- Select “3 Boot Options” Boot Options
- Select “Desktop / CLI” Desktop/CLI
- Select “Desktop” Selecting desktop mode
- Now from the main menu, select “5 Interfacing Options” Interfacing options
- Select “VNC” VNC
- Confirm that you would like to enable VNC server by selecting “Yes” Confirm VNC
- You’ll get a confirmation that the VNC server has been enabled VNC enabled confirmation
- Select the “7 Advanced Options” from the main menu
- Select “Resolution”
- Select “DMT Mode 16 1024x768” or any other resolution you’d like
- Once you’re done, reboot the Raspberry Pi!
Connect to the Raspberry Pi using VNC Viewer on Windows
- Launch VNC Viewer on your computer, and select “File” -> “New connection…” New connection
- Enter the IP address or network name of your Raspberry Pi in the “VNC Server” field, and give this connection a name to identify it in the VNC viewer connection list Server details
- Right-click on the new connection you’ve just created and select “Connect” Connect
- You’ll be connected to your Raspberry Pi and prompted for a username and password. Use your SUDO login credentials (most commonly the Pi user) and click “Log In” Login to Pi
- Welcome to the Raspbian desktop! Your background and interface may vary depending on the version of Raspbian you have running on the Pi Raspbian desktop
Install the OpenCV libraries and dependencies
- Launch a new “Terminal” process to access the CLI (Command Line Interface) of your Pi Terminal window *****NOTE: The terminal will launch into your “home” directory, which is “/home/username” under Linux. The following screenshots were for a user called “tamv”, but generally you’ll be seeing the “pi” user
- Run the following command from the prompt, which will clone the GitHub repo from Danal to the current folder you’re in:
git clone https://github.com/DanalEstes/installOpenCV.gitgit clone scripts
- Once the clone is done, you’ll need to switch to the new folder using:
cd installOpenCVand then run the installation script using:
You’ll get a welcoming message from Danal, and the script will prompt you for a sudo password to start installing any updates, dependencies, and upgrades needed to get OpenCV on your machine. Be warned that this process should take anywhere from 45 minutes to three hours to complete, and make sure your Pi doesn’t run out of power during this period, especially if you’re running it off a battery source. Run installation script
Go grab a coffee/tea/beer/nap until the process is done. It should complete without any RED errors (there will be YELLOW warnings, these are OK) since Danal did a great job of setting this up for everyone!
Once the process has been completed, do a little victory dance if you’d like.
Install the TAMV script
- Launch a terminal window into your home directory (if you don’t already have one open from the last step). Make sure you’re actually in the home location and your prompt looks similar to this: “pi@duet3:~ $”. If not, enter
- Run the following command to clone the repo to a local folder:
Install the DuetWebAPI library
- Launch a terminal window into the directory where TAMV is installed. Assuming you are still in your home directory from the prior step, use
- Run the following command to clone the repo to the local folder:
(pending) Webcam mounting and TAMV preparation
Preliminary steps 1. Mount webcam somewhere fixed on the bed using gluestick/double sided tape OR on the frame in a spot where the nozzle of the tool can be positioned over the lens. 2. Shorten webcam focal distance to about an inch away from the lens (webcams are generally set up for longer focus distances so this would probably necessitate opening up the camera shell and manually turning a focus ring) 3. Heat nozzles and clean up all nozzles from gunk and filament blobs to enable correct nozzle circle detection in TAMV. 4. Make sure they cool. You don’t want to ‘drool’ on the camera! 5. Set tool active and standby temperatures to 0 before running TAMV. Again to avoid drooling.
(pending) Running TAMV calibration for the first time
- Run TAMV with no arguments. This MUST be on a VNC session, not ssh (because you have to see the graphic image).
- It will mount Tool0 and ask you to jog the tool over the camera.
- Jog the tool to the camera, and adjust centering (rough), focus, etc, etc, so that there is a good view of the tool. 3.5 Make a note of the X Y where the tool is over the camera, to make future runs faster.
- Click back to the text window and press Ctrl+C one time.
Everything after that will be automatic. The final output is G10 statements, one per tool.
(pending) Post calibration checklist
- Remove webcam from build plate
- Place the G10 commands in config.g
- If you have already manually aligned Z, time to print!
If not, take a look at the ZTATP script. (Wiki page coming soon)
Future runs of TAMV: Supply that X Y you noted above
./TAMV.py xxx yyy and TAMV will not prompt you at all.
Updating To Latest
First Remove old files
Then re-downloaded the updates
Build the exe
chmod 744 TAMV.py
For features rundown