I want to get pin value while robot arm is moving.
I always get timeout error until robot arm finished its movement.
Otherwise is there any possible to interrupt the robot arm while it is moving?
I want to stop the arm when it touch something (I stick a pressure sensor )
I used following method (pyuf)
while swift.get_digital(52):
swift.set_position(z=-1,relative=True)
It was very laggy because the arm stop a little while when it reach the position
UFACTORY Website
Official Store
uArm User Facebook Group
Feedback:
English Channel
中文通道
According to the latest version of pyuf, the swift_api does not have a stop function. Therefore it is not possible for the uarm to stop half way while you get a signal from somewhere.
I added this to the swift_api
def stop_servo(self, servo_id = None):
‘’’
Stop the uarm from moving
Args:
servo_id: SERVO_BOTTOM, SERVO_LEFT, SERVO_RIGHT, SERVO_HAND
Returns:
succeed True or Failed False
‘’’
cmd = ‘set cmd_sync G2203 N{:d}’.format(servo_id)
ret = self._ports[‘service’][‘handle’].call(cmd)
if ret == ‘okV0’:
return False
if ret == ‘okV1’:
return True
self._logger.error(‘stop_servo ret: %s’ % ret)
In your python text editor, you can try
while True:
button = swift.get_digital(21)
print ('is moving?: ', swift.get_is_moving())
print('button is ', button)
sleep(1)
if a == true:
break
swift.stop_servo()