Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor pulse width calculation for kick into its own function #3351

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

DimitriK24
Copy link

Please fill out the following before requesting review on this PR

Description

Combines duplicate calculations for the chipper's kick pulse width

Testing Done

Built and tested file using bazel

Resolved Issues

resolves #3193

Length Justification and Key Files to Review

Software/src/proto/message_translation/power_frame_msg.hpp

Review Checklist

It is the reviewers responsibility to also make sure every item here has been covered

  • Function & Class comments: All function definitions (usually in the .h file) should have a javadoc style comment at the start of them. For examples, see the functions defined in thunderbots/software/geom. Similarly, all classes should have an associated Javadoc comment explaining the purpose of the class.
  • Remove all commented out code
  • Remove extra print statements: for example, those just used for testing
  • Resolve all TODO's: All TODO (or similar) statements should either be completed or associated with a github issue

Copy link
Contributor

@williamckha williamckha left a comment

Choose a reason for hiding this comment

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

Nice work! A couple comments

* @param speed Speed of the desired kick in m/s
* @return Width of pulse
*/
uint32_t calculateChickerPulseWidth(int kick_constant, double kick_coefficient,
Copy link
Contributor

Choose a reason for hiding this comment

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

You'll need to mark this function as inline. Functions defined in header files need to be marked as inline to avoid violating the One Definition Rule

Comment on lines 117 to 118
* @param kick_constant
* @param kick_coefficient
Copy link
Contributor

Choose a reason for hiding this comment

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

These params should have descriptions. e.g. "the constant to use in the kick speed to pulse width conversion"

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, if you take a look at other functions where calculateChickerPulseWidth is called, you'll see that kick_constant, kick_coefficient, chip_constant, etc. are undocumented in the function docs. This is outside the scope of this PR, but it might be worth updating those function docs with descriptions for those params

Copy link

@DimitriK24
Copy link
Author

The last software test (//software/embedded/ansible:requirements_test) timed out after 60 seconds, all others passed. I'm not sure why the auto-fixes failed.

@williamckha
Copy link
Contributor

The last software test (//software/embedded/ansible:requirements_test) timed out after 60 seconds, all others passed. I'm not sure why the auto-fixes failed.

You can just rerun them if they fail for those reasons. //software/embedded/ansible:requirements_test is flaky on CI for some reason and the auto fixes check often fails after formatting.

Copy link
Contributor

@williamckha williamckha left a comment

Choose a reason for hiding this comment

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

⚡️

@someone2060 someone2060 requested review from a team, Mr-Anyone and AadityaSuri and removed request for a team October 28, 2024 21:46
Copy link
Contributor

@itsarune itsarune left a comment

Choose a reason for hiding this comment

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

Looks good to merge! You should pull master so that the other two checks pass on CI.

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.

Refactor duplicate kick power calculation
4 participants