# This config file was created 2015-10-18 15:29:00.438682 by the update_ini script
# The original config files may be found in the /home/seb/linuxcnc-dev/configs/by_machine/scorbot-er-3/scorbot-er-3.old directory

[EMC]
# The version string for this INI file.
VERSION = 1.1

MACHINE = Scorbot-ER III

# Debug level, 0 means no messages. See src/emc/nml_int/emcglb.h for others
#DEBUG = 0x7fffffff
DEBUG = 0


[DISPLAY]
DISPLAY = axis
CYCLE_TIME = 0.100
HELP_FILE = doc/help.txt
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL

# Highest value that will be allowed for feed override, 1.0 = 100%
MAX_FEED_OVERRIDE =     2.0
MAX_SPINDLE_OVERRIDE =  2.0

MAX_LINEAR_VELOCITY =   27
DEFAULT_LINEAR_VELOCITY =   27

MAX_ANGULAR_VELOCITY =   27
DEFAULT_ANGULAR_VELOCITY =   27

PROGRAM_PREFIX = ../../../nc_files/

INTRO_GRAPHIC = linuxcnc.gif
INTRO_TIME = 5

EDITOR = gvim
TOOL_EDITOR = gvim

INCREMENTS = 10 mm, 1 mm, 0.10 mm, 0.01 mm

PYVCP = gripper.xml


[FILTER]
PROGRAM_EXTENSION = .png,.gif,.jpg Grayscale Depth Image
PROGRAM_EXTENSION = .py Python Script

png = image-to-gcode
gif = image-to-gcode
jpg = image-to-gcode
py = python3


[RS274NGC]
PARAMETER_FILE = sim.var


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


[TASK]
TASK = milltask
CYCLE_TIME = 0.001


[HAL]
HALFILE = scorbot-er-3.hal
#HALFILE = ../../common/shuttlexpress.hal
#HALFILE = shuttlexpress-customization.hal
POSTGUI_HALFILE = pyvcp.hal

HALUI = halui


[HALUI]
#No Content

[TRAJ]
AXES = 5
COORDINATES = X Y Z A B
LINEAR_UNITS = mm
ANGULAR_UNITS = degree
#HOME = 0 0 0 0 0

# mm/second
DEFAULT_VELOCITY = 675
MAX_VELOCITY = 675

# mm/second/second
DEFAULT_ACCELERATION = 5000
MAX_ACCELERATION = 5000

POSITION_FILE = position.txt


#
# The Scorbot-ER III User's Manual (6th Edition) Appendix E states that
# motors 1-5 (joints 0-4) use optical encoders with 6 slots/revolution.
# Experimentally, the Scorbot motor control box reports 6 counts per
# revolution.
#
# The arm motors (joint 0, 1, & 2) have gearboxes with a ratio of 127.7:1.
# The wrist motors (joints 3 & 4) have gearboxes with a ratio of 65.5:1.
#
# 6 counts/motor-rev * 127.7 motor-revs/driveshaft-rev = 766.2 counts/driveshaft-rev
#
# 6 counts/motor-rev * 65.5 motor-revs/driveshaft-rev = 393 counts/driveshaft-rev
#
# Each motor then has a different transmission to actuate the joint, but
# they're all 1:1 after the gearbox on the motor.
#

[EMCIO]
EMCIO = io
CYCLE_TIME = 0.100
#TOOL_TABLE = sim.tbl
#TOOL_CHANGE_POSITION = 0 0 0
#TOOL_CHANGE_QUILL_UP = 1

[KINS]
KINEMATICS =  scorbot-kins
#This is a best-guess at the number of joints, it should be checked
JOINTS = 5


[AXIS_X]
HOME = 0.000
MIN_LIMIT = -1000
MAX_LIMIT = 1000
MAX_VELOCITY = 675
MAX_ACCELERATION = 5000

[JOINT_0]

TYPE =             ANGULAR
MAX_VELOCITY =     675
MAX_ACCELERATION = 5000

# Motor 0 turns a 24 tooth gear that rolls around a 120 tooth gear.
# 766.2 counts/driveshaft-rev * 1 driveshaft-rev/24 teeth = 31.925 counts/tooth
# 31.925 counts/tooth * 120 teeth/joint-rev = 3831.0 counts/joint-rev
# 3831.0 counts/joint-rev * 1 joint-rev/360 degrees = 10.6417 counts/degree
SCALE = 10.6417

MIN_LIMIT = -1000
MAX_LIMIT = 1000

FERROR = 0.100
MIN_FERROR = 0.010

HOME =               0.000
HOME_OFFSET =        -0.100
HOME_SEARCH_VEL =    -7.500
HOME_LATCH_VEL =     2.000
HOME_USE_INDEX =     NO
HOME_IGNORE_LIMITS = YES
HOME_SEQUENCE =      0


[AXIS_Y]
HOME = 130.000
MIN_LIMIT = -1000
MAX_LIMIT = 1000
MAX_VELOCITY = 500
MAX_ACCELERATION = 5000

[JOINT_1]

TYPE =                          ANGULAR
MAX_VELOCITY =                  500
MAX_ACCELERATION =              5000

# Motor 1 turns an 18 tooth gear that rolls around a 72 tooth gear.
# 766.2 counts/driveshaft-rev * 1 driveshaft-rev/18 teeth = 42.567 counts/tooth
# 42.567 counts/tooth * 72 teeth/joint-rev = 3064.8 counts/joint-rev
# 3064.8 counts/joint-rev * 1 joint-rev/360 degrees = 8.513 counts/degree
SCALE = -8.513

MIN_LIMIT = -32
MAX_LIMIT = 127
FERROR = 0.100
MIN_FERROR = 0.010
HOME =               125.000
HOME_OFFSET =        127.900
HOME_SEARCH_VEL =    7.500
HOME_LATCH_VEL =     -2.000
HOME_USE_INDEX =     NO
HOME_IGNORE_LIMITS = YES
HOME_SEQUENCE =      2


[AXIS_Z]
HOME = 0.000
MIN_LIMIT = -1000
MAX_LIMIT = 1000
MAX_VELOCITY = 675
MAX_ACCELERATION = 5000

[JOINT_2]

TYPE =                          ANGULAR
MAX_VELOCITY =                  675
MAX_ACCELERATION =              5000

# Motor 2 turns an 18 tooth gear that rolls around a 72 tooth gear.
# The 72 tooth gear turns a 19(?) tooth timing pulley connected to a 17 tooth timing pulley.
# 766.2 counts/driveshaft-rev * 1 driveshaft-rev/18 teeth = 42.567 counts/tooth
# 42.567 counts/tooth * 72 teeth/axle-rev = 3064.8 counts/axle-rev
# 3064.8 counts/axle-rev * 1 axle-rev/19 timing-teeth = 161.305 counts/timing-tooth
# 161.305 counts/timing-tooth * 17 timing-teeth/joint-rev = 2742.189 counts/joint-rev
# 2742.189 counts/joint-rev * 1 joint-rev/360 degrees = 7.617 counts/rev
SCALE = 7.6171929824561415

MIN_LIMIT = -1000
MAX_LIMIT = 1000
FERROR = 0.050
MIN_FERROR = 0.010
HOME =               0.000
HOME_OFFSET =        -30.001
HOME_SEARCH_VEL =    -7.500
HOME_LATCH_VEL =     2.000
HOME_USE_INDEX =     NO
HOME_IGNORE_LIMITS = YES
HOME_SEQUENCE = 2


[AXIS_A]
HOME = 20.0
MIN_LIMIT = -1000
MAX_LIMIT = 1000
MAX_VELOCITY = 675
MAX_ACCELERATION = 5000

[JOINT_3]

TYPE =                          ANGULAR
MAX_VELOCITY =                  675
MAX_ACCELERATION =              5000

# Motor 3 turns a 12 tooth timing gear (gear #1) connected by a timing belt
# to a 23 tooth timing gear (gear #2).  Gear #2 is connected by another
# belt to another 23 tooth timing gear (gear #3).  Gear #3 is connected by
# another timing belt to another 23 tooth timing gear (gear #4).
# Gear #4 is connected to a differential drive in the wrist.
# The drive gear (the part of the diff rigidly connected to the timing gear)
# has 32 teeth.  The driven gear also has 32 teeth.
#
# FIXME: Since this motor moves the hand in two degrees of freedom, i'm not
# sure how to think about the units etc here.
#
# At the motor:
# 393 counts/driveshaft-rev * 1 driveshaft-rev/12 teeth = 32.75 counts/timing-tooth
# Then at the end of the timing belt drive:
# 32.75 counts/timing-tooth * 32 diff-teeth/23 timing-teeth = 45.56521739130435 counts/diff-tooth
# 45.56521739130435 counts/diff-tooth * 32 diff-teeth/360 degrees = 4.05024154589372 counts/degree
# FIXME: i'm not sure it's ok to convert diff-teeth to degrees that way since it's a differential

SCALE = 4.05024154589372

MIN_LIMIT = -1000
MAX_LIMIT = 1000
FERROR = 0.050
MIN_FERROR = 0.010

HOME =               -30.0
HOME_OFFSET =        -56.0
HOME_SEARCH_VEL =    -7.500
HOME_LATCH_VEL =     2.000
HOME_USE_INDEX =     NO
HOME_IGNORE_LIMITS = YES
HOME_SEQUENCE = 1


[AXIS_B]
HOME = 4.0
MIN_LIMIT = -1000
MAX_LIMIT = 1000
MAX_VELOCITY = 675
MAX_ACCELERATION = 5000

[JOINT_4]

TYPE =                          ANGULAR
MAX_VELOCITY =                  675
MAX_ACCELERATION =              5000

# Motor 4, same as motor 3
SCALE = 4.05024154589372

MIN_LIMIT = -1000
MAX_LIMIT = 1000
FERROR = 0.050
MIN_FERROR = 0.010

HOME =               4.0
HOME_OFFSET =        0.0
HOME_SEARCH_VEL =    -7.500
HOME_LATCH_VEL =     2.000
HOME_USE_INDEX =     NO
HOME_IGNORE_LIMITS = YES
HOME_SEQUENCE = 0


#[AXIS_5]
#TYPE =                          ANGULAR
#MAX_VELOCITY =                  100
#MAX_ACCELERATION =              500

# joint 5
#SCALE = 5

#MIN_LIMIT =                     -8.0
#MAX_LIMIT =                     0.0001
#FERROR = 0.050
#MIN_FERROR = 0.010

#HOME =                          0.000
#HOME_OFFSET =                    1.0
#HOME_SEARCH_VEL =                20.0
#HOME_LATCH_VEL =                 20.0
#HOME_USE_INDEX =                 NO
#HOME_IGNORE_LIMITS =             NO
#HOME_SEQUENCE = 0
#HOME_IS_SHARED = 1


#[AXIS_6]
#TYPE =                          ANGULAR
#MAX_VELOCITY =                  100
#MAX_ACCELERATION =              500

# joint 6
#SCALE = 5

#MIN_LIMIT =                     -8.0
#MAX_LIMIT =                     0.0001
#FERROR = 0.050
#MIN_FERROR = 0.010

#HOME =                          0.000
#HOME_OFFSET =                    1.0
#HOME_SEARCH_VEL =                20.0
#HOME_LATCH_VEL =                 20.0
#HOME_USE_INDEX =                 NO
#HOME_IGNORE_LIMITS =             NO
#HOME_SEQUENCE = 0
#HOME_IS_SHARED = 1


#[AXIS_7]
#TYPE =                          ANGULAR
#MAX_VELOCITY =                  100
#MAX_ACCELERATION =              500

# joint 7
#SCALE = 5

#MIN_LIMIT =                     -8.0
#MAX_LIMIT =                     0.0001
#FERROR = 0.050
#MIN_FERROR = 0.010

#HOME =                          0.000
#HOME_OFFSET =                    1.0
#HOME_SEARCH_VEL =                20.0
#HOME_LATCH_VEL =                 20.0
#HOME_USE_INDEX =                 NO
#HOME_IGNORE_LIMITS =             NO
#HOME_SEQUENCE = 0
#HOME_IS_SHARED = 1

