XboxShilling - Ver. 1.0.4 Written by: T. W. Shilling Written On: 29 MAR 2012 Last Modified: 15 MAY 2012 1 Contents PREFACE .......................................................................................................................................... 4 DISCLAIMER..................................................................................................................................... 5 CHANGE LOG ................................................................................................................................... 6 1. Overview ................................................................................................................................. 7 2. Software .................................................................................................................................. 8 3. 2.1. Mach 3 .............................................................................................................................. 8 2.2. Direct X – XXX or Newer ................................................................................................... 8 2.3. .Net Framework 3.5 of Newer.......................................................................................... 8 2.4. XboxShilling.dll Plugin ...................................................................................................... 9 Setup ..................................................................................................................................... 10 3.1. 4. Mach 3 Plugin Config...................................................................................................... 10 Configuration ........................................................................................................................ 12 4.1. Controller Preview ......................................................................................................... 12 4.2. Mode .............................................................................................................................. 12 4.3. Copy ................................................................................................................................ 12 4.4. Left (thumb) Stick / Right (thumb) Stick ........................................................................ 12 4.4.1. Axis Selection and MPG mode .................................................................................... 12 4.4.2. Invert........................................................................................................................... 13 4.4.3. Linearity ...................................................................................................................... 13 4.4.4. Dead zone ................................................................................................................... 14 4.4.5. L-R / U-D Value ........................................................................................................... 14 4.5. Left and Right Trigger ..................................................................................................... 14 4.5.1. Safety .......................................................................................................................... 14 4.5.2. Feed Percent ............................................................................................................... 15 4.5.3. Linearity ...................................................................................................................... 15 4.5.4. Dead zone ................................................................................................................... 15 4.5.5. Value ........................................................................................................................... 15 4.6. Buttons ........................................................................................................................... 15 4.6.1. Macros ........................................................................................................................ 15 4.6.2. OEM ............................................................................................................................ 16 5. Status Screen......................................................................................................................... 17 6. Modes ................................................................................................................................... 18 2 7. Conclusion ............................................................................................................................. 19 Appendix A – OEM Codes ............................................................................................................. 20 Figures Figure 1 - Enable Plugin................................................................................................................. 10 Figure 2 - Plugin Settings Menu .................................................................................................... 11 Figure 3 - Pluin Config Form .......................................................................................................... 11 Figure 4 – Linearity........................................................................................................................ 13 Figure 5 - Dead Zone, 20% ............................................................................................................ 14 Tables Table 1 - Satus Screen ................................................................................................................... 17 Table 2 - Gamepad Mode Selector ............................................................................................... 18 3 PREFACE Mach 3 is a Windows based CNC controller. Using it to interface with a CNC often requires the use of a mouse and keyboard. Simple jogging, edge finding and referencing can be made comber sum by this digital interface. In addition, especially on larger machines, having to return to these input devices to trigger different functionality can add substantial delay in the production process. A wireless solution would allow the user to take the interface with them. If this controller had amble digital and analog inputs it would allow for convenient, precise and expeditious machine manipulation. The XBOXTM Controller for Windows by MicrosoftTM provides all of this functionality in a cost effective and readily available package. This document covers the setup and use of the XboxShilling Mach 3 plugin. This plugin allows a wired or wireless Xbox controller to directly control Mach 3’s motions, states and functions. 4 DISCLAIMER This software is provided as is and I assume no responsibility for any outcome of its use. All information within and referred to is released to the public domain with the express wish that references to Shilling Systems are left intact and the LOGO not removed. Copyright (c) 2012 Tim W. Shilling (www.ShillingSystems.com) XboxShilling is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. XboxShilling is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. To get a copy of the GNU General Public License see <http://www.gnu.org/licenses/>. 5 CHANGE LOG Document Revisions: Delineated by black line in left column. Software Revisions: Version 1.0.0: Initial Release Version 1.0.1: Adjustments made to Config Form Display for Various Resolutions Minimum .NET framework reduced to 2.0 Version 1.0.2: Removal of if(OEM 999 | OEM 804) run check, replaced with if(OEM 804) Fix to Safety Lockout. Original, even if both safeties were off, would still take into account the safeties’ feed rate in calculations. Version 1.0.3: Motor Deceleration added allowing motors to come to a smooth stop when input is stopped or reversed. of if(OEM 999 | OEM 804) re-added as no effects were found on last version Code(“DOJOG”) and Code(“ENDJOG”) added Version 1.0.4: General optimization of Code 6 1. Overview The XboxShilling plugin for Mach 3 is a very versatile interface for your CNC machine. The Xbox controller itself has two analog thumb sticks, one four direction gamepad, eight digital buttons and two analog triggers. The wireless version has a range of approximately 30 feet and accepts rechargeable batteries. A wired version is also available and is supported by this plugin. The interface between the controller and your computer is via a USB wireless receiver that is provided when you purchase your controller. The controller and plugin allow you to configure four different modes or configurations. These four modes are selectable via the controller and allow for up to 32 different digital inputs and the control of up to 6 axis in either a linear or MPG simulated mode. 7 2. Software The XboxShilling plugin requires four pieces of software: Mach 3 o www.MachSupport.com Direct X – 9.1 or newer .NET Framework 2.0 or newer Microsoft XBOX Controller Drivers o www.microsoft.com/hardware/en-us/d/xbox-360-controller-for-windows XboxShilling.dll In order for this interface to work all four pieces must be installed and setup. 2.1. Mach 3 Mach 3, is available from Artsoft at www.MachSupport.com. A trial version is available with limitations and a full version for purchase. For further details on it and its setup, please refer to the wealth of information available on its website. For this document it is assumed the user already has experience with Mach 3. 2.2. Direct X – 9.1 or Newer The second piece of software required is Direct X – 9.1 or newer. This handles the software interface between the controller and your computer. Specifically, the subcomponent XInput is used which was specifically designed as an easy interface with the Microsoft Xbox Controller. Most computers will already have this installed but if it doesn’t, it is freely available from Microsoft and should be downloaded as a complete package. Follow the install and you should be good to proceed. 2.3. .Net Framework 2.0 of Newer Most modern computers will already have the .Net framework installed. If you do not have version 2.0 or newer, you will need to download it from Microsoft and install it. 2.4. Microsoft XBOX Controller Drivers If you purchased a wireless controller, this should come on the included CD. Otherwise, please download and install it from the link above. 8 2.5. XboxShilling.dll Plugin You most likely have already downloaded the plugin. It should have come along with this document, if not, go download it now. There is no install, instead there is just the *.dll file. This is a dynamic link library and is used to interface directly with Mach 3. All you need to do for Mach 3 to be able to find it is to copy the file into the Mach3\PlugIns directory on your computer. 9 3. Setup 3.1. Mach 3 Plugin Config After your software has all been installed and components copied as needed in the last section you can begin to setup the XboxShilling plugin. Begin by opening Mach 3. Once open, click on the menu item, Config/Config Plugin. The plugin configs window should appear: Figure 1 - Enable Plugin You will see a list of currently available plugins. Click the XboxShilling plugin so that it has a green checkmark next to it. If the plugin doesn’t appear, then you most likely did not copy the XboxShilling.dll into the Mach 3 plugin directory. Restart Mach 3. When Mach 3 boots, if the plugin is enabled by the plugin configs screen, then it will automatically start. You should see a small window appear at the up left corner of the screen. This is the controller Status window. If the controller is not connected, it will be two black rectangles; otherwise it will show some other appropriate status. Please see the Status window section for further detail. For now, ignore it and click on the menu item, Plugin Control/XboxShilling: 10 Figure 2 - Plugin Settings Menu This will open the Config Dialog for the XboxShilling plugin. At this time, connect you controller. Ensure the controller’s USB dongle is plugged into your computer and press and hold the silver button in the middle of your controller with a green X on it. In a second or two the flashing green lights will go solid and should show controller #1 as connected. If not, ensure that the USB cable is connected and a green light is shining on the wireless dongle. Then ensure the controller is fully charged or has a new battery installed. Figure 3 - Pluin Config Form 11 4. Configuration There are lots of options available for the configuration of your controller. Your settings are stored each time Mach is shutdown. These setting are automatically reloaded the next time Mach is opened. Your settings are stored in the currently active Mach profile xml file. This means that you can have different configurations for different profiles, say between your lathe and your mill, or mill and your router. You can bring up the configuration screen through the “Plugin Control\XboxShilling” menu. NOTE Whenever the Config screen is displayed an E-STOP condition will be set and no actions by your machine should occur. 4.1. Controller Preview On the right of the config screen is a preview of your controller’s state. All buttons are displayed with their current state. If the controller is unplugged the entire controller will be grayed out. When connected, if a digital button is pressed, it will be evident in this display as being pressed. These buttons are A, B, X, Y, Start, Back, the left and right Shoulder buttons and the thumb stick depression buttons. The triggers and thumb sticks are analog devices. They will move as you move these inputs, however they will only highlight (In orange) when their inputs would affect your machine. 4.2. Mode The mode dropdown box allows you to select one of four modes for configuration. When the mode is changed the other settings on the page will be updated with that modes information. When you change modes, press apply or close the plugin form, the mode changes are saved. 4.3. Copy Copy is simply a tool to copy the configuration of the currently selected mode to another. Usually the user would configure one mode how they want it and copy it to all other modes. Then make the changes on the other modes as needed. This allows the user to easily setup common functions like the safety triggers for all modes. 4.4. Left (thumb) Stick / Right (thumb) Stick 4.4.1. Axis Selection and MPG mode The left and right (thumb) sticks are two dimensional analog inputs. They can be configured to control one or two axis (X, Y, Z, A, B or C). The axis that are controlled by these sticks are determined by the left to right (L-R) and up to 12 down (U-D) dropdown lists. Selecting a “-“ will disable the input in that motion mode. If L-R is set to “X”, moving the stick left and right would move the “X” axis. You can also configure the stick to act as an MPG (Manual Pulse Generator). This means that moving the stick around in a circular motion along the outside edge of the sticks displacement will move the axis proportional to the arc length traveled by the stick. The axis this controls is selected with the L-R dropdown. The U-D dropdown will be ignored in MPG mode. NOTE Selecting the same Axis multiple times on the same or other input stick within the same mode will cause the axis to not be able to be moved. An axis can only be selected for a single input per mode, not multiple. 4.4.2. Invert The invert checkbox allows you to reverse the direction of inputs. 4.4.3. Linearity Linearity allows you to gain more precise control over movements. Stick displacement is raised to the power of the linearity setting. Meaning, if Linearity is 2, a full deflection of the stick would result in a value of 100%. If only moved half the distance (Between full deflection and dead zone) the resulting value would be 50% to the power of 2, or an output of 25% (Figure 4 – Linearity). Figure 4 – Linearity 13 4.4.4. Dead zone The analog inputs on the Xbox Controller have varying degrees of hysteresis, or slop. This means they do not necessarily return to true center. To remove the error this could cause, a dead zone value was implemented. Control outputs are not made until the dead zone value is exceeded. As seen below (Figure 5 - Dead Zone, 20%), the output is also scaled to be 0% at the dead zone value and 100% at full deflection. When the output value is greater than 0%, the stick in the preview image will be highlighted. Figure 5 - Dead Zone, 20% 4.4.5. L-R / U-D Value These are the display of the current controller input values with Linearity and dead zone applied. 4.5. Left and Right Trigger The left and right triggers are used to control feedrates and act as optional safety switches. 4.5.1. Safety The Safety dropdown boxes allow you to select how the safeties operate. This configuration setting allows you to lockout certain function unless the corresponding trigger is squeezed. For instance, if the safety is selected as “Button”, pressing a button on the controller will do nothing unless the trigger is depressed. This works equally as well for the thumb sticks, where if “Stick” is selected, the controller cannot cause an axis to move unless the trigger is depressed. Additionally, the safeties can be set to “Buttons and Sticks” which 14 will not allow the controller to perform any actions unless the trigger is depressed. WARNING Setting both Left and Right safeties to the same values causes either or both triggers to allow activation. They do not both have to be depressed at the same time for activation to occur. CAUTION Controller Mode selection is not affected by any safety setting and a mode change will occur anytime the gamepad is depressed. 4.5.2. Feed Percent Feed percent sets the federate of the system in percent of max axis velocity (Set in motor tuning within Mach). This is the feedrate that will be used when the trigger is fully depressed. An intermediate value will be used if the trigger is only partially depressed. If both triggers are depressed at the same time, the system will take the greater of the two as the desired feedrate. 4.5.3. Linearity Linearity act the same for the triggers as it does for the thumb sticks. 4.5.4. Dead zone Dead zone on the triggers operates identically to that on the thumb sticks. 4.5.5. Value Value displays the current output of the trigger with Linearity and dead zone accounted for. 4.6. Buttons The Buttons section allows you to configure the function to be performed when one of the eight available buttons is pressed. In the dropdown list you will find a list of predefined functions. These are self-explanatory, such as “Zero All” or “Stop” which usually have a corresponding button on your Mach screens. If a function you desire is not available in this list, you can define a custom OEM code or Macro. 4.6.1. Macros Selecting Macro from the dropdown list will enable a number box adjacent to it. Input the desired macro number 0-9999 that you would like run when that button is pressed. This is the same functionality you would have by entering M# 15 (# = you macro number) into the MDI line. Please see Mach documentation for how to write and implement macros in Mach. 4.6.2. OEM An OEM code is a code built into Mach to execute a given function. There are a large range of functions available. Selecting OEM from the dropdown list will enable a number box adjacent to it. Input the desired OEM number 0-9999 that you would like run when that button is pressed. Please see Appendix A – OEM Codes for available OEM functions. 16 5. Status Screen The Status Screen is your visual display of the current state of the controller. It shows you two things, the current mode of the controller (Top Block) and the state of the controller’s power (Bottom Block). Table 1 - Satus Screen Mode Display Not Connected Battery Display Not Connected Mode 1 Battery < 25% Mode 2 Battery 25%-50% Mode 3 Battery 50%-75% Mode 4 Battery 75%-100% Wired Controller Unknown The plugin stores the last location of the Status Screen at shutdown. When Mach loads, it will restore the location of the screen automatically to the last known position. You have two options for this screen. You can turn it off by unchecking the Show Status checkbox (1) and you can change its transparency (2). All settings are automatically restored to their last value at the start of each session. 1 2 17 6. Modes Four modes are selectable by the user via the controller. Each mode can be configured to control the machine in different ways. For instance, Mode 2 could be set to only effect the X axis, Mode 3, the Y, Mode 4, that Z and so on. In this way you can expand the I/O capabilities of the controller four times and you gain a greater level of control over your CNC system. Modes are configured via the Plugin Config screen and during operation are selected using the 4 way gamepad on the controller. When you press the gamepad, either up, down, left or right, it will select the corresponding mode and vibrate a given number of times (Table 2 - Gamepad Mode Selector). Table 2 - Gamepad Mode Selector Gamepad Vibrate Gamepad Vibrate Mode 1 Once Mode 3 Three Times Mode 2 Twice Mode 4 Four Times The selected mode will be reflected on the Status screen and remains in effect until changed. Mode is volatile and reset to mode 1 on Mach reboot. 18 7. Conclusion Hopefully this document introduced you to the XboxShilling plugin to a level at which you can now begin to experiment. Please take care when using new settings and ensure the machine operates as expected before performing any critical tasks. The controller offers a wide range of functions and should provide a great deal of convenience to you and your machine operators. On initial startup all setting will be set to off or at their lowest state. Take some time when configuring to think through and plan how you will utilize your controller. Pick it up and feel how different moves and controls operate, something’s will feel more natural than others. 19 Appendix A – OEM Codes Description Screen 1 select(e.g. Program Run screen) Screen 2 select (e.g. MDI screen select) e.g. Toolpath screen select OEM Codes: 1-132 Code 1 Flood toggle 2 Mist toggle 3 Edit G-code Description Code 113 114 115 e.g. Positioning screen select e.g. Diagnostics screen select e.g. Corrections screen select e.g. Tables screen select Inc Inc Inc Inc D 4 5 6 7 100 101 Zero radius DRO on X Zero radius DRO on Y Zero radius DRO on Z Software limits Touch button for Tool length offset Tool Tab Save 116 117 118 119 120 121 Reset Int Jog mode toggle Goto Safe Z Home Z then X then Y, A, B Units Mach coords 102 103 104 105 106 107 Fixture Tab Save Torch Enable Toggle Torch Cal Zero Enc Load X Enc To X Enc Load Y 122 123 124 125 126 127 Feed raise Feed lower Spindle CW, reset THC height Slow Jog Up Slow Jog Dn Description 108 Enc To Y 109 Enc Load Z 110 Enc To Z 111 Toggle Mill/Turn mode 112 Tool Path Toggle OEM Codes: 133-172 128 129 130 131 132 Zero X Encoder Zero Y Encoder Zero Z Encoder Tool Offset Tog Fixture Off Code 133 134 135 136 137 Description reserved reserved Units/rev - Units/min toggle Set this line as next to execute Jog Follow Code 153 154 155 156 157 Go Home Part X Offset Touch Part Y Offset Touch Part Z Offset Touch Part A Offset Touch Part B Offset Touch 138 139 140 141 142 143 Joystick ON Joystick OFF Regen toolpath display Zero X-Z to stock as defined in DROs (Turn) Coordinate mode (G90/91) Raise spindle speed 158 159 160 161 162 163 Part C Offset Touch Tool X Offset Touch Tool Z Offset Touch Joy Throttle select Touch Corr Enable Toggle Auto Lim Override Toggle 144 145 146 147 148 149 Lower spindle speed Laser Probe Enable Toggle Zero laser grid at current location Z inhibit toggle Ignore Tool Change toggle Close current file 164 165 166 167 168 169 20 OverRide Limits SS on Act4 Toggle reserved Description Spindle CCW toggle Parallel Port Encoder3 MPG Jog Toggle Cycle axis controlled by MPG 1 150 151 Re-load last file Jog increment cycle 152 Clear error label OEM Codes: 173-213 Code Description 173 Select Jog Increment 4 174 Select Jog Increment 5 175 Select Jog Increment 6 170 171 172 Code 194 195 196 Block Delete "switch" toggle Optional Stop "switch" toggle Offline toggle Display Abs Machine coordinates Display Work + G92 coordinates Display Work coords (i.e. not with G92) 176 177 178 179 180 181 Select Jog Increment 7 Select Jog Increment 8 Select Jog Increment 9 Select Jog Increment 10 Feed override Off Feed override Jog 197 198 199 200 201 202 ??? Toggle Spindle actual 182 203 Home X, Home Z (Turn) Select X for MPG 1 184 185 Feed override Feed Jog mode Continuous (same as button 276) Jog mode Step (same as button 275) Select Y for MPG 1 Select Z for MPG 1 Select A for MPG 1 Select B for MPG 1 Select C for MPG 1 Select Jog Increment 1 186 187 188 189 190 191 Joystick On Joystick Off Clear Z tool offset (Turn) Clear X tool offset (Turn) Set stock correction to Zero (Turn) Home X Home Z (Turn) 206 207 208 209 210 211 Select Jog Increment 2 Select Jog Increment 3 Description Show recent G-code files list Display history 192 Home X (Turn) 193 Home Z (Turn) OEM Codes: 214-253 Code Description 214 Output 4 OFF 215 Output 5 ON 204 205 212 213 Code 234 235 Load G-code Tool flip toggle (Turn front/rear toolposts) Z-inhibit ON Z-inhibit OFF Port Bit-Test Set (diagnostic) Anti-dive enabled toggle 216 217 218 219 220 221 Output 5 OFF Output 6 ON Output 6 OFF Set Help context Def-Ref all axes Tangential toggle 236 237 238 239 240 241 THC Anti-dive OFF THC Anti-dive ON Flood ON Flood OFF Mist ON Mist OFF 222 223 224 225 226 227 Save XYZ to G59.254 work offset do G0G53 to G59.254 offset location Move to G59.254 with midpoint selection Toggle Jog Mode through Cont/Step/MPG Force Referenced on all axes CV feed toggle 242 243 244 245 246 247 Load Teach file 228 CV feed OFF 248 21 Toolpath Machine/Job toggle Display Wizard selection window Load the normal screens when Wizard done Simple Complex screen toggle Output 4 ON Description Disable movement on axis B Disable movement on axis C Machine Coordinates toggle Engine OFFline 229 230 CV feed ON Disable movement on axis X 249 250 231 232 233 Disable movement on axis Y Disable movement on axis Z Disable movement on axis A 251 252 253 OEM Codes: 254-293 Code Description 254 Select Step value 10 255 Set Jog mode STEP (same as button 205) 256 Set Jog mode CONT (same as button 204) 257 Increment feedrate Code 274 275 276 277 Engine ONline Select encoder jog on axis X Select encoder jog on axis Y Select encoder jog on axis Z Select encoder jog on axis A Select encoder jog on axis B 258 259 260 261 262 263 Decrement feedrate Run reverse Switch to last used Wizard Cycle axis controlled by MPG 2 Toggle taper mode on MPG 2 Toggle dual MPG flag 278 279 280 281 282 283 Select encoder jog on axis C Select Step value 1 Select Step value 2 Select Step value 3 Select Step value 4 Select Step value 5 264 265 266 267 268 269 Toggle shuttle mode for MPG Return to paused state Remember paused state Toggle override of rapid feeds Crop current dwell now ??? Set formlas 284 285 286 287 288 289 Select Step value 6 Select Step value 7 Select Step value 8 Select Step value 9 Description 270 Inhibit jog of X axis 271 Inhibit jog of Y axis 272 Inhibit jog of Z axis 273 Inhibit jog of A axis OEM Codes: 294-333 Code Description 290 291 292 293 Code Inhibit jog of B axis Inhibit jog of C axis Do screw calibration routine Unconditional crop any dwell now reserved Toggle bypass feed 294 295 296 297 298 299 Push to jog A-Calibrate MPGs Save tool table Save work offset table Drag on toolpath does Zoom toggle Drag on toolpath does Pan toggle 314 315 316 317 318 319 Toggle current tool is in front toolpost Runs the macro in SetTriggerMacro Cycle MPG jogging mode Set MPG jogging mode = Velocity Set MPG jogging mode = Velocity/Step Set MPG jogging mode = do single eaxct steps Set MPG jogging mode = do multiple exact 300 301 302 303 304 Display Wizard select dialog Run Newfangled Wizard Emergency bailout - tester use only Toggle visibility of screen 50 Turn mode tool touch off X axis Toggle use of spindle step line to control Torch volts Turn mode tool touch off Z axis 320 321 322 323 324 305 306 325 326 22 steps Push to jog X++ 307 Select MPG jog mode 327 Push to jog X-Push to jog Y++ Push to jog Y-Push to jog Z++ Push to jog Z-Push to jog A++ 308 309 310 311 312 313 unknown Push to Jog B++ Push to Jog B-Push to Jog C++ Push to Jog C-Toggle axis DROs display Dist to Go 328 329 330 331 332 333 Description Toggle X jog off Toggle Y jog off Toggle Z jog off Toggle A jog off Toggle B jog off Toggle C jog off Set a temporary softlimit minimum at current location Set a temporary softlimit maximum at current location reserved343 Turn off display of menu bar Turn on display of menu bar Increment spindle speed by value not % (Turn) Decrement spindle speed by value not % (Turn) Jog X and A axis ++ together (foam machines) Jog X and A axis -- together (foam machines) Jog Y and A axis ++ together (foam machines) Jog Y and A axis -- together (foam machines) Cycle start Pause (Feed Hold) Rewind Stop Single Resume Edit File OEM Codes: 334-1031 Code 334 Zero All 335 Zero X 336 Zero Y 337 Zero Z Description Code 1007 1008 1009 1010 338 339 Zero A Zero B 1011 1012 340 Zero C 1013 341 347 348 349 Feedrate reset Estimate Job Run from here GotoZs 1014 1015 1016 1017 350 Coord System 1018 351 Verify 1020 352 Reset 1021 353 Ref X 1022 354 Ref Y 1023 355 1000 Ref Z Ref A 1024 1025 1001 1002 1003 1004 1005 1006 Ref B Ref C Joystick Toggle Softlimits Toggle Radius Tracking Toggle Jog Toggle 1026 1027 1028 1029 1030 1031 23
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
advertisement