first commit

This commit is contained in:
cheng
2026-06-29 17:14:42 +08:00
parent 9ef1c8782a
commit c609c3901f
18 changed files with 49 additions and 4 deletions
+4 -2
View File
@@ -29,7 +29,7 @@ SENSOR_CPU = False
# 夹爪串口配置。
PORT = "COM5"
PORT = "COM6"
SLAVE_ID = 1
BAUDRATE = 115200
SERIAL_TIMEOUT = 0.2
@@ -79,9 +79,10 @@ OPEN_WAIT_STABLE_TREND_N = 0.015 # 近期样本首尾变化小于该值,认
# 闭合夹取:物体移动到中间后,左右两边都超过该阈值就认为夹住。
GRIP_NORMAL_FORCE = 0.05 # 双侧接触阈值,单位 N。
GRIP_NORMAL_FORCE = 0.2 # 双侧接触阈值,单位 N。
GRIP_REQUIRES_BOTH = True # True 表示必须左右两侧都接触才算夹住。
CLOSE_TIMEOUT_SECONDS = 5.0 # 触发闭合后这么久还没夹住,就重新张开等待。
CLOSING_COMMAND_INTERVAL = 0.2 # 闭合阶段还没双侧夹上时,按该间隔续发闭合命令,避免单侧扫过后停住。
# 检测到物体后慢慢加力,类似 01 的 gripping 状态。
@@ -211,6 +212,7 @@ CONFIG = {
"grip_normal_force": GRIP_NORMAL_FORCE,
"grip_requires_both": GRIP_REQUIRES_BOTH,
"close_timeout_seconds": CLOSE_TIMEOUT_SECONDS,
"closing_command_interval": CLOSING_COMMAND_INTERVAL,
"force_ramp_step": FORCE_RAMP_STEP,
"force_ramp_interval": FORCE_RAMP_INTERVAL,
"grip_settle_seconds": GRIP_SETTLE_SECONDS,
+9 -1
View File
@@ -326,7 +326,15 @@ class SideTriggerGripController:
reference = None
action = "close-timeout-open"
else:
action = "closing-to-grip"
if (
config.closing_command_interval > 0
and now - last_force_ramp_time >= config.closing_command_interval
):
self.gripper.close(force_pct, "closing-continue")
last_force_ramp_time = now
action = "closing-continue"
else:
action = "closing-to-grip"
elif state == "gripping":
if (
+2
View File
@@ -69,6 +69,7 @@ class Demo02Config:
grip_normal_force: float = 0.05
grip_requires_both: bool = True
close_timeout_seconds: float = 5.0
closing_command_interval: float = 0.2
force_ramp_step: int = 1
force_ramp_interval: float = 0.1
grip_settle_seconds: float = 0.1
@@ -161,6 +162,7 @@ class Demo02Config:
add("--grip-requires-both", dest="grip_requires_both", action="store_true", default=get("grip_requires_both", cls.grip_requires_both))
add("--allow-single-side-grip", dest="grip_requires_both", action="store_false")
add("--close-timeout-seconds", type=float, default=get("close_timeout_seconds", cls.close_timeout_seconds))
add("--closing-command-interval", type=float, default=get("closing_command_interval", cls.closing_command_interval))
add("--force-ramp-step", type=int, default=get("force_ramp_step", cls.force_ramp_step))
add("--force-ramp-interval", type=float, default=get("force_ramp_interval", cls.force_ramp_interval))
add("--grip-settle-seconds", type=float, default=get("grip_settle_seconds", cls.grip_settle_seconds))
+1
View File
@@ -114,6 +114,7 @@ ACTION_TEXT = {
"open-wait-stabilizing": "等待稳定基准",
"open-wait-armed": "已就绪",
"side-trigger-close": "侧边触发闭合",
"closing-continue": "继续闭合",
"closing-to-grip": "闭合寻找物体",
"object-detected-low-force": "检测到物体",
"close-timeout-open": "闭合超时张开",