-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added DrivetrainConstructor, fixed build errors
- Loading branch information
1 parent
adaa055
commit da6b702
Showing
10 changed files
with
167 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
src/y2025/cpp/subsystems/hardware/DrivetrainConstructor.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#include "subsystems/hardware/DrivetrainConstructor.h" | ||
|
||
frc846::robot::swerve::DrivetrainConfigs | ||
DrivetrainConstructor::getDrivetrainConfigs() { | ||
frc846::robot::swerve::DrivetrainConfigs configs; | ||
|
||
/* START SETTABLES */ | ||
// TODO: Set these values to the correct values for the robot in 2025 | ||
configs.navX_connection_mode = | ||
frc846::robot::swerve::NavX_connection_type::kSerial; | ||
|
||
frc846::robot::swerve::steer_conv_unit steer_reduction = 1.0; // TODO: fix | ||
frc846::robot::swerve::drive_conv_unit drive_reduction = | ||
1.0_ft / 1.0_tr; // TODO: fix | ||
|
||
frc846::robot::swerve::SwerveModuleUniqueConfig FR_config{ | ||
"FR", 999, 999, 999, 999_Ohm}; | ||
frc846::robot::swerve::SwerveModuleUniqueConfig FL_config{ | ||
"FL", 999, 999, 999, 999_Ohm}; | ||
frc846::robot::swerve::SwerveModuleUniqueConfig BR_config{ | ||
"BR", 999, 999, 999, 999_Ohm}; | ||
frc846::robot::swerve::SwerveModuleUniqueConfig BL_config{ | ||
"BL", 999, 999, 999, 999_Ohm}; | ||
|
||
configs.wheelbase_forward_dim = 26_in; | ||
configs.wheelbase_horizontal_dim = 26_in; | ||
|
||
/* END SETTABLES */ | ||
|
||
frc846::control::config::MotorConstructionParameters drive_params{ | ||
.can_id = 999, | ||
.inverted = false, | ||
.brake_mode = true, | ||
.motor_current_limit = 999_A, | ||
.smart_current_limit = 999_A, | ||
.voltage_compensation = 999_V, | ||
.circuit_resistance = 999_Ohm, | ||
.rotational_inertia = frc846::wpilib::unit_kg_m_sq{999}, | ||
.bus = "", | ||
}; | ||
frc846::control::config::MotorConstructionParameters steer_params{ | ||
.can_id = 999, | ||
.inverted = false, | ||
.brake_mode = false, | ||
.motor_current_limit = 999_A, | ||
.smart_current_limit = 999_A, | ||
.voltage_compensation = 999_V, | ||
.circuit_resistance = 999_Ohm, | ||
.rotational_inertia = frc846::wpilib::unit_kg_m_sq{999}, | ||
.bus = "", | ||
}; | ||
|
||
configs.module_common_config = | ||
frc846::robot::swerve::SwerveModuleCommonConfig{drive_params, | ||
steer_params, | ||
frc846::control::base::MotorMonkeyType::TALON_FX_KRAKENX60, | ||
steer_reduction, drive_reduction, ""}; | ||
configs.module_unique_configs = {FR_config, FL_config, BR_config, BL_config}; | ||
|
||
return configs; | ||
} |
14 changes: 14 additions & 0 deletions
14
src/y2025/include/subsystems/hardware/DrivetrainConstructor.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#pragma once | ||
|
||
#include "frc846/robot/swerve/drivetrain.h" | ||
|
||
/* | ||
DrivetrainConstructor | ||
A class providing static methods to aid construction of a DrivetrainSubsystem | ||
object. | ||
*/ | ||
class DrivetrainConstructor { | ||
public: | ||
static frc846::robot::swerve::DrivetrainConfigs getDrivetrainConfigs(); | ||
}; |
Oops, something went wrong.