Skip to content

格式化代码#3

Merged
llLeo306 merged 3 commits intomasterfrom
dev
Apr 10, 2026
Merged

格式化代码#3
llLeo306 merged 3 commits intomasterfrom
dev

Conversation

@llLeo306
Copy link
Copy Markdown
Contributor

@llLeo306 llLeo306 commented Apr 10, 2026

Summary by Sourcery

Extend control command interfaces for chassis and gimbal modes.

New Features:

  • Add a chassis mode enumeration to represent small chassis modes instead of a simple boost flag.
  • Extend the gimbal command structure to include angular velocities and accelerations for yaw, pitch, and roll.

Enhancements:

  • Simplify headers by removing an unused array include from the command module interface.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Apr 10, 2026

Reviewer's Guide

This PR updates command data structures in CMD.hpp by introducing a chassis mode enum, replacing a boolean flag with this enum in the chassis command, extending the gimbal command with velocity/acceleration fields, and cleaning up an unused header include.

Class diagram for updated CMD command structures

classDiagram
  class CMD {
  }

  class Mode {
    <<enumeration>>
    CMD_SAFE
    CMD_RC_CTRL
    CMD_KEY_MOUSE_CTRL
    CMD_UART_CTRL
    CMD_AUTO_CTRL
  }

  class ChasStat {
    <<enumeration>>
    NONE
    BOOST
    STRETCH
  }

  class ChassisCMD {
    float x
    float y
    float z
    ChasStat self_define
  }

  class GimbalCMD {
    float yaw
    float pit
    float rol
    float yaw_dot
    float yaw_ddot
    float pit_dot
    float pit_ddot
    float rol_dot
    float rol_ddot
  }

  CMD .. Mode
  CMD .. ChasStat
  CMD .. ChassisCMD
  CMD .. GimbalCMD
  ChassisCMD --> ChasStat
Loading

File-Level Changes

Change Details Files
Introduce a chassis mode enumeration and integrate it into the chassis command structure.
  • Add ChasStat enum class with NONE, BOOST, and STRETCH modes for chassis sub-modes.
  • Replace the boolean boost flag in ChassisCMD with a ChasStat self_define field to represent custom chassis modes.
  • Align and reformat fields in ChassisCMD for readability.
CMD.hpp
Extend gimbal command structure to support angular velocity and acceleration for each axis.
  • Add yaw_dot and yaw_ddot to GimbalCMD for yaw angular velocity and acceleration.
  • Add pit_dot and pit_ddot to GimbalCMD for pitch angular velocity and acceleration.
  • Add rol_dot and rol_ddot to GimbalCMD for roll angular velocity and acceleration.
  • Reformat GimbalCMD field alignment for consistency.
CMD.hpp
Remove an unused standard library header include.
  • Delete the redundant header include to simplify dependencies.
CMD.hpp

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

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

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 ChasStat uses int8_t as an underlying type, ensure the appropriate header (e.g., <cstdint>) is included in this or a common header so the type is always available.
  • Replacing the boost flag with a ChasStat self_define enum changes the layout and semantics of ChassisCMD; double-check that all callers are updated accordingly and that there is a clear mapping from previous boost behavior to the new enum values.
  • The new gimbal command fields (*_dot, *_ddot) and self_define in ChasStat are somewhat generic; consider clarifying their intended usage with more precise names or comments so future readers understand how these values should be produced and consumed.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Since `ChasStat` uses `int8_t` as an underlying type, ensure the appropriate header (e.g., `<cstdint>`) is included in this or a common header so the type is always available.
- Replacing the `boost` flag with a `ChasStat self_define` enum changes the layout and semantics of `ChassisCMD`; double-check that all callers are updated accordingly and that there is a clear mapping from previous `boost` behavior to the new enum values.
- The new gimbal command fields (`*_dot`, `*_ddot`) and `self_define` in `ChasStat` are somewhat generic; consider clarifying their intended usage with more precise names or comments so future readers understand how these values should be produced and consumed.

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.

@llLeo306 llLeo306 merged commit ac721b4 into master Apr 10, 2026
1 of 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.

2 participants