[EMC]
VERSION = 1.1
MACHINE = xyzbca-trsrn (switchkins)
DEBUG = 0

[DISPLAY]
      EMBED_TAB_NAME = TCP
   EMBED_TAB_COMMAND = pyvcp pyvcp_embed_tab_tcp.xml

            GEOMETRY = XYZABC
           OPEN_FILE = ../demos/incremental_repetition.ngc
               PYVCP = ./xyzbca-trsrn.xml
            JOG_AXES = XYZABC
             DISPLAY = axis
MAX_ANGULAR_VELOCITY =  360
 MAX_LINEAR_VELOCITY = 1500
     POSITION_OFFSET = RELATIVE
   POSITION_FEEDBACK = ACTUAL
   MAX_FEED_OVERRIDE = 2
      PROGRAM_PREFIX = ../demos
       INTRO_GRAPHIC = emc2.gif
          INTRO_TIME = 1
             #EDITOR = gedit
         TOOL_EDITOR = tooledit z diam

               TKPKG = Ngcgui 1.0
         NGCGUI_FONT = Helvetica -12 normal

[RS274NGC]
RS274NGC_STARTUP_CODE = G17 G21 G40 G49 G54 G64 P0.001 G80 G90 G92.1 G94 G97 G98
#ON_ABORT_COMMAND = o <on_abort_no_twp_reset> call
ON_ABORT_COMMAND = o <on_abort_with_twp_reset> call
SUBROUTINE_PATH = ../remap_subs:../demos
   HAL_PIN_VARS = 1
          REMAP = M428  modalgroup=10  ngc=428remap
          REMAP = M429  modalgroup=10  ngc=429remap
          REMAP = M430  modalgroup=10  ngc=430remap

          REMAP = G53.1 modalgroup=1   argspec=p ngc=g531remap
          REMAP = G53.3 modalgroup=1   argspec=pxyz ngc=g533remap
          REMAP = G53.6 modalgroup=1   argspec=p ngc=g536remap
          REMAP = M530  modalgroup=10  python=g53x_core

          REMAP = G68.2 modalgroup=1   argspec=pqxyzijkr python=g682
          REMAP = G68.3 modalgroup=1   argspec=xyzr python=g683
          REMAP = G68.4 modalgroup=1   argspec=pqxyzijkr python=g684

          REMAP = G69   modalgroup=1   ngc=g69remap
          REMAP = M469  modalgroup=10  python=g69_core

 PARAMETER_FILE = xyzbca-trsrn.var

[PYTHON]
# where to find the Python code:
# code specific for this configuration
PATH_APPEND = ../python
# import the following Python module
TOPLEVEL = ../python/toplevel.py
# the higher the more verbose tracing of the Python plugin
LOG_LEVEL = 3

[KINS]
KINEMATICS = xyzbca_trsrn
    JOINTS = 6

[TWP]
# this defines the primary spindle rotation
PRIMARY = C
# this defines the secnodary spindle rotation (ie the one closest to the tool)
SECONDARY = A

[HAL]
          HALUI = halui
        HALFILE = LIB:basic_sim.tcl
POSTGUI_HALFILE = xyzbca-trsrn_postgui.hal

# signal reflecting twp states  (0=undefined, 1=defined, 2=active)
HALCMD = net twp-status         <= motion.analog-out-02

# connection required for control of motion.switchkins-type
HALCMD = net :kinstype-select   <= motion.analog-out-03 => motion.switchkins-type

# connections required for the kinematics component
HALCMD = net  :tool-offset       motion.tooloffset.z        xyzbca_trsrn_kins.tool-offset-z
HALCMD = net  :rot-axis-x                                   xyzbca_trsrn_kins.x-rot-axis
HALCMD = net  :rot-axis-z                                   xyzbca_trsrn_kins.z-rot-axis
HALCMD = net  :nutation-angle                               xyzbca_trsrn_kins.nut-angle
HALCMD = net  :pivot-x                                      xyzbca_trsrn_kins.x-pivot
HALCMD = net  :pivot-z                                      xyzbca_trsrn_kins.z-pivot
HALCMD = net  :offset-x                                     xyzbca_trsrn_kins.x-offset
HALCMD = net  :offset-y                                     xyzbca_trsrn_kins.y-offset

# load the required twp-helper component and its hal connections
HALCMD = loadusr -W ../python/twp-helper-comp.py
#twp-status
HALCMD = net twp-status                  => twp-helper-comp.twp-status
HALCMD = net twp-is-defined              <= twp-helper-comp.twp-is-defined
HALCMD = net twp-is-active               <= twp-helper-comp.twp-is-active
# current twp parameters
HALCMD = net twp-ox-world                <= twp-helper-comp.twp-ox-world
HALCMD = net twp-oy-world                <= twp-helper-comp.twp-oy-world
HALCMD = net twp-oz-world                <= twp-helper-comp.twp-oz-world
HALCMD = net twp-ox                      <= twp-helper-comp.twp-ox
HALCMD = net twp-oy                      <= twp-helper-comp.twp-oy
HALCMD = net twp-oz                      <= twp-helper-comp.twp-oz
HALCMD = net twp-zx                      <= twp-helper-comp.twp-zx
HALCMD = net twp-zy                      <= twp-helper-comp.twp-zy
HALCMD = net twp-zz                      <= twp-helper-comp.twp-zz
HALCMD = net twp-xx                      <= twp-helper-comp.twp-xx
HALCMD = net twp-xy                      <= twp-helper-comp.twp-xy
HALCMD = net twp-xz                      <= twp-helper-comp.twp-xz

# load the optional vismach-gui and its hal connections
HALCMD = loadusr -W ../vismach/xyzbca-trsrn-gui.py

HALCMD = net  :axis-x            joint.0.pos-fb             xyzbca-trsrn-gui.axis_x
HALCMD = net  :axis-y            joint.1.pos-fb             xyzbca-trsrn-gui.axis_y
HALCMD = net  :axis-z            joint.2.pos-fb             xyzbca-trsrn-gui.axis_z
HALCMD = net  :rotary-a          joint.3.pos-fb             xyzbca-trsrn-gui.rotary_a
HALCMD = net  :rotary-b          joint.4.pos-fb             xyzbca-trsrn-gui.rotary_b
HALCMD = net  :rotary-c          joint.5.pos-fb             xyzbca-trsrn-gui.rotary_c
HALCMD = net  :tool-diam         halui.tool.diameter        xyzbca-trsrn-gui.tool_diameter
HALCMD = net  :tool-offset                                  xyzbca-trsrn-gui.tool_length
HALCMD = net  :kinstype-select                              xyzbca-trsrn-gui.kinstype_select
HALCMD = net  :nutation-angle                               xyzbca-trsrn-gui.nutation_angle
HALCMD = net  :pivot-x                                      xyzbca-trsrn-gui.pivot_x
HALCMD = net  :pivot-z                                      xyzbca-trsrn-gui.pivot_z
HALCMD = net  :offset-x                                     xyzbca-trsrn-gui.offset_x
HALCMD = net  :offset-y                                     xyzbca-trsrn-gui.offset_y
HALCMD = net  :rot-axis-x                                   xyzbca-trsrn-gui.rot_axis_x
HALCMD = net  :rot-axis-z                                   xyzbca-trsrn-gui.rot_axis_z
HALCMD = net  :hide-work-piece-1                            xyzbca-trsrn-gui.hide_work_piece_1
HALCMD = net  :hide-spindle-body                            xyzbca-trsrn-gui.hide_spindle_body
HALCMD = net  :scale-coords                                 xyzbca-trsrn-gui.scale_coords

HALCMD = net  twp-ox-world                                  xyzbca-trsrn-gui.twp_ox_world
HALCMD = net  twp-oy-world                                  xyzbca-trsrn-gui.twp_oy_world
HALCMD = net  twp-oz-world                                  xyzbca-trsrn-gui.twp_oz_world
HALCMD = net  twp-ox                                        xyzbca-trsrn-gui.twp_ox
HALCMD = net  twp-oy                                        xyzbca-trsrn-gui.twp_oy
HALCMD = net  twp-oz                                        xyzbca-trsrn-gui.twp_oz
HALCMD = net  twp-zx                                        xyzbca-trsrn-gui.twp_zx
HALCMD = net  twp-zy                                        xyzbca-trsrn-gui.twp_zy
HALCMD = net  twp-zz                                        xyzbca-trsrn-gui.twp_zz
HALCMD = net  twp-xx                                        xyzbca-trsrn-gui.twp_xx
HALCMD = net  twp-xy                                        xyzbca-trsrn-gui.twp_xy
HALCMD = net  twp-xz                                        xyzbca-trsrn-gui.twp_xz
HALCMD = net  twp-status                                    xyzbca-trsrn-gui.twp_status
HALCMD = net  twp-is-defined                                xyzbca-trsrn-gui.twp_defined
HALCMD = net  twp-is-active                                 xyzbca-trsrn-gui.twp_active


[HALUI]
# NOTE: kinstype==0 is identity kins because sparm=identityfirst
# M428:identity kins (motion.switchkins-type==0 startupDEFAULT)
# M429:     tcp kins (motion.switchkins-type==1)
# M430:    tool kins (motion.switchkins-type==2)
MDI_COMMAND = M428
MDI_COMMAND = M429
MDI_COMMAND = M430

[TRAJ]
                COORDINATES = XYZABC
               LINEAR_UNITS = mm
              ANGULAR_UNITS = deg
    DEFAULT_LINEAR_VELOCITY = 100
        MAX_LINEAR_VELOCITY = 120
    MAX_LINEAR_ACCELERATION = 700
DEFAULT_LINEAR_ACCELERATION = 300

[EMCMOT]
      EMCMOT = motmod
SERVO_PERIOD = 1000000
COMM_TIMEOUT =       1

[TASK]
      TASK = milltask
CYCLE_TIME = 0.010

[EMCIO]
TOOL_TABLE = xyzbca-trsrn.tbl

[AXIS_X]
       MIN_LIMIT = -5000
       MAX_LIMIT =  5000
    MAX_VELOCITY =   200
MAX_ACCELERATION =   700

[AXIS_Y]
       MIN_LIMIT = -5000
       MAX_LIMIT =  5000
    MAX_VELOCITY =   200
MAX_ACCELERATION =   700

[AXIS_Z]
       MIN_LIMIT = -5000
       MAX_LIMIT =  5000
    MAX_VELOCITY =   200
MAX_ACCELERATION =   700

# spindle secondary axis
[AXIS_A]
       MIN_LIMIT = -185
       MAX_LIMIT =  185
    MAX_VELOCITY =   30
MAX_ACCELERATION =  300

# table rotary axis
[AXIS_B]
       MIN_LIMIT = -360
       MAX_LIMIT =  360
    MAX_VELOCITY =   30
MAX_ACCELERATION =  302

# spindle primary rotating axis
[AXIS_C]
       MIN_LIMIT = -320
       MAX_LIMIT =  320
    MAX_VELOCITY =   30
MAX_ACCELERATION =  301


[JOINT_0]
              TYPE = LINEAR
              HOME =     0
      MAX_VELOCITY =   200
  MAX_ACCELERATION =   700
         MIN_LIMIT = -5000
         MAX_LIMIT =  5000
   HOME_SEARCH_VEL =     0
     HOME_SEQUENCE =     0


[JOINT_1]
              TYPE = LINEAR
              HOME =     0
      MAX_VELOCITY =   200
  MAX_ACCELERATION =   700
         MIN_LIMIT = -5000
         MAX_LIMIT =  5000
   HOME_SEARCH_VEL =     0
     HOME_SEQUENCE =     0

[JOINT_2]
              TYPE = LINEAR
              HOME =     0
      MAX_VELOCITY =   200
  MAX_ACCELERATION =   700
         MIN_LIMIT = -5000
         MAX_LIMIT =  5000
   HOME_SEARCH_VEL =     0
     HOME_SEQUENCE =     0


# spindle secondary joint
[JOINT_3]
            TYPE = ANGULAR
            HOME =     0
    MAX_VELOCITY =    30
MAX_ACCELERATION =   300
       MIN_LIMIT =  -185
       MAX_LIMIT =   185
 HOME_SEARCH_VEL =     0
   HOME_SEQUENCE =     0

# table rotating joint
[JOINT_4]
            TYPE = ANGULAR
            HOME =      0
    MAX_VELOCITY =     30
MAX_ACCELERATION =    300
       MIN_LIMIT =   -360
       MAX_LIMIT =    360
 HOME_SEARCH_VEL =      0
   HOME_SEQUENCE =      0

# spindle primary joint
[JOINT_5]
            TYPE = ANGULAR
            HOME =      0
    MAX_VELOCITY =     30
MAX_ACCELERATION =    300
       MIN_LIMIT =   -320
       MAX_LIMIT =    320
 HOME_SEARCH_VEL =      0
   HOME_SEQUENCE =      0

