User Tools

Site Tools


quickstart:mycnc-quick-start:cnc-vision-setup

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
quickstart:mycnc-quick-start:cnc-vision-setup [2020/01/16 14:07] ivanquickstart:mycnc-quick-start:cnc-vision-setup [2024/02/26 14:50] (current) ivan
Line 1: Line 1:
-=====CNC Vision Setup=====+=====CNC Vision (Optical Registration Mark Reading) Setup=====
  
-This manual is designed to introduce the reader to the setup process of the CNC vision system, and some of its applications. +This manual is designed to introduce the reader to the setup process of the CNC Vision system, and some of its applications which include the creation of a Digitally Aligned Cutting System.
  
-//Please note that the Vision System license for correcting the generated G-code using visual markers is a separate license that must be purchased in addition to the myCNC controller in order to be enabled (available as part of the [[https://shop.pv-automation.com/mycnc/55-1787-cnc-vision-components.html|CNC Vision Kit package]] in our [[https://shop.pv-automation.com/mycnc/55-1787-cnc-vision-components.html|Online Shop]]).// +The CNC Vision System is often used in the X1366V Tangential Cutting profile. The description of the X1366V GUI is available here: [[mycnc:mycnc_setup_examples:tangential_knife|Basic profile for Tangential Knife.]]  
 + 
 +//Please note that the Vision System license for correcting the generated G-code using registration mark reading is a separate license that must be purchased in addition to the myCNC controller in order for the DACS (Digitally Aligned Cutting System)  to be enabled (available as part of the [[https://shop.pv-automation.com/mycnc/55-1787-cnc-vision-components.html|CNC Vision Kit package]] in our [[https://shop.pv-automation.com/mycnc/55-1787-cnc-vision-components.html|Online Shop]]).//  
 + 
 +//NOTE: The CNC Vision functionality is currently supported on **Linux systems ONLY**.// 
  
 A video with the recap of the manual below is available here: A video with the recap of the manual below is available here:
Line 17: Line 21:
   * **IP Camera Initialization line** lists the camera IP for the connection to be established.    * **IP Camera Initialization line** lists the camera IP for the connection to be established. 
  
-  * **Pattern size** can be set experimentally to be about 30-50% larger than the marker itself, in order to account for the visual transition between the marker and its surroundings.  +  * **Pattern size** can be set experimentally to be about 30-50% larger than the registration mark itself, in order to account for the visual transition between the registration marker and its surroundings.  
-    * In the case of the particular marker used in this scenario, its size has been set to 160 pixels, which is on the low end of the relative pattern size - a larger pattern size is typically a safer choice in low-light conditions. +    * In the case of the particular registration marker used in this scenario, its size has been set to 160 pixels, which is on the low end of the relative pattern size - a larger pattern size is typically a safer choice in low-light conditions. 
     * NOTE: The camera focus must be properly adjusted in order for the camera to recognize markers.      * NOTE: The camera focus must be properly adjusted in order for the camera to recognize markers. 
  
 {{:quickstart:mycnc-quick-start:cnc-vision-003-marker-size.jpg}} {{:quickstart:mycnc-quick-start:cnc-vision-003-marker-size.jpg}}
  
-  * **Region of interest** (in pixels) signifies the area in which the camera is actively looking for markers, and should usually be set to be equal or slightly smaller than the actual resolution of the camera. It is set automatically in the newer software versions during the calibration process (software versions after July 2019). +  * **Region of interest** (in pixels) signifies the area in which the camera is actively looking for registration marks, and should usually be set to be equal or slightly smaller than the actual resolution of the camera. It is set automatically in the newer software versions during the calibration process (software versions after July 2019). 
  
   * **Pixel to length coefficient** is used to convert the pixels travelled into the actual physical distance moved, in mm. You are able to calibrate this for both the x- and the y-axes. In order to set up the correct coefficient for your camera, use the Calibrate button in the Camera tab, or consult the full set of manual set up instructions below (useful for older software versions).   * **Pixel to length coefficient** is used to convert the pixels travelled into the actual physical distance moved, in mm. You are able to calibrate this for both the x- and the y-axes. In order to set up the correct coefficient for your camera, use the Calibrate button in the Camera tab, or consult the full set of manual set up instructions below (useful for older software versions).
  
-  * **Camera Shift** describes the distance the machine will move by if it does not locate a marker after it has been instructed to look for one. This can happen when the marker is not fully within the region of interest. In that case, the camera will keep on moving around until it either finds the marker or reaches the end of this specified Camera Shift. It is set automatically in the newer software versions during the calibration process. If no marker is found during the Camera Shift process, the machine will be stopped. +  * **Camera Shift** describes the distance the machine will move by if it does not locate a registration marker after it has been instructed to look for one. This can happen when the marker is not fully within the region of interest. In that case, the camera will keep on moving around until it either finds the marker or reaches the end of this specified Camera Shift. It is set automatically in the newer software versions during the calibration process. If no registration marker is found during the Camera Shift process, the machine will be stopped. 
  
   * **Tool number** is typically assigned to be 10.    * **Tool number** is typically assigned to be 10. 
Line 37: Line 41:
   * **Ignore decoder errors** flag is set to OFF by default.   * **Ignore decoder errors** flag is set to OFF by default.
  
-  * **Shift Speed** describes the speed with which the machine is moving during its camera shift phase while trying to find the marker. NOTE: Deprecated on the newer versions of myCNC software. +  * **Shift Speed** describes the speed with which the machine is moving during its camera shift phase while trying to find the registration marker for the DACS. NOTE: Deprecated on the newer versions of myCNC software. 
  
-  * **Pattern Match Level** describes the level of parity with the original reference marker that each new marker must have for the system to recognize it. Higher numbers mean less parity (more differences between the markers), so as to avoid false positives it is advised to keep the numbers on the lower end of the scale. The graph below the Pattern Match Level indicates the parity levels during the machine search for markers, with the low points of the graph being indicative of the places where marker parity is highest (differences between new marker and reference are lowest). +  * **Pattern Match Level** describes the level of parity with the original reference registration marker that each new marker must have for the system to recognize it. Higher numbers mean less parity (more differences between the markers), so as to avoid false positives it is advised to keep the numbers on the lower end of the scale. The graph below the Pattern Match Level indicates the parity levels during the machine search for markers, with the low points of the graph being indicative of the places where marker parity is highest (differences between new marker and reference are lowest). 
     * If the program has issues locating markers due to those markers being slightly different (due to material imperfections, light reflections, etc), it is recommended to raise the Pattern Match Level until the program accepts the variations. However, raising this value too high will lead to false positives on marker recognition.     * If the program has issues locating markers due to those markers being slightly different (due to material imperfections, light reflections, etc), it is recommended to raise the Pattern Match Level until the program accepts the variations. However, raising this value too high will lead to false positives on marker recognition.
 +{{:quickstart:mycnc-quick-start:cnc-vision-030-parity-chart.png}}
  
-  * **Image sensor correction** corrects for sensors with different aspect ratios. Use this if the marker image appears distorted or stretched when viewed through the Camera tab in myCNC software. +  * **Image sensor correction** corrects for sensors with different aspect ratios. Use this if the registration mark image appears distorted or stretched when viewed through the Camera tab in myCNC software. 
  
 ====CNC Vision codes==== ====CNC Vision codes====
Line 48: Line 53:
 The Vision system is controlled through a series of M-code PLCs which can be found in Settings > Config > PLC > Hardware PLC. The Vision system is controlled through a series of M-code PLCs which can be found in Settings > Config > PLC > Hardware PLC.
  
-{{:quickstart:mycnc-quick-start:cnc-vision-012-macros.png}}+{{:quickstart:mycnc-quick-start:cnc-vision-033-plc-procedures.png}}
  
 The following PLC procedures are used: The following PLC procedures are used:
  
 +  * M395 - camera calibration. ++ Show M395 code |
 +<code>#define callback_address    var01
 +#define camera_count      var02
 +#define wait_camera           var03
 +
 +
 +main()
 +{
 +  camera_count=100;
 +  wait_camera=100;
 +  callback_address=3;
 +
 +  //delay after motion stopped
 +  timer=300; do{timer--;}while (timer>0);
 +
 +  message=PLCCMD_WAIT_FOR_CAMERA;
 +  timer=2;do{timer--;}while(timer>0); //pause to push the message
 +
 +  do
 +  {
 +
 +    if (wait_camera>1)
 +    {
 +     timer=100; do{timer--;} while(timer>0);//wait till motion started
 +     do { code=gvarget(6060); }while(code!=0x4d);//wait till motion finished
 +     timer=300;do{timer--;}while(timer>0); //pause to push the message
 +
 +     camera_count=wait_camera;
 +     message=PLCCMD_WAIT_FOR_CAMERA;
 +     timer=2;do{timer--;}while(timer>0); //pause to push the message
 +
 +     wait_camera=1;
 +    };
 +
 +  }while (wait_camera>0);
 +
 +  exit(99); //normal exit 
 +};
 +</code>
 +++
   * M397 - start camera operations. ++ Show M397 code |   * M397 - start camera operations. ++ Show M397 code |
 <code> <code>
Line 121: Line 166:
 ++ ++
 These PLCs are added automatically into the G-code when importing a DXF file into myCNC. In order for the system to recognize the markers, the markers need to be drawn as roughly 6mm circles inside a separate layer named ''Camera'' within the DXF file. The user must have a valid Vision System license to use this function.  These PLCs are added automatically into the G-code when importing a DXF file into myCNC. In order for the system to recognize the markers, the markers need to be drawn as roughly 6mm circles inside a separate layer named ''Camera'' within the DXF file. The user must have a valid Vision System license to use this function. 
 +
 +Additionally, as all the camera operations are done through a simple combination of commands listed above, the user may choose to forego DXF import altogether. Instead, the movement to the coordinates of the marker (via G0) and the M399 command to search for markers, as well as М397 and М398 serving as header and footer for the necessary block of code, can be added directly via a CAM or a post processor at appropriate positions. This allows the user to utilize their preferred CAM software, which may often have additional functionality as compared to the standard DXF import bundled with myCNC. 
  
 ====Calibrating the CNC Vision System==== ====Calibrating the CNC Vision System====
Line 136: Line 183:
  
 {{:quickstart:mycnc-quick-start:camera-july2-006.png}} {{:quickstart:mycnc-quick-start:camera-july2-006.png}}
 +
 +:!: **NOTE:** A possible result for the calibration is to have a zero (0) coefficient as a result of the procedure, instead of a realistic value. This can be the result of the camera being oriented incorrectly (for instance, setting the camera up with the X and Y movement axes switching place, or having it rotated 180 degrees, etc). If the coefficient is zero, first check that the camera is oriented correctly and re-run the calibration procedure. 
  
 ====Setting up the pixel to length coefficients ==== ====Setting up the pixel to length coefficients ====
Line 141: Line 190:
 //Obsolete method only used on program versions older than July 2019. In all recent versions the pixel to length coefficients is calculated automatically by the program during the calibration process.// //Obsolete method only used on program versions older than July 2019. In all recent versions the pixel to length coefficients is calculated automatically by the program during the calibration process.//
  
-++++ Click to expand |+++++ Click to expand the instructions |
    
 The pixel to length coefficient is necessary for the camera to know how many millimeters it had moved after having traversed a certain number of pixel to the left/right/top/bottom of its original position. This procedure is done by finding the ratio of millimeters moved to pixels travelled. While it is automated in the newer versions of myCNC software, it can also be done manually in the older software versions.  The pixel to length coefficient is necessary for the camera to know how many millimeters it had moved after having traversed a certain number of pixel to the left/right/top/bottom of its original position. This procedure is done by finding the ratio of millimeters moved to pixels travelled. While it is automated in the newer versions of myCNC software, it can also be done manually in the older software versions. 
Line 224: Line 273:
  
 A camera troubleshooting guide is available here: [[troubleshooting:camera_troubleshooting|Camera Troubleshooting]] A camera troubleshooting guide is available here: [[troubleshooting:camera_troubleshooting|Camera Troubleshooting]]
 +
 +=====Creating the DXF files=====
 +
 +A suitable DXF file can be created in an application such as Inkscape. A few rules to follow:
 +
 +1. The markers should be located outside the part contour (rather than inside of it):
 +
 +{{:quickstart:mycnc-quick-start:cnc-vision-031-markers-outside-contour.png}}
 +
 +Note the way in which the contour connecting the camera markers needs to be fully outside the contour of the file being corrected in order to work properly:
 +
 +{{:quickstart:mycnc-quick-start:cnc-vision-032-marker-setup-rectangle.jpg}}
 +
 +2. The markers and the part contour should be located in different layers (such as **Layer 1** for the working part and **Camera** for the markers), for example:
 +
 +{{:quickstart:mycnc-quick-start:cnc-vision-gif-001-layers.gif}} 
 +
 +3. If using Inkscape, make sure to export using the LWPOLYLINE option (instead of the ROBO-Master type):
 +
 +{{:quickstart:mycnc-quick-start:cnc-vision-gif-002-lwpolyline.gif}}
quickstart/mycnc-quick-start/cnc-vision-setup.txt · Last modified: 2024/02/26 14:50 by ivan

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki