I am currently working on a clamping mechanism that needs to secure objects while applying 50N of force. I want to utilize the stallGuard2 of my Trinamic module, but unfortunately i cannot receive consistent results. I apply different combinations of the axis parameters for speed, acceleration, stallguard threshold and try to detect the stall using axis parameter 208 which sends a 9 bit reply the first bit of which is a stall detected flag. i use the following function to read the reply:
In my loop i have use this to detect the stall and stop the motor:
try:
count = []
while True:
motor.move_absolute(-100000)
if decode_error_flags(motor.get_axis_parameter(208)) == ['stallGuard2 threshold reached']:
count.append(1)
if len(count) == 4:
motor.stop()
print (decode_error_flags(motor.get_axis_parameter(208)))
serial_port.close()
break
sleep(0.2)
except KeyboardInterrupt:
motor.stop()
serial_port.close()
print("Press Ctrl-C to terminate while statement")
pass
The counter is because when i start the motor i always receive a stall message for 4 to 6 times and than it clears out until an actual stall appears.
My question is does anyone have a more robust method to detect the stall since mine is not consistent enough? if you have any other suggestions for better setting the axis parameters, i will also be grateful if you share.
Hello All,
I am currently working on a clamping mechanism that needs to secure objects while applying 50N of force. I want to utilize the stallGuard2 of my Trinamic module, but unfortunately i cannot receive consistent results. I apply different combinations of the axis parameters for speed, acceleration, stallguard threshold and try to detect the stall using axis parameter 208 which sends a 9 bit reply the first bit of which is a stall detected flag. i use the following function to read the reply:
def decode_error_flags(flags: int) -> List[str]: lis = [] if flags & 0b1: lis.append('stallGuard2 threshold reached') return lis
In my loop i have use this to detect the stall and stop the motor:
try: count = [] while True: motor.move_absolute(-100000)
except KeyboardInterrupt:
motor.stop() serial_port.close() print("Press Ctrl-C to terminate while statement") pass
The counter is because when i start the motor i always receive a stall message for 4 to 6 times and than it clears out until an actual stall appears.
My question is does anyone have a more robust method to detect the stall since mine is not consistent enough? if you have any other suggestions for better setting the axis parameters, i will also be grateful if you share.
Thank you in advance!