Skip to content

Commit

Permalink
[pre-commit.ci lite] apply automatic fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci-lite[bot] authored Oct 19, 2024
1 parent 7eaf4ce commit db85d07
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/proto/message_translation/power_frame_msg.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,14 @@ TbotsProto_PowerStatus inline createNanoPbPowerStatus(
/**
* Calculates width of the pulse for chicker
* @param kick_constant The constant to use in the kick speed to pulse width conversion
* @param kick_coefficient The coefficient to use in the kick speed to pulse width conversion
* @param kick_coefficient The coefficient to use in the kick speed to pulse width
* conversion
* @param speed Speed of the desired kick in m/s
* @return Width of pulse
*/
inline uint32_t calculateChickerPulseWidth(int kick_constant, double kick_coefficient, float speed){
inline uint32_t calculateChickerPulseWidth(int kick_constant, double kick_coefficient,
float speed)
{
return static_cast<uint32_t>(kick_constant * std::exp(kick_coefficient * speed));
}

Expand Down Expand Up @@ -153,7 +156,8 @@ TbotsProto_PowerPulseControl inline createNanoPbPowerPulseControl(
nanopb_control.chicker.which_chicker_command =
TbotsProto_PowerPulseControl_ChickerControl_kick_pulse_width_tag;
nanopb_control.chicker.chicker_command.kick_pulse_width =
calculateChickerPulseWidth(kick_constant, kick_coeff, google_control.chicker().kick_speed_m_per_s());
calculateChickerPulseWidth(kick_constant, kick_coeff,
google_control.chicker().kick_speed_m_per_s());
break;
case TbotsProto::PowerControl::ChickerControl::kChipDistanceMeters:
nanopb_control.chicker.which_chicker_command =
Expand All @@ -171,7 +175,10 @@ TbotsProto_PowerPulseControl inline createNanoPbPowerPulseControl(
TbotsProto_PowerPulseControl_AutoChipOrKick_autokick_pulse_width_tag;
nanopb_control.chicker.chicker_command.auto_chip_or_kick
.auto_chip_or_kick.autokick_pulse_width =
calculateChickerPulseWidth(kick_constant, kick_coeff, google_control.chicker().auto_chip_or_kick().autokick_speed_m_per_s());
calculateChickerPulseWidth(kick_constant, kick_coeff,
google_control.chicker()
.auto_chip_or_kick()
.autokick_speed_m_per_s());
break;
case TbotsProto::AutoChipOrKick::kAutochipDistanceMeters:
nanopb_control.chicker.chicker_command.auto_chip_or_kick
Expand Down

0 comments on commit db85d07

Please sign in to comment.