can’t get real-time position when swift pro executes move action.
It’s a very easy function. when I use some other mechanical arm, the position is to send via serial at the same time, no matter the arm action or not.
how can I get a real-time position with this swift pro.
Hello,
you can refer to the example below:
import os
import sys
import time
import functools
sys.path.append(os.path.join(os.path.dirname(__file__), '../../..'))
from uarm.wrapper import SwiftAPI
"""
api test: report callback
"""
def pos_callback(ret):
print('report pos: {}, time: {}'.format(ret, time.time()))
swift.register_report_position_callback(callback=pos_callback)
swift.connect()
swift.waiting_ready()
swift.set_report_position(interval=0.1)
swift.set_report_keys(on=True)
swift.set_servo_detach()
time.sleep(60)
swift.set_report_position(interval=0)
swift.set_report_keys(on=False)
swift.set_servo_attach()
swift.disconnect()
Thank you very much. I will try it.
OK, you are welcome.
it works! thanks very very much!
Great! you are welcome.