Difference between revisions of "TAMV"

From Jubilee
Jump to navigation Jump to search
 
(50 intermediate revisions by 2 users not shown)
Line 2: Line 2:
 
{{#ev:youtube|uPa1ecRxpr4||center|a full real-time run of TAMV for 4 tools on a Jubilee}}
 
{{#ev:youtube|uPa1ecRxpr4||center|a full real-time run of TAMV for 4 tools on a Jubilee}}
  
TAMV GUI has finally arrived. Check out it [https://github.com/HaythamB/TAMV/releases/tag/2.0-rc2 here!]
+
TAMV GUI has finally arrived. Check out it [https://github.com/HaythamB/TAMV over on GitHub!]
  
 
In order to achieve the highest possible precision when using multiple tools, '''[https://github.com/DanalEstes Danal Estes]''' graciously created the ''Tool Alignment with Machine Vision (TAMV)'' and ''Z Tool Align with Touch Plate (ZTATP)'' programs that allow us to correctly determine both XY and Z offsets for multiple independent tools on a toolchanger platform. For the Jubilee community, [https://github.com/HaythamB/TAMV an updated version] is maintained with slight enhancements as the current version referenced in this wiki, and you can always access [https://github.com/DanalEstes/TAMV the original release by Danal here].
 
In order to achieve the highest possible precision when using multiple tools, '''[https://github.com/DanalEstes Danal Estes]''' graciously created the ''Tool Alignment with Machine Vision (TAMV)'' and ''Z Tool Align with Touch Plate (ZTATP)'' programs that allow us to correctly determine both XY and Z offsets for multiple independent tools on a toolchanger platform. For the Jubilee community, [https://github.com/HaythamB/TAMV an updated version] is maintained with slight enhancements as the current version referenced in this wiki, and you can always access [https://github.com/DanalEstes/TAMV the original release by Danal here].
Line 26: Line 26:
 
: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.
 
: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.
+
* TAMV itself will always “manhattan move”, that is move in square blocks, and will move X (only!) first, then 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.
 
: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.
Line 34: Line 34:
 
=== Requirements ===
 
=== Requirements ===
  
* Rasberry Pi 3B or 4B, with USB attached camera (no Picam at this time).
+
* Raspberry 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.
 
* 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
 
* A Duet printer, reachable from the Pi by network, running V2 or V3 firmware
Line 45: Line 45:
 
# [https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html PuTTY SSH client for Windows (freeware)]
 
# [https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html PuTTY SSH client for Windows (freeware)]
  
= Installation steps for TAMV =
+
= Installing TAMV =
 +
== Windows installation steps ==
 +
The installation steps and Windows scripts needed to run TAMV can be found on [https://github.com/HaythamB/TAMV-Installers this GitHub repository]
 +
The basic steps to install TAMV under Windows are:
 +
#Install [https://git-scm.com/download/win Git for Windows]
 +
#Install [https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Windows-x86_64.exe Miniforge]
 +
#Open a Miniforge command shell (not your regular Windows command shell)
 +
#Switch to the folder/directory where you want TAMV installed
 +
#Copy the [https://github.com/HaythamB/TAMV-Installers/blob/main/Windows installation scripts] from the Windows folder in the GitHub source into this folder.
 +
#Run the installation script [https://github.com/HaythamB/TAMV-Installers/blob/main/Windows/installTAMV.bat installTAMV.bat] (this will create a folder called "logs" with each step's log files stored to review, if needed)
 +
#Run TAMV using the script [https://github.com/HaythamB/TAMV-Installers/blob/main/Windows/startTAMV.bat startTAMV.bat]
 +
#(OPTIONAL) to delete the TAMV python environment and files, run the [https://github.com/HaythamB/TAMV-Installers/blob/main/Windows/deleteTAMV.bat deleteTAMV.bat] script file
  
# [[TAMV#Enable_boot_to_desktop_and_VNC_for_your_Raspberry_Pi|Enable boot to desktop and VNC for your Raspberry Pi]]
+
== Docker-based installation steps ==
# [[TAMV#Connect_to_the_Raspberry_Pi_using_VNC_Viewer_on_Windows|Connect to the Raspberry Pi using VNC Viewer on Windows]]
+
You can now run TAMV from a docker image directly, and skip the complex and time-consuming process of installing openCV on your hardware. This is available for Raspbian, MacOS, and Linux hardware. Unfortunately, Windows does not support USB device pass-through to docker, which is needed to talk to the camera for TAMV's operation.
# [[TAMV#Install_the_OpenCV_libraries_and_dependencies|Install the OpenCV libraries and dependencies]]
 
# [[TAMV#Install_the_TAMV_script|Install the TAMV script]]
 
# [[TAMV#(pending)_Webcam_mounting_and_TAMV_preparation|(pending) Webcam mounting and TAMV preparation]]
 
# [[TAMV#(pending)_Running_TAMV_calibration_for_the_first_time|(pending) Running TAMV calibration for the first time]]
 
# [[TAMV#(pending)_Post_calibration_checklist|(pending) Post calibration checklist]]
 
# [[TAMV#Updating_To_Latest|Updating To Latest]]
 
  
== What you’ll need before you start ==
+
=== Docker on Windows ===
 +
This environment combination is unfortunately not supported at this point in time, since Docker under Windows does not allow for USB pass-through of the USB camera required to run TAMV.
  
# 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 [https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html PuTTY]
 
# A VNC client of your choosing, such as [https://www.realvnc.com/en/connect/download/viewer/ VNC Viewer]
 
  
== Enable boot to desktop and VNC for your Raspberry Pi ==
+
You may alternatively run TAMV natively under windows, see installation steps above.
 +
 
 +
=== Docker on Linux (DOCS IN PROGRESS)===
 +
 
 +
<big>THIS SECTION IS CURRENTLY UNDER REVIEW. USE AT YOUR OWN RISK.
 +
</big>
 +
# Connect using a VNC session to your machine - you MUST use a graphical interface for running TAMV.
 +
# Save the following script as your install file (installTAMV.sh) in your user's directory
 +
<pre>
 +
#!/bin/bash
 +
sudo apt update
 +
sudo apt install apt-transport-https curl gnupg-agent ca-certificates software-properties-common -y
 +
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
 +
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
 +
sudo apt install docker-ce docker-ce-cli containerd.io -y
 +
sudo usermod -aG docker $USER
 +
newgrp docker
 +
cd
 +
git clone https://github.com/HaythamB/TAMV
 +
docker pull haythamb/tamv
 +
</pre>
 +
 
 +
# Open a terminal window, and make sure you're in your home folder by typing <code>cd</code> then ENTER.
 +
# Run the command <code>chmod a+x ./installTAMV.sh</code> to change the install script into an executable file.
 +
# Type <pre>./installTAMV.sh</pre> and press ENTER. This should install docker and pull the TAMV image from DockerHub
 +
 
 +
== Legacy (old) Installation steps for TAMV ==
 +
In case you're looking for the older installation instructions for TAMV on a Raspberry Pi, please [https://jubilee3d.com/index.php?title=Legacy_TAMV head to this page to view them].
 +
 
 +
= Troubleshooting a TAMV installation =
 +
== Failed to connect to printer ==
 
<ol start="1" style="list-style-type: decimal;">
 
<ol start="1" style="list-style-type: decimal;">
<li>Login via ''SSH'' to your Raspberry Pi and and run the Raspberry Pi config tool using the command: <code>sudo raspi-config</code> {{sized-external-image-with-link|600px|https://raw.githubusercontent.com/HaythamB/TAMV-installation-guide/master/00-pi-setup/01.PNG}}</li><br>
+
<li>Make sure you're using an IP address (preferred connection method) or a valid local network name.
<li>Select “3 Boot Options” {{sized-external-image-with-link|600px|https://raw.githubusercontent.com/HaythamB/TAMV-installation-guide/master/00-pi-setup/02.PNG}}</li><br>
+
<li>Make sure your machine's axes have all been homed. TAMV will disconnect from the machine if this isn't valid.
<li>Select “Desktop / CLI” {{sized-external-image-with-link|600px|https://raw.githubusercontent.com/HaythamB/TAMV-installation-guide/master/00-pi-setup/03.PNG}}</li><br>
+
<li>In TAMV/config/settings.json, make sure the printer key entry contains a "default":1 key pair. If not, then please add it using standard JSON notation.
<li>Select “Desktop” {{sized-external-image-with-link|600px|https://raw.githubusercontent.com/HaythamB/TAMV-installation-guide/master/00-pi-setup/04.PNG}}</li><br>
+
<li>In TAMV/config/settings.json, make sure the printer key entry contains a "nickname": "printer nickname" key pair. If not, then please add it using standard JSON notation.
<li>Now from the main menu, select “5 Interfacing Options” {{sized-external-image-with-link|600px|https://raw.githubusercontent.com/HaythamB/TAMV-installation-guide/master/00-pi-setup/05.PNG}}</li><br>
 
<li>Select “VNC” {{sized-external-image-with-link|600px|https://raw.githubusercontent.com/HaythamB/TAMV-installation-guide/master/00-pi-setup/06.PNG}}</li><br>
 
<li>Confirm that you would like to ''enable'' VNC server by selecting “Yes” {{sized-external-image-with-link|600px|https://raw.githubusercontent.com/HaythamB/TAMV-installation-guide/master/00-pi-setup/07.PNG}}</li><br>
 
<li>You’ll get a confirmation that the VNC server has been enabled {{sized-external-image-with-link|600px|https://raw.githubusercontent.com/HaythamB/TAMV-installation-guide/master/00-pi-setup/08.PNG}}</li><br>
 
<li>Select the “7 Advanced Options” from the main menu</li>
 
<li>Select “Resolution”</li>
 
<li>Select “DMT Mode 16 1024x768” or any other resolution you’d like</li>
 
<li>Once you’re done, reboot the Raspberry Pi!</li>
 
 
</ol>
 
</ol>
  
== Connect to the Raspberry Pi using VNC Viewer on Windows ==
+
== Failed to detect nozzle ==
 
<ol start="1" style="list-style-type: decimal;">
 
<ol start="1" style="list-style-type: decimal;">
<li>Launch VNC Viewer on your computer, and select “File” -&gt; “New connection…”<br>{{sized-external-image-with-link|600px|https://raw.githubusercontent.com/HaythamB/TAMV-installation-guide/master/01-VNC-setup/01.PNG}}</li><br>
+
<li>If you are having issues getting the program to find the nozzle, you may need to adjust the lighting or focus of the camera.
<li>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 <br>{{sized-external-image-with-link|400px|https://raw.githubusercontent.com/HaythamB/TAMV-installation-guide/master/01-VNC-setup/02.PNG}}</li><br>
+
<li>Additionally, you need to make sure that the nozzle is clear of any filament. You can heat up the extruder before you start the TAMV script and do a slight retraction (~E-5) or brush material away if needed too.
<li>Right-click on the new connection you’ve just created and select “Connect” <br>{{sized-external-image-with-link|600px|https://raw.githubusercontent.com/HaythamB/TAMV-installation-guide/master/01-VNC-setup/03.PNG}}</li><br>
+
<li>If you're using nozzles with an opening of 0.6mm or larger, TAMV may have difficulty detecting them. There's a feature coming soon that will you to tell TAMV which tools have large nozzles and will adjust detection automatically as needed.
<li>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” <br>{{sized-external-image-with-link|600px|https://raw.githubusercontent.com/HaythamB/TAMV-installation-guide/master/01-VNC-setup/04.PNG}}</li><br>
+
<li>If TAMV consistently fails to detect your tools, try starting your calibration runs with the microscope slightly further away from the tool, which will blur the nozzle slightly. This sometimes helps in detection.
<li>Welcome to the Raspbian desktop! Your background and interface may vary depending on the version of Raspbian you have running on the Pi <br>{{sized-external-image-with-link|600px|https://raw.githubusercontent.com/HaythamB/TAMV-installation-guide/master/01-VNC-setup/05.PNG}}</li>
 
 
</ol>
 
</ol>
  
== Install the OpenCV libraries and dependencies ==
+
== USB microscope common problems ==
 
<ol start="1" style="list-style-type: decimal;">
 
<ol start="1" style="list-style-type: decimal;">
<li>Launch a new “Terminal” process to access the CLI (Command Line Interface) of your Pi
+
<li>If you're facing intermittent disconnects of the microscope while running TAMV, try running the microscope by connecting it through a powered USB hub. The current draw for the LED ring on the microscope sometimes overwhelms Raspberry Pi USB bus drivers, and causes it to error out. In this scenario, you cannot access the USB microscope again until you reboot the Pi.
<br>{{sized-external-image-with-link|600px|https://raw.githubusercontent.com/HaythamB/TAMV-installation-guide/master/02-opencv-install/01.PNG}}
+
<li>In your settings.json file, located in the TAMV/config folder, see if the value for the key "video_src" is set to 0 or 1. Default for first connected USB camera should be 0 under Windows and Linux.
<br>''*****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''</li>
+
<li>Also in settings.json, make sure the camera key entry contains a "default":1 key pair. If not, then please add it using standard JSON notation.
<br>
+
</ol>
<li>Run the following command from the prompt, which will clone the GitHub repo to the current folder you’re in: <code>git clone https://github.com/DanalEstes/installOpenCV.git</code></li>
 
<br>{{sized-external-image-with-link|600px|https://raw.githubusercontent.com/HaythamB/TAMV-installation-guide/master/02-opencv-install/02.PNG}}<br>
 
<li>Once the clone is done, you’ll need to switch to the new folder using: <code>cd installOpenCV</code> and then run the installation script using: <code>./installOpenCV.sh</code>
 
<br>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.</li>
 
<br>{{sized-external-image-with-link|600px|https://raw.githubusercontent.com/HaythamB/TAMV-installation-guide/master/02-opencv-install/04.PNG}}
 
<br>
 
<li><p>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!</p></li>
 
<li><p>Once the process has been completed, do a little victory dance if you’d like.</p></li></ol>
 
 
 
== Install the TAMV script ==
 
This step will install all the files necessary for the TAMV script to launch, including the DuetWebAPI library from the same repository on GitHub.
 
 
 
# 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 <code>cd</code>
 
# Run the following command to clone the repo to a local folder: <code>git clone https://github.com/HaythamB/TAMV.git</code> {{sized-external-image-with-link|600px|https://raw.githubusercontent.com/HaythamB/TAMV-installation-guide/master/04-TAMV/01.PNG}}
 
 
 
== ''(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).<br>
 
##<code>cd</code>
 
##<code>cd TAMV</code>
 
##<code>./TAMV_GUI.py</code>
 
 
 
<ol start="2" style="list-style-type: decimal;">
 
<li>It will mount Tool0 and ask you to jog the tool over the camera.</li>
 
<li>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.</li>
 
<li>Click back to the text window and press Ctrl+C one time.</li></ol>
 
 
 
For RRF2 and RRF3, everything after that will be automatic. The final output is G10 statements, one per tool, and those statements would have already been applied to your printer. You will still need to add these offsets to your config.g to make them persistently available. The first time you run the python file, you may need to install PyQt5 and matplotlib libraries.
 
 
 
If you need to install these libraries, you can use Raspbian's package manager to do so.<br>
 
#<code>sudo apt-get install python3-pyqt5</code>
 
#<code>sudo apt-get install python3-matplotlib</code>
 
 
 
== ''Troubleshooting'' ==
 
If you are having issues getting the program to find the nozzle, you may need to adjust the lighting or focus of the camera. Additionally, you need to make sure that the nozzle is clear of any filament. You can heat up the extruder before you start the TAMV script and do a slight retraction (~E-5) or brush material away if needed too.
 
 
 
== ''(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|ZTATP script]].
 
 
 
Future runs of TAMV: Supply that X Y you noted above <code>./TAMV_GUI.py xxx yyy</code> and TAMV will not prompt you at all.
 
 
 
== ''Updating To Latest'' ==
 
 
 
First Remove old files
 
 
 
<code>cd TAMV/</code>
 
 
 
<code>rm TAMV*</code>
 
 
 
<code>rm ZTATP*</code>
 
 
 
<code>rm DuetWeb*</code>
 
 
 
Then re-downloaded the updates
 
 
 
<code>wget -N https://raw.githubusercontent.com/HaythamB/TAMV/master/TAMV_GUI.py</code>
 
 
 
<code>wget -N https://raw.githubusercontent.com/HaythamB/TAMV/master/ZTATP.py</code>
 
 
 
<code>wget -N https://raw.githubusercontent.com/HaythamB/TAMV/master/DuetWebAPI.py</code>
 
  
Build the exe
+
== Python exceptions while running TAMV ==
 +
=== Segmentation faults ===
 +
Generally these are caused by the Python multiprocessing libraries, and are extremely difficult to troubleshoot. This is a known issue on macOS (especially M1 chips), and are difficult to troubleshoot.
  
<code>chmod 744 TAMV_GUI.py</code>
+
You are strongly recommended to try another install environment to run TAMV, such as an Ubuntu or Windows desktop environment.
  
For features rundown
+
=== CRITITCAL: Camera failed to retrieve data ===
 +
=== CRITICAL : 'tuple' object does not support item assignment ===
 +
Generally speaking, all of these critical errors are caused by using an incompatible version of OpenCV under Python.
  
<code>./TAMV_GUI.py -h</code>
+
Make sure you have Python 3.8.6+ installed, along with OpenCV 4.2.0 (not any newer version, these are causing crashes).

Latest revision as of 03:57, 2 March 2024

Overview

a full real-time run of TAMV for 4 tools on a Jubilee

TAMV GUI has finally arrived. Check out it over on GitHub!

In order to achieve the highest possible precision when using multiple tools, Danal Estes graciously created the Tool Alignment with Machine Vision (TAMV) and Z Tool Align with Touch Plate (ZTATP) programs that allow us to correctly determine both XY and Z offsets for multiple independent tools on a toolchanger platform. For the Jubilee community, an updated version is maintained with slight enhancements as the current version referenced in this wiki, and you can always access the original release by Danal here.

  • TAMV = Tool Alignment with Machine Vision
TAMV is a fully automated process that uses a camera to calculate XY tool offsets set with G10 L1 tool offsets that go in config.g to correctly set the XY alignment for correct tool-to-tool behavior when printing.
  • ZTATP = Z Tool Align with Touch Plate
ZTATP is a partially automated process that uses a touch plate to calculate Z tool offsets also set with G10 L1 tool offsets that go in 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!
For information on ZTATP, check out the Jubilee ZTATP Wiki Page.

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, then 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.

Requirements

  • Raspberry 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

  1. Set up headless Raspberry Pi VNC
  2. VNC Viewer for Windows (freeware)
  3. PuTTY SSH client for Windows (freeware)

Installing TAMV

Windows installation steps

The installation steps and Windows scripts needed to run TAMV can be found on this GitHub repository The basic steps to install TAMV under Windows are:

  1. Install Git for Windows
  2. Install Miniforge
  3. Open a Miniforge command shell (not your regular Windows command shell)
  4. Switch to the folder/directory where you want TAMV installed
  5. Copy the installation scripts from the Windows folder in the GitHub source into this folder.
  6. Run the installation script installTAMV.bat (this will create a folder called "logs" with each step's log files stored to review, if needed)
  7. Run TAMV using the script startTAMV.bat
  8. (OPTIONAL) to delete the TAMV python environment and files, run the deleteTAMV.bat script file

Docker-based installation steps

You can now run TAMV from a docker image directly, and skip the complex and time-consuming process of installing openCV on your hardware. This is available for Raspbian, MacOS, and Linux hardware. Unfortunately, Windows does not support USB device pass-through to docker, which is needed to talk to the camera for TAMV's operation.

Docker on Windows

This environment combination is unfortunately not supported at this point in time, since Docker under Windows does not allow for USB pass-through of the USB camera required to run TAMV.


You may alternatively run TAMV natively under windows, see installation steps above.

Docker on Linux (DOCS IN PROGRESS)

THIS SECTION IS CURRENTLY UNDER REVIEW. USE AT YOUR OWN RISK.

  1. Connect using a VNC session to your machine - you MUST use a graphical interface for running TAMV.
  2. Save the following script as your install file (installTAMV.sh) in your user's directory
#!/bin/bash
sudo apt update
sudo apt install apt-transport-https curl gnupg-agent ca-certificates software-properties-common -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
sudo apt install docker-ce docker-ce-cli containerd.io -y
sudo usermod -aG docker $USER
newgrp docker
cd
git clone https://github.com/HaythamB/TAMV
docker pull haythamb/tamv
  1. Open a terminal window, and make sure you're in your home folder by typing cd then ENTER.
  2. Run the command chmod a+x ./installTAMV.sh to change the install script into an executable file.
  3. Type
    ./installTAMV.sh
    and press ENTER. This should install docker and pull the TAMV image from DockerHub

Legacy (old) Installation steps for TAMV

In case you're looking for the older installation instructions for TAMV on a Raspberry Pi, please head to this page to view them.

Troubleshooting a TAMV installation

Failed to connect to printer

  1. Make sure you're using an IP address (preferred connection method) or a valid local network name.
  2. Make sure your machine's axes have all been homed. TAMV will disconnect from the machine if this isn't valid.
  3. In TAMV/config/settings.json, make sure the printer key entry contains a "default":1 key pair. If not, then please add it using standard JSON notation.
  4. In TAMV/config/settings.json, make sure the printer key entry contains a "nickname": "printer nickname" key pair. If not, then please add it using standard JSON notation.

Failed to detect nozzle

  1. If you are having issues getting the program to find the nozzle, you may need to adjust the lighting or focus of the camera.
  2. Additionally, you need to make sure that the nozzle is clear of any filament. You can heat up the extruder before you start the TAMV script and do a slight retraction (~E-5) or brush material away if needed too.
  3. If you're using nozzles with an opening of 0.6mm or larger, TAMV may have difficulty detecting them. There's a feature coming soon that will you to tell TAMV which tools have large nozzles and will adjust detection automatically as needed.
  4. If TAMV consistently fails to detect your tools, try starting your calibration runs with the microscope slightly further away from the tool, which will blur the nozzle slightly. This sometimes helps in detection.

USB microscope common problems

  1. If you're facing intermittent disconnects of the microscope while running TAMV, try running the microscope by connecting it through a powered USB hub. The current draw for the LED ring on the microscope sometimes overwhelms Raspberry Pi USB bus drivers, and causes it to error out. In this scenario, you cannot access the USB microscope again until you reboot the Pi.
  2. In your settings.json file, located in the TAMV/config folder, see if the value for the key "video_src" is set to 0 or 1. Default for first connected USB camera should be 0 under Windows and Linux.
  3. Also in settings.json, make sure the camera key entry contains a "default":1 key pair. If not, then please add it using standard JSON notation.

Python exceptions while running TAMV

Segmentation faults

Generally these are caused by the Python multiprocessing libraries, and are extremely difficult to troubleshoot. This is a known issue on macOS (especially M1 chips), and are difficult to troubleshoot.

You are strongly recommended to try another install environment to run TAMV, such as an Ubuntu or Windows desktop environment.

CRITITCAL: Camera failed to retrieve data

CRITICAL : 'tuple' object does not support item assignment

Generally speaking, all of these critical errors are caused by using an incompatible version of OpenCV under Python.

Make sure you have Python 3.8.6+ installed, along with OpenCV 4.2.0 (not any newer version, these are causing crashes).