debug opt

This commit is contained in:
remilia 2025-05-16 14:50:33 +08:00
parent 3ec06830e7
commit 404ce769b6
4 changed files with 25 additions and 11 deletions

View File

@ -11,11 +11,19 @@
{
"metadata": {},
"cell_type": "code",
"source": "!flandre device upload fakename config/device/max-256-120,U=120,M=PWI,S=\\(256\\ 6002\\).txt",
"source": "!flandre device upload fakename \"config/device/mini-64-30,U=30,M=PWI,S=(64 1501).txt\"",
"id": "ac406034e9609c90",
"outputs": [],
"execution_count": null
},
{
"metadata": {},
"cell_type": "code",
"source": "!flandre device upload fakename \"config/device/max-256-120,U=120,M=PWI,S=(256 6002).txt\"",
"id": "71eae473ab305743",
"outputs": [],
"execution_count": null
},
{
"metadata": {},
"cell_type": "code",

View File

@ -60,7 +60,7 @@ class SoftwareConfig:
video_height: int = 1080
video_width: int = 960
live_ip: str = '11.6.1.71'
live_ip: str = 'vmaosmax.as'
live_push_port: int = 5555
live_rep_port: int = 5556
device_py_rep_port: int = 5558

View File

@ -238,7 +238,6 @@ def device_upload(name, file: TextIOWrapper):
dd.set_name_and_file_only(name, file.read())
@device.command('recvm')
def device_recvmonitor():
ctx = zmq.Context()
@ -247,7 +246,8 @@ def device_recvmonitor():
while True:
b = pull.recv()
seq, encoder, host_ts, device_ts_low, device_ts_high, buffer = b2t(b)
print(seq, encoder, host_ts, device_ts_low, device_ts_high)
print(f'S={seq} E={encoder} HT={host_ts} DTL={device_ts_low} BS={buffer.__len__()}')
@device.command('recvplot')
def device_recvplot():
@ -271,6 +271,7 @@ def device_recvplot():
last_ts = ts
host_host_ts_last = host_host_ts
@device.command('recvplot2')
def device_recvplot2():
ctx = zmq.Context()
@ -284,11 +285,13 @@ def device_recvplot2():
print((host_host_ts - host_host_ts_last) / 10 ** 6, flush=True)
host_host_ts_last = host_host_ts
@device.command('recvplot3')
def device_recvplot3():
ctx = zmq.Context()
pull = ctx.socket(zmq.PULL)
pull.connect(C.live_push_socket)
print(C.live_push_socket)
last_ts = 0
first = True
host_host_ts_last = time.time_ns()
@ -302,10 +305,11 @@ def device_recvplot3():
last_ts = ts
first = False
continue
print((ts - last_ts) / 10 ** 6,(host_host_ts - host_host_ts_last) / 10 ** 6, flush=True)
print((ts - last_ts) / 10 ** 6, (host_host_ts - host_host_ts_last) / 10 ** 6, flush=True)
last_ts = ts
host_host_ts_last = host_host_ts
@device.command('recvplotdiff')
def device_recvplotdiff():
ctx = zmq.Context()
@ -382,7 +386,7 @@ def robot():
def robot_monitor():
robot.setup()
output1 = robot.rt.output_subscribe(
'actual_TCP_pose,actual_TCP_force', 250) # 输出订阅,配方1
'actual_TCP_pose,actual_TCP_force,timestamp', 250) # 输出订阅,配方1
robot.rt.start() # rtsi 开始
while True:
recv_out: DataObject = robot.rt.get_output_data()
@ -391,7 +395,7 @@ def robot_monitor():
if recv_out.recipe_id == output1.id:
x, y, z, r, p, yy = recv_out.actual_TCP_pose
fx, fy, fz, fr, fp, fyy = recv_out.actual_TCP_force
print('fx', fx)
print('xts', x, recv_out.timestamp)
@robot.command('record')
@ -411,10 +415,11 @@ def robot_record(folder):
def rtsi_thread():
output1 = robot.rt.output_subscribe(
'actual_TCP_pose,actual_TCP_force', 250) # 输出订阅,配方1
'actual_TCP_pose,actual_TCP_force,timestamp', 250) # 输出订阅,配方1
robot.rt.start() # rtsi 开始
arr = []
last_ns = time.time_ns()
last_device_ts = 0
while True:
recv_out: DataObject = robot.rt.get_output_data()
if recv_out is None:
@ -423,9 +428,10 @@ def robot_record(folder):
x, y, z, rx, ry, rz = recv_out.actual_TCP_pose
fx, fy, fz, frx, fry, frz = recv_out.actual_TCP_force
ns = time.time_ns()
print(ns - last_ns,x)
print(ns - last_ns, recv_out.timestamp - last_device_ts, x)
last_ns = ns
last_device_ts = recv_out.timestamp
d = dict(
# x=x,
# y=y,

View File

@ -52,6 +52,6 @@ def b2t(b: bytes):
# device_ts_low = struct.unpack('<I', bb)
# device_ts_low = b[4 + 8 + 4 + 8:4 + 8 + 4 + 8 + 4]
# print(bin(device_ts_low[0]),bin(device_ts_low[1]),bin(device_ts_low[2]),bin(device_ts_low[3]))
buffer = b[4 + 8 + 8 + 8 + 4:]
buffer = b[4 + 8 + 4 + 8 + 4 + 4:]
return seq, encoder, host_ts, device_ts_low, device_ts_high, buffer