悬停一次走完后下降会漂几毫米,这一保存点把观察高补交、接触门控和厂家 MoveL 接到能插进去的状态,后面好对照锁 XY 纯 Z。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+17
-12
@@ -133,6 +133,7 @@ def main() -> int:
|
||||
parser = argparse.ArgumentParser(description="RDK MoveL:工具尖走到世界系的一个点")
|
||||
parser.add_argument("--xyz", nargs=3, type=float, metavar=("X", "Y", "Z"), help="目标点,米,机器人世界系")
|
||||
parser.add_argument("--vel", type=float, default=0.05, help="TCP 线速度 m/s,默认 0.05")
|
||||
parser.add_argument("--acc", type=float, default=None, help="TCP 加速度 m/s²,交给 SDK acc;不给则用厂家默认")
|
||||
parser.add_argument("--max-step-m", type=float, default=0.40, help="离当前点超过这么多米就拒绝,除非 --go")
|
||||
parser.add_argument("--go", action="store_true", help="允许超过 --max-step-m")
|
||||
parser.add_argument(
|
||||
@@ -168,7 +169,11 @@ def main() -> int:
|
||||
target_xyz[2] = float(pose[2])
|
||||
dist = math.dist(pose[:3], target_xyz)
|
||||
print(f"目标 xyz=({target_xyz[0]:.4f}, {target_xyz[1]:.4f}, {target_xyz[2]:.4f}) m")
|
||||
print(f"直线距离 {dist * 1000:.0f} mm 速度 {args.vel:.3f} m/s 姿态保持当前")
|
||||
acc_txt = "厂家默认" if args.acc is None else f"{float(args.acc):.3f} m/s²"
|
||||
print(
|
||||
f"直线距离 {dist * 1000:.0f} mm 速度 {args.vel:.3f} m/s"
|
||||
f" 加速度 {acc_txt} 姿态保持当前"
|
||||
)
|
||||
if dist > args.max_step_m and not args.go:
|
||||
print(f"超过 {args.max_step_m * 1000:.0f} mm,拒绝。确认无误后加 --go。")
|
||||
return 2
|
||||
@@ -177,17 +182,17 @@ def main() -> int:
|
||||
print(f"MoveL 欧拉角 deg xyz=({euler_deg[0]:.2f}, {euler_deg[1]:.2f}, {euler_deg[2]:.2f})")
|
||||
|
||||
robot.SwitchMode(flexivrdk.Mode.NRT_PRIMITIVE_EXECUTION)
|
||||
robot.ExecutePrimitive(
|
||||
"MoveL",
|
||||
{
|
||||
"target": flexivrdk.Coord(
|
||||
target_xyz,
|
||||
euler_deg,
|
||||
["WORLD", "WORLD_ORIGIN"],
|
||||
),
|
||||
"vel": float(args.vel),
|
||||
},
|
||||
)
|
||||
prim = {
|
||||
"target": flexivrdk.Coord(
|
||||
target_xyz,
|
||||
euler_deg,
|
||||
["WORLD", "WORLD_ORIGIN"],
|
||||
),
|
||||
"vel": float(args.vel),
|
||||
}
|
||||
if args.acc is not None:
|
||||
prim["acc"] = float(args.acc)
|
||||
robot.ExecutePrimitive("MoveL", prim)
|
||||
print("MoveL 已下发,等 reachedTarget …")
|
||||
t0 = time.monotonic()
|
||||
while True:
|
||||
|
||||
Reference in New Issue
Block a user