Skip to content

Dev#14

Merged
Gcgc4514 merged 5 commits into
QDU-Robomaster:devfrom
Gcgc4514:dev
May 8, 2026
Merged

Dev#14
Gcgc4514 merged 5 commits into
QDU-Robomaster:devfrom
Gcgc4514:dev

Conversation

@Gcgc4514

@Gcgc4514 Gcgc4514 commented May 8, 2026

Copy link
Copy Markdown
Collaborator

ci fix

Summary by Sourcery

Extend referee communication structures and add sentry control helpers while cleaning up minor formatting and CI build output.

New Features:

  • Expose additional launcher-related data (buffs, launch parameters, and dart client data) in the launcher data pack.
  • Introduce a chassis data pack and a sentry state enum for clearer module-specific data exchange.
  • Add helper APIs for configuring sentry decisions, including bullet/HP purchase, resurrection control, and mode switching, plus a method to transmit the sentry decision pack.

Enhancements:

  • Qualify sentry pack type usage for clarity and simplify memory handling for robot interaction user data.
  • Adjust launcher pack publishing to propagate full robot status, buff, launcher, and dart client data.
  • Tidy up UART read and command-sending call formatting for improved readability.

CI:

  • Remove unnecessary standard output from the GitHub Actions build sample main to keep CI logs cleaner.

@Gcgc4514 Gcgc4514 self-assigned this May 8, 2026
@Gcgc4514 Gcgc4514 merged commit ff829df into QDU-Robomaster:dev May 8, 2026
3 checks passed
@sourcery-ai

sourcery-ai Bot commented May 8, 2026

Copy link
Copy Markdown

Reviewer's Guide

Referee.hpp is extended with richer launcher/chassis/sentry data structures and new helper methods for configuring and sending sentry decision commands, along with some minor refactors to data publishing and send/IO helpers; the CI-related build workflow is simplified by removing a debug print from the test harness.

Sequence diagram for sending updated sentry decision command

sequenceDiagram
    actor SentryController
    participant Referee
    participant SentryDecisionData
    participant UART

    SentryController->>Referee: SetNeedBullet(need_bullet)
    Referee->>SentryDecisionData: increment buy_bullet_num

    SentryController->>Referee: SetConfirmRevival(revival)
    Referee->>SentryDecisionData: set confirm_resurrection

    SentryController->>Referee: SetSwitchMode(state)
    Referee->>SentryDecisionData: set current_state

    SentryController->>Referee: SendSentryPack()
    Referee->>Referee: SendStudentCmd(REF_STDNT_CMD_ID_SENTRY_CMD, GetRobotID(), 0x8080, sentry_dec_data)
    Referee->>UART: SendFrame(..., payload)
    UART-->>Referee: LibXR::ErrorCode
    Referee-->>SentryController: LibXR::ErrorCode
Loading

Class diagram for updated Referee data packs and sentry helper methods

classDiagram
    class Referee {
        +LauncherPack lp_
        +ChassisPack cp_
        +SentryPack sp_
        +void SetNeedBullet(uint8_t need_bullet)
        +void SetConfirmRevival(bool revival)
        +void SetBulletRemote(uint8_t bullet_number)
        +void SetHPRemote()
        +void SetRevivalRemote(bool revival)
        +void SetSwitchMode(State state)
        +void SendSentryPack()
        +LibXR::ErrorCode SendFrame(CommandID cmd_id, const void* payload, uint16_t PAYLOAD_LEN)
        +LibXR::ErrorCode SendStudentCmd(CMDID data_cmd_id, uint16_t sender_id, uint16_t receiver_id, const PayloadType& payload)
    }

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

    class ChassisPack {
        +RobotStatus rs
        +uint16_t power_buffer
    }

    class SentryPack {
        +Referee::RobotStatus rs
        +Referee::GameStatus gs
    }

    class State {
        <<enumeration>>
        ATTACH
        DEFEND
        GUERRILLA
    }

    Referee o-- LauncherPack
    Referee o-- ChassisPack
    Referee o-- SentryPack
    Referee .. State
Loading

File-Level Changes

Change Details Files
Expand launcher/chassis/sentry data models and wire them to internal referee data for publishing.
  • Update LauncherPack to include robot buff, launcher data, and dart client instead of a single launcher heat field
  • Introduce ChassisPack and Sentry State enum to better represent chassis power info and sentry posture
  • Adjust SentryPack to use fully-qualified Referee types for robot and game status
  • Update data publishing logic to populate the new LauncherPack fields from internal referee data
Referee.hpp
Add helper APIs to configure and send sentry decision data over the student command channel.
  • Implement setters for sentry bullet purchase, resurrection confirmation, remote bullet/HP purchases, remote revival and state switching, all mutating sentry_dec_data
  • Add SendSentryPack wrapper to send the sentry decision data via SendStudentCmd with the correct command ID and addressing
Referee.hpp
Perform minor refactors/cleanups in referee communication helpers and parsing logic.
  • Tidy formatting/indentation of various Send* wrappers and the SendFrame/SendStudentCmd signatures
  • Replace LibXR::Memory::FastSet with memset when clearing robot interaction user_data in parsing
  • Slightly simplify UART header read condition and remove an obsolete TODO comment
Referee.hpp
Simplify the CI build test harness by removing an extraneous debug print.
  • Remove LibXR::STDIO::Printf line from the example main in the GitHub Actions build workflow to reduce noise in CI logs
.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 found 1 issue, and left some high level feedback:

  • In the new sentry setter APIs (e.g., SetNeedBullet, SetBulletRemote, SetHPRemote) you are incrementing fields (+= / ++-style semantics) rather than assigning, which may be surprising for 'Set*' functions; consider either renaming them to reflect incremental behavior or switching to assignment so the API is clearer.
  • The member name romote_buy_hp_times in SetHPRemote looks like a typo; if possible, align the field name with the intended spelling (remote_buy_hp_times) to avoid confusion.
  • You replaced LibXR::Memory::FastSet with a raw memset for robot_ineraction_data.user_data; consider using the same project-specific memory utility here for consistency with the rest of the codebase.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In the new sentry setter APIs (e.g., SetNeedBullet, SetBulletRemote, SetHPRemote) you are incrementing fields (+= / ++-style semantics) rather than assigning, which may be surprising for 'Set*' functions; consider either renaming them to reflect incremental behavior or switching to assignment so the API is clearer.
- The member name romote_buy_hp_times in SetHPRemote looks like a typo; if possible, align the field name with the intended spelling (remote_buy_hp_times) to avoid confusion.
- You replaced LibXR::Memory::FastSet with a raw memset for robot_ineraction_data.user_data; consider using the same project-specific memory utility here for consistency with the rest of the codebase.

## Individual Comments

### Comment 1
<location path="Referee.hpp" line_range="1008-1009" />
<code_context>
+     * @brief 哨兵姿态
+     *
+     */
+  enum class State : uint8_t{
+      ATTACH = 0,
+      DEFEND = 1,
+      GUERRILLA = 2,
</code_context>
<issue_to_address>
**nitpick (typo):** State value `ATTACH` might be a typo for `ATTACK`.

Given the other states (`DEFEND`, `GUERRILLA`) and the context of 哨兵姿态, this looks like it was meant to be `ATTACK`. If it really means "attach" (e.g., follow mode), consider renaming to something clearer like `FOLLOW` to avoid confusion.

Suggested implementation:

```
  enum class State : uint8_t{
      ATTACK = 0,
      DEFEND = 1,
      GUERRILLA = 2,

```

1. Update all usages of `State::ATTACH` in the codebase to `State::ATTACK` to keep the build compiling and behavior consistent.
2. If there is any serialized protocol, documentation, or UI that references "ATTACH", update those references to "ATTACK" as well, unless the external protocol is fixed and requires the old literal (in which case, consider keeping the numeric value 0 but mapping it to `ATTACK`).
</issue_to_address>

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.

Comment thread Referee.hpp
Comment on lines +1008 to +1009
enum class State : uint8_t{
ATTACH = 0,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nitpick (typo): State value ATTACH might be a typo for ATTACK.

Given the other states (DEFEND, GUERRILLA) and the context of 哨兵姿态, this looks like it was meant to be ATTACK. If it really means "attach" (e.g., follow mode), consider renaming to something clearer like FOLLOW to avoid confusion.

Suggested implementation:

  enum class State : uint8_t{
      ATTACK = 0,
      DEFEND = 1,
      GUERRILLA = 2,

  1. Update all usages of State::ATTACH in the codebase to State::ATTACK to keep the build compiling and behavior consistent.
  2. If there is any serialized protocol, documentation, or UI that references "ATTACH", update those references to "ATTACK" as well, unless the external protocol is fixed and requires the old literal (in which case, consider keeping the numeric value 0 but mapping it to ATTACK).

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