Skip to content

Dev#10

Merged
Gcgc4514 merged 3 commits into
QDU-Robomaster:devfrom
Gcgc4514:dev
Apr 23, 2026
Merged

Dev#10
Gcgc4514 merged 3 commits into
QDU-Robomaster:devfrom
Gcgc4514:dev

Conversation

@Gcgc4514

@Gcgc4514 Gcgc4514 commented Apr 23, 2026

Copy link
Copy Markdown
Collaborator

更新launcher pack,适配cpp20

Summary by Sourcery

Adapt referee launcher data structures and CI build configuration for C++20 support.

New Features:

  • Extend launcher telemetry pack to include robot buff, launcher data, and dart client information.

Bug Fixes:

  • Return the correct namespaced error code when transmit buffer size exceeds capacity.

Enhancements:

  • Populate the expanded launcher pack with full robot status, buff, launcher, and dart client data before publishing.

Build:

  • Update GitHub Actions test project to build with C++20 instead of C++17.

@sourcery-ai

sourcery-ai Bot commented Apr 23, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates the Referee launcher telemetry pack to carry richer data structures and adjusts the GitHub Actions build to use C++20, aligning runtime data publishing and CI with the new launcher data model and language standard.

Sequence diagram for publishing updated LauncherPack telemetry

sequenceDiagram
    participant Referee
    participant RefereeData as data_
    participant LauncherPack as lp_
    participant LauncherTopic as launcherpack_topic_
    participant Subscriber

    Referee->>RefereeData: read robot_status
    Referee->>RefereeData: read robot_buff
    Referee->>RefereeData: read launcher_data
    Referee->>RefereeData: read dart_client

    Referee->>LauncherPack: lp_.rs = data_.robot_status
    Referee->>LauncherPack: lp_.rb = data_.robot_buff
    Referee->>LauncherPack: lp_.ld = data_.launcher_data
    Referee->>LauncherPack: lp_.dc = data_.dart_client

    Referee->>LauncherTopic: Publish(lp_)
    LauncherTopic-->>Subscriber: deliver LauncherPack with rs, rb, ld, dc
Loading

Class diagram for updated Referee LauncherPack data model

classDiagram
    class Referee {
      - LauncherPack lp_
      - ChassisPack cp_
      - StatusPack sp_
      - RefereeData data_
      - Topic~LauncherPack~ launcherpack_topic_
      - Topic~ChassisPack~ chassispack_topic_
      - Topic~StatusPack~ statuspack_topic_
    }

    class LauncherPack {
      RobotStatus rs
      RobotBuff rb
      LauncherData ld
      DartClient dc
    }

    class RefereeData {
      RobotStatus robot_status
      PowerHeat power_heat
      RobotBuff robot_buff
      LauncherData launcher_data
      DartClient dart_client
    }

    class RobotStatus {
      + uint16_t shooter_cooling_value
      + uint16_t shooter_heat_limit
      + uint16_t chassis_pwr_buff
      ..other_fields..
    }

    class RobotBuff {
      + int cooling_boost
      + int power_boost
      ..other_fields..
    }

    class LauncherData {
      + float launcher_id1_17_rate
      + float launcher_id2_17_rate
      ..other_fields..
    }

    class DartClient {
      + bool dart_launcher_available
      + uint8_t dart_count
      ..other_fields..
    }

    class PowerHeat {
      + uint16_t chassis_pwr_buff
      + uint16_t launcher_id1_17_heat
      ..other_fields..
    }

    class ChassisPack {
      RobotStatus rs
      uint16_t power_buffer
    }

    class StatusPack {
      RobotStatus rs
      GameStatus gs
    }

    class GameStatus {
      ..fields..
    }

    class Topic~T~ {
      + void Publish(T message)
    }

    Referee --> LauncherPack : uses
    Referee --> RefereeData : reads
    RefereeData --> RobotStatus
    RefereeData --> RobotBuff
    RefereeData --> LauncherData
    RefereeData --> DartClient
    RefereeData --> PowerHeat
    LauncherPack --> RobotStatus
    LauncherPack --> RobotBuff
    LauncherPack --> LauncherData
    LauncherPack --> DartClient
    ChassisPack --> RobotStatus
    StatusPack --> RobotStatus
    StatusPack --> GameStatus
    Referee --> Topic~LauncherPack~
    Referee --> Topic~ChassisPack~
    Referee --> Topic~StatusPack~
Loading

File-Level Changes

Change Details Files
Extend launcher telemetry pack to carry full robot, buff, launcher, and dart data instead of a single heat field, and update population logic accordingly.
  • Redefine LauncherPack to include RobotStatus, RobotBuff, LauncherData, and DartClient fields instead of a single launcher heat value.
  • Update data publishing logic to assign robot_status, robot_buff, launcher_data, and dart_client into the launcher pack before publishing.
  • Remove the manual mapping of individual shooter cooling and heat fields into the launcher pack in favor of copying the full RobotStatus.
Referee.hpp
Fix error code qualification to use the LibXR namespace when transmit buffer size exceeds capacity.
  • Change return value from ErrorCode::ARG_ERR to LibXR::ErrorCode::ARG_ERR in the transmit size check.
Referee.hpp
Update CI test build configuration to use C++20 instead of C++17.
  • Change CMAKE_CXX_STANDARD from 17 to 20 in the GitHub Actions test CMakeLists generation script.
.github/workflows/build.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot 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.

Hey - I've left some high level feedback:

  • Since LauncherPack is [[gnu::packed]] and now embeds additional structs (RobotBuff, LauncherData, DartClient), double-check that these types are trivially copyable/POD and safe to pack to avoid undefined behavior or misaligned accesses.
  • The new LauncherPack layout replaces the old heat-only fields; make sure any code that serializes/deserializes or otherwise assumes the previous field order/size of this struct is updated to match the new schema.
  • After switching the workflow test project to CMAKE_CXX_STANDARD 20, consider also specifying target_compile_features(xr_test PUBLIC cxx_std_20) in the generated CMakeLists to align with modern CMake practice and avoid relying solely on the global standard variable.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Since `LauncherPack` is `[[gnu::packed]]` and now embeds additional structs (`RobotBuff`, `LauncherData`, `DartClient`), double-check that these types are trivially copyable/POD and safe to pack to avoid undefined behavior or misaligned accesses.
- The new `LauncherPack` layout replaces the old heat-only fields; make sure any code that serializes/deserializes or otherwise assumes the previous field order/size of this struct is updated to match the new schema.
- After switching the workflow test project to `CMAKE_CXX_STANDARD 20`, consider also specifying `target_compile_features(xr_test PUBLIC cxx_std_20)` in the generated CMakeLists to align with modern CMake practice and avoid relying solely on the global standard variable.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Gcgc4514 Gcgc4514 closed this Apr 23, 2026
@Gcgc4514 Gcgc4514 reopened this Apr 23, 2026
@Gcgc4514 Gcgc4514 merged commit 0c61c05 into QDU-Robomaster:dev Apr 23, 2026
3 checks passed
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.

1 participant