Skip to content

Dev#19

Merged
llLeo306 merged 3 commits into
QDU-Robomaster:devfrom
Rui-Xiaoyu:dev
Apr 14, 2026
Merged

Dev#19
llLeo306 merged 3 commits into
QDU-Robomaster:devfrom
Rui-Xiaoyu:dev

Conversation

@Rui-Xiaoyu

@Rui-Xiaoyu Rui-Xiaoyu commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

Summary by Sourcery

Clean up headers and naming and adjust power calculation for the power control application.

Bug Fixes:

  • Correct available power computation in PowerControl by removing an extra fixed power subtraction term.

Enhancements:

  • Reorder Eigen header inclusion and minor formatting cleanups in the RLS estimator header.
  • Rename the SuperPower pointer parameter in PowerControl for clearer semantics and consistency.

@sourcery-ai

sourcery-ai Bot commented Apr 14, 2026

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

Reviewer's Guide

This PR makes minor refactors and a small logic adjustment: it tidies the RLS estimator header include/whitespace, renames a PowerControl constructor parameter and member initializer for clarity, and removes a hard-coded 3.0 offset from the available power calculation so it now only subtracts chassis static power loss from max power.

Class diagram for updated PowerControl constructor and members

classDiagram
  class LibXR_Application

  class SuperPower

  class PowerControl {
    +PowerControl(hw, app, super_power, is_helm, chassis_static_power_loss, motor_count_3508, motor_count_6020)
    -uint32_t MAX_MOTOR_COUNT
    -SuperPower* superpower_
    -bool is_helm_
    -RLS rls_
    -float k3_chassis_
    -int motor_count_3508_
    -int motor_count_6020_
    -float motor_power_3508_[MAX_MOTOR_COUNT]
    -float motor_power_6020_[MAX_MOTOR_COUNT]
  }

  PowerControl --|> LibXR_Application
  PowerControl --> SuperPower

  class RLS {
    +RLS(delta, lambda)
  }

  PowerControl --> RLS
Loading

Flow diagram for updated available power calculation

flowchart TD
  A[max_power] --> C[Compute available_power]
  B[k3_chassis_] --> C[Compute available_power]
  C --> D[available_power = max_power - k3_chassis_]
  D --> E[Use available_power for motor power allocation]
Loading

File-Level Changes

Change Details Files
Tidy RLS estimator header formatting and organization.
  • Move Eigen/Core include to follow the pragma once directive to standardize header layout
  • Normalize spacing in the Reset() call comment
  • Remove an unnecessary blank line in the private section to tighten formatting
RLS.hpp
Clarify PowerControl constructor parameter naming and adjust available power computation logic.
  • Rename SuperPower* constructor parameter from superpower to super_power and update the member initializer accordingly for clearer naming
  • Change the available power calculation to subtract only chassis static power loss from max_power by removing the extra constant 3.0 offset
PowerControl.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

@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:

  • The constructor parameter rename from superpower to super_power while keeping the member superpower_ makes the naming slightly inconsistent; consider aligning the member name with the parameter (e.g., super_power_) for clarity.
  • The change to available_power removes the hard-coded - 3.0 offset; if this constant represents a known baseline loss, consider replacing it with a named constant or configuration value rather than removing it silently, so the intent of the change is explicit in the code.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The constructor parameter rename from `superpower` to `super_power` while keeping the member `superpower_` makes the naming slightly inconsistent; consider aligning the member name with the parameter (e.g., `super_power_`) for clarity.
- The change to `available_power` removes the hard-coded `- 3.0` offset; if this constant represents a known baseline loss, consider replacing it with a named constant or configuration value rather than removing it silently, so the intent of the change is explicit in the code.

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 2ef742c into QDU-Robomaster:dev Apr 14, 2026
2 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