安全策略移至cpp
This commit is contained in:
@@ -6,6 +6,7 @@ the byte-equivalence and timing tests are stable on the robot board.
|
||||
from pathlib import Path
|
||||
|
||||
from go1_fast_lowcmd import FastLowCmdBuilder as _NativeFastLowCmdBuilder
|
||||
from go1_pro_sdk import PowerProtectViolation
|
||||
|
||||
|
||||
def default_state_path() -> str:
|
||||
@@ -33,6 +34,23 @@ class FastLowCmdBuilder:
|
||||
def build_encrypted_servo12(self, q, dq=None, tau=None, kp=None, kd=None):
|
||||
return self._native.build_encrypted_servo12(q, dq=dq, tau=tau, kp=kp, kd=kd)
|
||||
|
||||
def build_encrypted_servo12_checked(
|
||||
self, q, kp, kd, actual_q=None, actual_tau=None, position_protect_limit=0.0):
|
||||
try:
|
||||
return self._native.build_encrypted_servo12_checked(
|
||||
q,
|
||||
kp,
|
||||
kd,
|
||||
actual_q=actual_q,
|
||||
actual_tau=actual_tau,
|
||||
position_protect_limit=position_protect_limit,
|
||||
)
|
||||
except RuntimeError as exc:
|
||||
message = str(exc)
|
||||
if message.startswith("power protect: "):
|
||||
raise PowerProtectViolation(message[len("power protect: "):]) from exc
|
||||
raise
|
||||
|
||||
def build_plain_fields20(self, mode=None, q=None, dq=None, tau=None, kp=None, kd=None):
|
||||
return self._native.build_plain_fields20(mode=mode, q=q, dq=dq, tau=tau, kp=kp, kd=kd)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user