simple record robot
This commit is contained in:
parent
2809f45604
commit
464925a621
@ -336,9 +336,7 @@ def robot_record(folder):
|
||||
p = Path(folder)
|
||||
p.mkdir(parents=True, exist_ok=True)
|
||||
robot.setup()
|
||||
q = queue.Queue()
|
||||
|
||||
def rtsi_thread():
|
||||
output1 = robot.rt.output_subscribe(
|
||||
'actual_TCP_pose,actual_TCP_force,timestamp', 250) # 输出订阅,配方1
|
||||
robot.rt.start() # rtsi 开始
|
||||
@ -373,22 +371,11 @@ def robot_record(folder):
|
||||
)
|
||||
arr.append(d)
|
||||
if arr.__len__() == 100:
|
||||
q.put(arr)
|
||||
arr = []
|
||||
|
||||
def write_thread():
|
||||
while True:
|
||||
ns = time.time_ns()
|
||||
# print(q.get()[0]['ns'])
|
||||
(p / f'{ns}.json').write_text(json.dumps(q.get()))
|
||||
|
||||
tr = threading.Thread(target=rtsi_thread)
|
||||
tw = threading.Thread(target=write_thread)
|
||||
tr.start()
|
||||
tw.start()
|
||||
tr.join()
|
||||
tw.join()
|
||||
|
||||
# print('write')
|
||||
(p / f'{ns}.json').write_text(json.dumps(arr))
|
||||
arr = []
|
||||
|
||||
if __name__ == '__main__':
|
||||
entrypoint()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user