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