global mom_sys_max_travel
global mom_sys_min_travel
global mom_kin_x_axis_limit
global mom_kin_y_axis_limit
global mom_kin_z_axis_limit
global mom_pos
global mom_cycle_rapid_to_pos
global mom_cycle_feed_to_pos
global mom_cycle_retract_to_pos
global mom_motion_type
global mom_warning_info
if {![info exists mom_sys_max_travel]} {
for {set i 0} {$i < 3} {incr i} {
set mom_sys_max_travel($i) $mom_pos($i)
set mom_sys_min_travel($i) $mom_pos($i)
}
} elseif {$mom_motion_type == "CYCLE"} {
for {set i 0} {$i < 3} {incr i} {
if {$mom_cycle_rapid_to_pos($i) < $mom_sys_min_travel($i)} {
set mom_sys_min_travel($i) $mom_cycle_rapid_to_pos($i)
}
if {$mom_cycle_rapid_to_pos($i) > $mom_sys_max_travel($i)} {
set mom_sys_max_travel($i) $mom_cycle_rapid_to_pos($i)
}
if {$mom_cycle_feed_to_pos($i) < $mom_sys_min_travel($i)} {
set mom_sys_min_travel($i) $mom_cycle_feed_to_pos($i)
}
if {$mom_cycle_feed_to_pos($i) > $mom_sys_max_travel($i)} {
set mom_sys_max_travel($i) $mom_cycle_feed_to_pos($i)
}
if {$mom_cycle_retract_to_pos($i) < $mom_sys_min_travel($i)} {
set mom_sys_min_travel($i) $mom_cycle_retract_to_pos($i)
}
if {$mom_cycle_retract_to_pos($i) > $mom_sys_max_travel($i)} {
set mom_sys_max_travel($i) $mom_cycle_retract_to_pos($i)
}
}
} else {
for {set i 0} {$i < 3} {incr i} {
if {$mom_pos($i) < $mom_sys_min_travel($i)} {
set mom_sys_min_travel($i) $mom_pos($i)
}
if {$mom_pos($i) > $mom_sys_max_travel($i)} {
set mom_sys_max_travel($i) $mom_pos($i)
}
}
}
if {[expr $mom_sys_max_travel(0) - $mom_sys_min_travel(0)] > $mom_kin_x_axis_limit} {
set mom_warning_info "Maximum X axis travel exceeded, did not alter output"
MOM_catch_warning
}
if {[expr $mom_sys_max_travel(1) - $mom_sys_min_travel(1)] > $mom_kin_y_axis_limit} {
set mom_warning_info "Maximum Y axis travel exceeded, did not alter output"
MOM_catch_warning
}
if {[expr $mom_sys_max_travel(2) - $mom_sys_min_travel(2)] > $mom_kin_z_axis_limit} {
set mom_warning_info "Maximum Z axis travel exceeded, did not alter output"
MOM_catch_warning
}