fix: 补充 RM75 UDP 超时反馈年龄
This commit is contained in:
@@ -136,12 +136,19 @@ def test_short_udp_timeout_repeats_last_limited_target_without_query() -> None:
|
|||||||
stop=lambda: pytest.fail("stop must not run"),
|
stop=lambda: pytest.fail("stop must not run"),
|
||||||
)
|
)
|
||||||
teleop = _timeout_teleop(adapter)
|
teleop = _timeout_teleop(adapter)
|
||||||
|
warnings = []
|
||||||
|
teleop.get_logger = lambda: SimpleNamespace(
|
||||||
|
warn=lambda message: warnings.append(message)
|
||||||
|
)
|
||||||
|
|
||||||
teleop._handle_stale_joint_feedback(0.2)
|
teleop._handle_stale_joint_feedback(0.2)
|
||||||
|
|
||||||
assert sends == [([0.1] * 7, False)]
|
assert sends == [([0.1] * 7, False)]
|
||||||
assert teleop._last_joint_command_target == [0.1] * 7
|
assert teleop._last_joint_command_target == [0.1] * 7
|
||||||
assert teleop._grip_rearm_required
|
assert teleop._grip_rearm_required
|
||||||
|
assert warnings == [
|
||||||
|
"right_rm75 UDP关节反馈超时(age=200.0 ms),保持最后安全目标。"
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
def test_short_udp_timeout_without_active_target_stays_stopped() -> None:
|
def test_short_udp_timeout_without_active_target_stays_stopped() -> None:
|
||||||
|
|||||||
@@ -1039,7 +1039,8 @@ class SingleArmVelocityTeleop(Node):
|
|||||||
self._grip_rearm_required = True
|
self._grip_rearm_required = True
|
||||||
if self._joint_feedback_ready:
|
if self._joint_feedback_ready:
|
||||||
self.get_logger().warn(
|
self.get_logger().warn(
|
||||||
f"{self._arm_name} UDP关节反馈超时,保持最后安全目标。"
|
f"{self._arm_name} UDP关节反馈超时"
|
||||||
|
f"(age={age * 1000.0:.1f} ms),保持最后安全目标。"
|
||||||
)
|
)
|
||||||
self._joint_feedback_ready = False
|
self._joint_feedback_ready = False
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user