feat: synchronize CH1 vehicle control and feedback
This commit is contained in:
@@ -577,8 +577,19 @@ class VehicleCanSettings:
|
||||
and (not self.approval_required or self.approval_token)
|
||||
and self.adapter_configured
|
||||
and self.timing_is_verified
|
||||
and self.channel_is_allowed
|
||||
)
|
||||
|
||||
@property
|
||||
def required_channel(self) -> int:
|
||||
"""Physical body-CAN channel selected by the fail-closed bench policy."""
|
||||
|
||||
return _env_int("COGNITIVE_AGENT_VEHICLE_CAN_REQUIRED_CHANNEL", 1)
|
||||
|
||||
@property
|
||||
def channel_is_allowed(self) -> bool:
|
||||
return self.channel == self.required_channel == 1
|
||||
|
||||
@property
|
||||
def timing_is_verified(self) -> bool:
|
||||
return (
|
||||
@@ -610,8 +621,12 @@ class VehicleCanSettings:
|
||||
raise HardwareSafetyError(
|
||||
"vehicle CAN FD currently requires the zlgcan multi-channel backend"
|
||||
)
|
||||
if self.channel < 0:
|
||||
raise HardwareSafetyError("vehicle CAN channel cannot be negative")
|
||||
if not self.channel_is_allowed:
|
||||
raise HardwareSafetyError(
|
||||
"CH1 driver/body-CAN policy requires "
|
||||
"COGNITIVE_AGENT_VEHICLE_CAN_CHANNEL=1 and "
|
||||
"COGNITIVE_AGENT_VEHICLE_CAN_REQUIRED_CHANNEL=1; CH0 is forbidden"
|
||||
)
|
||||
if not self.timing_is_verified:
|
||||
raise HardwareSafetyError(
|
||||
"vehicle CAN timing must remain ISO CAN FD 500 kbit/s / 2 Mbit/s at 80% sample point"
|
||||
@@ -649,6 +664,10 @@ class VehicleCanSettings:
|
||||
"backend": self.backend,
|
||||
"platform": "t2g_cabin_bench",
|
||||
"channel": self.channel,
|
||||
"required_channel": self.required_channel,
|
||||
"channel_is_allowed": self.channel_is_allowed,
|
||||
"target_policy": "ch1_body_can_driver_only",
|
||||
"forbidden_paths": ["ch0", "t2g_seat_bench", "passenger", "front_right"],
|
||||
"mode": 0,
|
||||
"work_mode": "normal",
|
||||
"can_fd_standard": "ISO",
|
||||
|
||||
Reference in New Issue
Block a user