Skip to content

Update xiaoge_data.py make code easy #485

Merged
ajouatom merged 1 commit into
ajouatom:carrot-wipfrom
jixiexiaoge:carrot-wip
Jul 25, 2026
Merged

Update xiaoge_data.py make code easy #485
ajouatom merged 1 commit into
ajouatom:carrot-wipfrom
jixiexiaoge:carrot-wip

Conversation

@jixiexiaoge

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings July 25, 2026 06:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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. Reusing create_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 = {}
@ajouatom
ajouatom merged commit 6465aae into ajouatom:carrot-wip Jul 25, 2026
1 check passed
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants