Update xiaoge_data.py make code easy #485
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR simplifies the XiaogeDataBroadcaster implementation in xiaoge_data.py, reducing the amount of derived/filtered model and lane-related logic while keeping a TCP JSON broadcast loop that streams carState, modelV2, and selfdriveState data to port 7711.
Changes:
- Removes extensive lane/lead classification, caching, and filtering logic from the model-data path, keeping only a minimal
lead0+ lane-line prob + road-edge + curvature payload. - Streamlines TCP server/client handling and trims many explanatory comments and constants.
- Simplifies heartbeat generation and generalizes some exception handling.
Comments suppressed due to low confidence (1)
openpilot/selfdrive/carrot/xiaoge_data.py:274
- The heartbeat packet creation duplicates
create_packet()logic. Reusingcreate_packet({})keeps the wire format consistent (version/sequence/timestamp/ip) and avoids drift if the packet format changes.
heartbeat = {
'version': 1, 'sequence': self.sequence,
'timestamp': time.time(), 'ip': self.device_ip,
'data': {}
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| from typing import Dict, Any, List, Tuple | ||
| from typing import Dict, Any | ||
|
|
||
| import numpy as np |
Comment on lines
+79
to
80
| except: | ||
| break |
Comment on lines
+173
to
175
| def collect_model_data(self, modelV2) -> Dict[str, Any]: | ||
| """收集模型数据 - 精简版:只输出必要的 6 个字段""" | ||
| data = {} |
happymaj11r
pushed a commit
that referenced
this pull request
Jul 25, 2026
(cherry picked from commit 6465aae)
happymaj11r
pushed a commit
to happymaj11r/openpilot
that referenced
this pull request
Jul 25, 2026
(cherry picked from commit 6465aae)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.