mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-05 21:42:05 +08:00
vEgoCluster: fix starting from stop (#25350)
* we can't switch back and forth * update translations old-commit-hash: b6910923d18af7332f781a7c83b2601fd7862e3f
This commit is contained in:
@@ -61,6 +61,7 @@ class CarInterfaceBase(ABC):
|
||||
self.steering_unpressed = 0
|
||||
self.low_speed_alert = False
|
||||
self.silent_steer_warning = True
|
||||
self.v_ego_cluster_seen = False
|
||||
|
||||
self.CS = None
|
||||
self.can_parsers = []
|
||||
@@ -162,8 +163,10 @@ class CarInterfaceBase(ABC):
|
||||
ret.canValid = all(cp.can_valid for cp in self.can_parsers if cp is not None)
|
||||
ret.canTimeout = any(cp.bus_timeout for cp in self.can_parsers if cp is not None)
|
||||
|
||||
if ret.vEgoCluster == 0.0:
|
||||
if ret.vEgoCluster == 0.0 and not self.v_ego_cluster_seen:
|
||||
ret.vEgoCluster = ret.vEgo
|
||||
else:
|
||||
self.v_ego_cluster_seen = True
|
||||
|
||||
if ret.cruiseState.speedCluster == 0:
|
||||
ret.cruiseState.speedCluster = ret.cruiseState.speed
|
||||
@@ -321,7 +324,7 @@ class CarStateBase(ABC):
|
||||
def parse_gear_shifter(gear: Optional[str]) -> car.CarState.GearShifter:
|
||||
if gear is None:
|
||||
return GearShifter.unknown
|
||||
|
||||
|
||||
d: Dict[str, car.CarState.GearShifter] = {
|
||||
'P': GearShifter.park, 'PARK': GearShifter.park,
|
||||
'R': GearShifter.reverse, 'REVERSE': GearShifter.reverse,
|
||||
|
||||
@@ -193,7 +193,13 @@ void NvgWindow::updateState(const UIState &s) {
|
||||
}
|
||||
|
||||
// Handle older routes where vEgoCluster is not set
|
||||
float v_ego = sm["carState"].getCarState().getVEgoCluster() == 0.0 ? sm["carState"].getCarState().getVEgo() : sm["carState"].getCarState().getVEgoCluster();
|
||||
float v_ego;
|
||||
if (sm["carState"].getCarState().getVEgoCluster() == 0.0 && !v_ego_cluster_seen) {
|
||||
v_ego = sm["carState"].getCarState().getVEgo();
|
||||
} else {
|
||||
v_ego = sm["carState"].getCarState().getVEgoCluster();
|
||||
v_ego_cluster_seen = true;
|
||||
}
|
||||
float cur_speed = cs_alive ? std::max<float>(0.0, v_ego) : 0.0;
|
||||
cur_speed *= s.scene.is_metric ? MS_TO_KPH : MS_TO_MPH;
|
||||
|
||||
|
||||
@@ -66,6 +66,7 @@ private:
|
||||
bool rightHandDM = false;
|
||||
bool has_us_speed_limit = false;
|
||||
bool has_eu_speed_limit = false;
|
||||
bool v_ego_cluster_seen = false;
|
||||
int status = STATUS_DISENGAGED;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -490,30 +490,30 @@ location set</source>
|
||||
<context>
|
||||
<name>NvgWindow</name>
|
||||
<message>
|
||||
<location filename="../qt/onroad.cc" line="212"/>
|
||||
<location filename="../qt/onroad.cc" line="218"/>
|
||||
<source>km/h</source>
|
||||
<translation>km/h</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qt/onroad.cc" line="212"/>
|
||||
<location filename="../qt/onroad.cc" line="218"/>
|
||||
<source>mph</source>
|
||||
<translation>mph</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qt/onroad.cc" line="280"/>
|
||||
<location filename="../qt/onroad.cc" line="283"/>
|
||||
<location filename="../qt/onroad.cc" line="286"/>
|
||||
<location filename="../qt/onroad.cc" line="289"/>
|
||||
<source>MAX</source>
|
||||
<translation>最高速度</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qt/onroad.cc" line="327"/>
|
||||
<location filename="../qt/onroad.cc" line="330"/>
|
||||
<location filename="../qt/onroad.cc" line="333"/>
|
||||
<location filename="../qt/onroad.cc" line="336"/>
|
||||
<source>SPEED</source>
|
||||
<translation>速度</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qt/onroad.cc" line="333"/>
|
||||
<location filename="../qt/onroad.cc" line="336"/>
|
||||
<location filename="../qt/onroad.cc" line="339"/>
|
||||
<location filename="../qt/onroad.cc" line="342"/>
|
||||
<source>LIMIT</source>
|
||||
<translation>制限速度</translation>
|
||||
</message>
|
||||
|
||||
@@ -490,30 +490,30 @@ location set</source>
|
||||
<context>
|
||||
<name>NvgWindow</name>
|
||||
<message>
|
||||
<location filename="../qt/onroad.cc" line="212"/>
|
||||
<location filename="../qt/onroad.cc" line="218"/>
|
||||
<source>km/h</source>
|
||||
<translation>km/h</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qt/onroad.cc" line="212"/>
|
||||
<location filename="../qt/onroad.cc" line="218"/>
|
||||
<source>mph</source>
|
||||
<translation>mph</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qt/onroad.cc" line="280"/>
|
||||
<location filename="../qt/onroad.cc" line="283"/>
|
||||
<location filename="../qt/onroad.cc" line="286"/>
|
||||
<location filename="../qt/onroad.cc" line="289"/>
|
||||
<source>MAX</source>
|
||||
<translation>MAX</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qt/onroad.cc" line="327"/>
|
||||
<location filename="../qt/onroad.cc" line="330"/>
|
||||
<location filename="../qt/onroad.cc" line="333"/>
|
||||
<location filename="../qt/onroad.cc" line="336"/>
|
||||
<source>SPEED</source>
|
||||
<translation>SPEED</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qt/onroad.cc" line="333"/>
|
||||
<location filename="../qt/onroad.cc" line="336"/>
|
||||
<location filename="../qt/onroad.cc" line="339"/>
|
||||
<location filename="../qt/onroad.cc" line="342"/>
|
||||
<source>LIMIT</source>
|
||||
<translation>LIMIT</translation>
|
||||
</message>
|
||||
|
||||
@@ -488,30 +488,30 @@ location set</source>
|
||||
<context>
|
||||
<name>NvgWindow</name>
|
||||
<message>
|
||||
<location filename="../qt/onroad.cc" line="212"/>
|
||||
<location filename="../qt/onroad.cc" line="218"/>
|
||||
<source>km/h</source>
|
||||
<translation>km/h</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qt/onroad.cc" line="212"/>
|
||||
<location filename="../qt/onroad.cc" line="218"/>
|
||||
<source>mph</source>
|
||||
<translation>mph</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qt/onroad.cc" line="280"/>
|
||||
<location filename="../qt/onroad.cc" line="283"/>
|
||||
<location filename="../qt/onroad.cc" line="286"/>
|
||||
<location filename="../qt/onroad.cc" line="289"/>
|
||||
<source>MAX</source>
|
||||
<translation>最高定速</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qt/onroad.cc" line="327"/>
|
||||
<location filename="../qt/onroad.cc" line="330"/>
|
||||
<location filename="../qt/onroad.cc" line="333"/>
|
||||
<location filename="../qt/onroad.cc" line="336"/>
|
||||
<source>SPEED</source>
|
||||
<translation>SPEED</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qt/onroad.cc" line="333"/>
|
||||
<location filename="../qt/onroad.cc" line="336"/>
|
||||
<location filename="../qt/onroad.cc" line="339"/>
|
||||
<location filename="../qt/onroad.cc" line="342"/>
|
||||
<source>LIMIT</source>
|
||||
<translation>LIMIT</translation>
|
||||
</message>
|
||||
|
||||
@@ -490,30 +490,30 @@ location set</source>
|
||||
<context>
|
||||
<name>NvgWindow</name>
|
||||
<message>
|
||||
<location filename="../qt/onroad.cc" line="212"/>
|
||||
<location filename="../qt/onroad.cc" line="218"/>
|
||||
<source>km/h</source>
|
||||
<translation>km/h</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qt/onroad.cc" line="212"/>
|
||||
<location filename="../qt/onroad.cc" line="218"/>
|
||||
<source>mph</source>
|
||||
<translation>mph</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qt/onroad.cc" line="280"/>
|
||||
<location filename="../qt/onroad.cc" line="283"/>
|
||||
<location filename="../qt/onroad.cc" line="286"/>
|
||||
<location filename="../qt/onroad.cc" line="289"/>
|
||||
<source>MAX</source>
|
||||
<translation>最高</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qt/onroad.cc" line="327"/>
|
||||
<location filename="../qt/onroad.cc" line="330"/>
|
||||
<location filename="../qt/onroad.cc" line="333"/>
|
||||
<location filename="../qt/onroad.cc" line="336"/>
|
||||
<source>SPEED</source>
|
||||
<translation>速度</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qt/onroad.cc" line="333"/>
|
||||
<location filename="../qt/onroad.cc" line="336"/>
|
||||
<location filename="../qt/onroad.cc" line="339"/>
|
||||
<location filename="../qt/onroad.cc" line="342"/>
|
||||
<source>LIMIT</source>
|
||||
<translation>速限</translation>
|
||||
</message>
|
||||
|
||||
Reference in New Issue
Block a user