If I loop through and send a set of set_position commands, but all of a sudden want to stop (in whatever position it is in) and give it a new set of set_position commands, is that possible via the Swift API (or at all)?
I was looking for the same feature. I want to move the arm down until it reaches an object to pick it up with the pump. The limit switch successfully triggers a callback, but I don’t know how to stop the arm there.
Hi, for instance, if you send loop command to go to point A-B-C-D-A……, and all of a sudden you want the uArm go to point F, if the uArm is on its way to point C, it will go to point C first and then go to point F, then go to point D to continue the loop. Hope this will help you.
I’ve been working on a problem that requires me to stop the uarm once a trigger signal occur. Pyuf doesn’t have that command so I looked at the Gcode and add a function into the swift api:
def stop_servo(self, servo_id = None):
Stop the uarm from moving
servo_id: SERVO_BOTTOM, SERVO_LEFT, SERVO_RIGHT, SERVO_HAND
cmd = ‘set cmd_sync G2203’
ret = self._ports[‘service’][‘handle’].call(cmd)
Although, the uarm doesn’t behave as I expected. It cuts the power to all motor and it dropped dead instead of moving onto the next command line. If you find a way to implement this function, please do let me know.
x = 300
i = 150
while i <= x:
swift.set_position(i, 0, 60, speed=20000, timeout=1) # go to point C
button = swift.get_digital(21)
if not button:
cPos = swift.get_position()
i += 1
go to point F
P/s: I’m sorry about the indentation