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

[wombat] Refactor to use namespaces #34

Merged
merged 3 commits into from
Dec 31, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'master' into spacey-sooty/refactoring
  • Loading branch information
spacey-sooty authored Dec 31, 2023
commit a3c9c2109f0e4bec7ffd0e3d918beb03fb59650e
13 changes: 7 additions & 6 deletions wombat/src/main/cpp/utils/VoltageController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,25 @@ units::volt_t wom::utils::VoltageController::GetEstimatedRealVoltage() const {
return units::math::min(units::math::max(-vb, GetVoltage()), vb);
}

wom::utils::MotorVoltageController::MotorVoltageController(frc::MotorController *MotorController) : _MotorController(MotorController) {}
wom::utils::VoltageController::VoltageController(frc::MotorController *MotorController) : _MotorController(MotorController)
{}

void wom::utils::MotorVoltageController::SetVoltage(units::volt_t voltage) {
void wom::utils::VoltageController::SetVoltage(units::volt_t voltage) {
_MotorController->Set(voltage / GetBusVoltage());
}

units::volt_t wom::utils::MotorVoltageController::GetVoltage() const {
units::volt_t wom::utils::VoltageController::GetVoltage() const {
return _MotorController->Get() * GetBusVoltage();
}

units::volt_t wom::utils::MotorVoltageController::GetBusVoltage() const {
units::volt_t wom::utils::VoltageController::GetBusVoltage() const {
return frc::RobotController::GetInputVoltage() * 1_V;
}

void wom::utils::MotorVoltageController::SetInverted(bool invert) {
void wom::utils::VoltageController::SetInverted(bool invert) {
_MotorController->SetInverted(invert);
}

bool wom::utils::MotorVoltageController::GetInverted() const {
bool wom::utils::VoltageController::GetInverted() const {
return frc::RobotController::GetInputVoltage();
}
You are viewing a condensed version of this merge commit. You can view the full changes here.