pcdshub / lcls-twincat-motion

TwinCAT 3 Motion Control Utilities - PLC Motion Library for all PCDS Applications
https://pcdshub.github.io/lcls-twincat-motion
Other
35 stars 20 forks source link

Edge case: When motor hits limit switch and user tries to go past the limit switch #47

Closed slacAdpai closed 4 years ago

slacAdpai commented 4 years ago

Summary: Edge case- When motor hits limit switch and user tries to go past the limit switch, the motor vibrates and stop does not work. Going in the other direction causes position lag monitor to trip. After clearing the error, motor works correctly

In [65]: kmono_instance.ret_horiz.get()
Out[65]: BeckhoffAxisTuple(user_readback=20.754142, user_setpoint=20.750247, user_offset=0.0, user_offset_dir=0, offset_freeze_switch=0, set_use_switch=0, velocity=3.0, acceleration=0.002, motor_egu='mm', motor_is_moving=0, motor_done_move=1, high_limit_switch=0, low_limit_switch=0, direction_of_travel=0, motor_stop=0, home_forward=0, home_reverse=0, low_soft_limit=0.0, high_soft_limit=0.0, disabled=0, description='Main.M51 / RETICLE HORIZ X', plc=BeckhoffAxisPLCTuple(status='', err_code=0, cmd_err_reset=0))

In [66]: kmono_instance.ret_horiz.mv(-1)

In [67]: kmono_instance.ret_horiz.get()
Out[67]: BeckhoffAxisTuple(user_readback=0.0, user_setpoint=0.0, user_offset=0.0, user_offset_dir=0, offset_freeze_switch=0, set_use_switch=0, velocity=3.0, acceleration=0.002, motor_egu='mm', motor_is_moving=0, motor_done_move=1, high_limit_switch=0, low_limit_switch=1, direction_of_travel=0, motor_stop=0, home_forward=0, home_reverse=0, low_soft_limit=0.0, high_soft_limit=0.0, disabled=0, description='Main.M51 / RETICLE HORIZ X', plc=BeckhoffAxisPLCTuple(status='', err_code=0, cmd_err_reset=0))

In [68]: kmono_instance.ret_horiz.position
Out[68]: 0.0

In [69]: kmono_instance.ret_horiz.mv(-1)

In [70]: kmono_instance.ret_horiz.mv(0)

In [71]: kmono_instance.ret_horiz.stop
Out[71]: <bound method EpicsMotor.stop of BeckhoffAxis(SP1L0:KMONO:MMS:RET_HORIZ, name=kmono_instance_ret_horiz)>

In [72]: kmono_instance.ret_horiz.stop()

In [73]: kmono_instance.ret_horiz.mv(10)

In [74]: kmono_instance.ret_horiz.get()
Out[74]: BeckhoffAxisTuple(user_readback=0.0, user_setpoint=10.0, user_offset=0.0, user_offset_dir=0, offset_freeze_switch=0, set_use_switch=0, velocity=3.0, acceleration=0.002, motor_egu='mm', motor_is_moving=0, motor_done_move=1, high_limit_switch=0, low_limit_switch=1, direction_of_travel=0, motor_stop=0, home_forward=0, home_reverse=0, low_soft_limit=0.0, high_soft_limit=0.0, disabled=0, description='Main.M51 / RETICLE HORIZ X', plc=BeckhoffAxisPLCTuple(status='Contact PCDS to add new message', err_code=16931, cmd_err_reset=0))

In [75]: kmono_instance.ret_horiz.clear_error()

In [76]: kmono_instance.ret_horiz.get()
Out[76]: BeckhoffAxisTuple(user_readback=0.0, user_setpoint=10.0, user_offset=0.0, user_offset_dir=0, offset_freeze_switch=0, set_use_switch=0, velocity=3.0, acceleration=0.002, motor_egu='mm', motor_is_moving=0, motor_done_move=1, high_limit_switch=0, low_limit_switch=1, direction_of_travel=0, motor_stop=0, home_forward=0, home_reverse=0, low_soft_limit=0.0, high_soft_limit=0.0, disabled=0, description='Main.M51 / RETICLE HORIZ X', plc=BeckhoffAxisPLCTuple(status='', err_code=0, cmd_err_reset=0))

In [77]: kmono_instance.ret_horiz.mv(10)

Motion failed: kmono_instance_ret_horiz is in an alarm state status=AlarmStatus.STATE severity=AlarmSeverity.MAJOR
In [78]: kmono_instance.ret_horiz.get()
Out[78]: BeckhoffAxisTuple(user_readback=0.0, user_setpoint=10.0, user_offset=0.0, user_offset_dir=0, offset_freeze_switch=0, set_use_switch=0, velocity=3.0, acceleration=0.002, motor_egu='mm', motor_is_moving=0, motor_done_move=1, high_limit_switch=0, low_limit_switch=1, direction_of_travel=0, motor_stop=0, home_forward=0, home_reverse=0, low_soft_limit=0.0, high_soft_limit=0.0, disabled=0, description='Main.M51 / RETICLE HORIZ X', plc=BeckhoffAxisPLCTuple(status='Stall: position lag monitoring error', err_code=17744, cmd_err_reset=0))

In [79]: kmono_instance.ret_horiz.clear_error()

In [80]: kmono_instance.ret_horiz.get()
Out[80]: BeckhoffAxisTuple(user_readback=0.0, user_setpoint=10.0, user_offset=0.0, user_offset_dir=0, offset_freeze_switch=0, set_use_switch=0, velocity=3.0, acceleration=0.002, motor_egu='mm', motor_is_moving=0, motor_done_move=1, high_limit_switch=0, low_limit_switch=1, direction_of_travel=0, motor_stop=0, home_forward=0, home_reverse=0, low_soft_limit=0.0, high_soft_limit=0.0, disabled=0, description='Main.M51 / RETICLE HORIZ X', plc=BeckhoffAxisPLCTuple(status='', err_code=0, cmd_err_reset=0))

In [81]: kmono_instance.ret_horiz.mv(10)

In [82]: kmono_instance.ret_horiz.get()
ZLLentz commented 4 years ago

closed by #73