Browse Source

Better parse variable

tags/v0.3.12-rc0
Ubuntu haixuanTao 9 months ago
parent
commit
ddcd227690
2 changed files with 7 additions and 7 deletions
  1. +1
    -1
      examples/reachy2-remote/parse_bbox.py
  2. +6
    -6
      examples/reachy2-remote/parse_point.py

+ 1
- 1
examples/reachy2-remote/parse_bbox.py View File

@@ -50,7 +50,7 @@ def extract_bboxes(json_text):
for event in node: for event in node:
if event["type"] == "INPUT": if event["type"] == "INPUT":
if len(event["value"]) == 0: if len(event["value"]) == 0:
node.send_output("bbox", pa.array([]))
node.send_output("bbox_track", pa.array([]))
continue continue


text = event["value"][0].as_py() text = event["value"][0].as_py()


+ 6
- 6
examples/reachy2-remote/parse_point.py View File

@@ -32,20 +32,20 @@ for event in node:
x_distance = min(height, height - point[1]) x_distance = min(height, height - point[1])


if abs(rz) > 0.75: if abs(rz) > 0.75:
rz = np.deg2rad(90) * np.sign(rz)
rz = np.deg2rad(75) * np.sign(rz)
if abs(rz) > 0.5: if abs(rz) > 0.5:
rz = np.deg2rad(60) * np.sign(rz)
rz = np.deg2rad(50) * np.sign(rz)
elif abs(rz) > 0.3: elif abs(rz) > 0.3:
rz = np.deg2rad(55) * np.sign(rz)
elif abs(rz) > 0.1:
rz = np.deg2rad(45) * np.sign(rz) rz = np.deg2rad(45) * np.sign(rz)
elif abs(rz) > 0.1:
rz = np.deg2rad(30) * np.sign(rz)
else: else:
x = 0 x = 0


if x_distance > (height * 0.7): if x_distance > (height * 0.7):
x = 0.5
x = 1.0
elif x_distance > (height * 0.5): elif x_distance > (height * 0.5):
x = 0.5
x = 0.7
elif x_distance > (height * 0.2): elif x_distance > (height * 0.2):
x = 0.5 x = 0.5
else: else:


Loading…
Cancel
Save