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

Merge master -> cg_calcs #30

Merged
merged 3 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ Commands set targets to these subsystems. Some commands are like actions, such a

#### WPILib Tools

- Download WPILib tools and WPILib VSCode. Attached is the link for version 2025.1.1.
- [2025.1.1 WINDOWS](https://packages.wpilib.workers.dev/installer/v2025.1.1/Win64/WPILib_Windows-2025.1.1.iso)
- Download WPILib tools and WPILib VSCode. Attached is the link for version 2025.2.1.
- [2025.2.1 WINDOWS](https://packages.wpilib.workers.dev/installer/v2025.2.1/Win64/WPILib_Windows-2025.2.1.iso)
- Once downloaded, double click on the file. By default, it will be saved in the downloads folder.
- Run the .exe file inside of it. It should be called "WPILib Installer".
- Go through the default setup process.
Expand Down Expand Up @@ -106,7 +106,7 @@ Select x64 or arm depending on your chip. If using M1/M2/M3 mac, select arm.

Ignore the LLVM section.

- [WPILib 2025.1.1](https://github.com/wpilibsuite/allwpilib/releases/tag/v2025.1.1).
- [WPILib 2025.2.1](https://github.com/wpilibsuite/allwpilib/releases/tag/v2025.2.1).
- [git-scm](https://git-scm.com/download/mac).
- Clang-format: `brew install clang-format`
- CppCheck: `brew install cppcheck`
Expand Down Expand Up @@ -173,7 +173,6 @@ To undo the going back:

## CppCheck Warnings
```
src\frc846\cpp\frc846\control\calculators\CurrentTorqueCalculator.cc:49:30: warning: Variable 'duty_cycle_original' is assigned a value that is never used. [unreadVariable]
src\frc846\cpp\frc846\robot\swerve\drivetrain.cc:160:64: warning: Variable 'accel_target' is assigned a value that is never used. [unreadVariable]
src\frc846\cpp\frc846\math\collection.cc:25:0: warning: The function 'VerticalDeadband' is never used. [unusedFunction]
src\frc846\cpp\frc846\math\collection.cc:39:0: warning: The function 'CoterminalDifference' is never used. [unusedFunction]
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id "cpp"
id "google-test-test-suite"
id "edu.wpi.first.GradleRIO" version "2025.1.1"
id "edu.wpi.first.GradleRIO" version "2025.2.1"
id 'com.diffplug.spotless' version '6.20.0'
}

Expand Down
11 changes: 9 additions & 2 deletions src/frc846/cpp/frc846/control/MotorMonkey.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ units::volt_t MotorMonkey::battery_voltage{0_V};

units::volt_t MotorMonkey::last_disabled_voltage{0_V};

frc846::math::DoubleSyncBuffer MotorMonkey::sync_buffer{50U, 15};
frc846::math::DoubleSyncBuffer MotorMonkey::sync_buffer{100U, 35};

units::ampere_t MotorMonkey::max_draw_{0.0_A};

Expand Down Expand Up @@ -208,7 +208,14 @@ units::ampere_t MotorMonkey::WriteMessages(units::ampere_t max_draw) {
frc846::control::calculators::CurrentTorqueCalculator::
predict_current_draw(duty_cycle, velocity, battery_voltage,
circuit_resistance_registry[msg.slot_id], motor_type);
second_total_current += units::math::max(0_A, pred_draw);

if (velocity > 0_rad_per_s && pred_draw < 0_A) {
(void)pred_draw; // Regen braking mode
} else if (velocity < 0_rad_per_s && pred_draw > 0_A) {
(void)pred_draw; // Regen braking mode
} else {
second_total_current += units::math::abs(pred_draw);
}
total_current += units::math::abs(pred_draw);
temp_messages.pop();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ double CurrentTorqueCalculator::scale_current_draw(double scale_factor,
double CurrentTorqueCalculator::limit_current_draw(double duty_cycle,
units::ampere_t current_limit, units::revolutions_per_minute_t rpm,
units::volt_t v_supply, unit_ohm circuit_resistance, MotorSpecs specs) {
double duty_cycle_original = duty_cycle;
units::ampere_t current_draw = predict_current_draw(
duty_cycle, rpm, v_supply, circuit_resistance, specs);
if (units::math::abs(current_draw) > current_limit) {
Expand Down
2 changes: 1 addition & 1 deletion src/frc846/cpp/frc846/math/DoubleSyncBuffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ std::pair<double, double> DoubleSyncBuffer::GetTrough() {
double min2 = 100000000.0;

for (size_t i = 1; i < m_buffer_2.size() - sync_diff_; i++) {
double added = m_buffer_1[i] * m_buffer_2[i + sync_diff_];
double added = m_buffer_2[i + sync_diff_];
if (added < min_combination) {
min_combination = added;
min1 = m_buffer_1[i];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"fileName": "Phoenix6-frc2025-latest.json",
"fileName": "Phoenix6-25.2.0.json",
"name": "CTRE-Phoenix (v6)",
"version": "25.1.0",
"version": "25.2.0",
"frcYear": "2025",
"uuid": "e995de00-2c64-4df5-8831-c1441420ff19",
"mavenUrls": [
Expand All @@ -19,14 +19,14 @@
{
"groupId": "com.ctre.phoenix6",
"artifactId": "wpiapi-java",
"version": "25.1.0"
"version": "25.2.0"
}
],
"jniDependencies": [
{
"groupId": "com.ctre.phoenix6",
"artifactId": "api-cpp",
"version": "25.1.0",
"version": "25.2.0",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
Expand All @@ -40,7 +40,7 @@
{
"groupId": "com.ctre.phoenix6",
"artifactId": "tools",
"version": "25.1.0",
"version": "25.2.0",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
Expand All @@ -54,7 +54,7 @@
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "api-cpp-sim",
"version": "25.1.0",
"version": "25.2.0",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
Expand All @@ -68,7 +68,7 @@
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "tools-sim",
"version": "25.1.0",
"version": "25.2.0",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
Expand All @@ -82,7 +82,7 @@
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simTalonSRX",
"version": "25.1.0",
"version": "25.2.0",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
Expand All @@ -96,7 +96,7 @@
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simVictorSPX",
"version": "25.1.0",
"version": "25.2.0",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
Expand All @@ -110,7 +110,7 @@
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simPigeonIMU",
"version": "25.1.0",
"version": "25.2.0",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
Expand All @@ -124,7 +124,7 @@
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simCANCoder",
"version": "25.1.0",
"version": "25.2.0",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
Expand All @@ -138,7 +138,21 @@
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simProTalonFX",
"version": "25.1.0",
"version": "25.2.0",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
"windowsx86-64",
"linuxx86-64",
"linuxarm64",
"osxuniversal"
],
"simMode": "swsim"
},
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simProTalonFXS",
"version": "25.2.0",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
Expand All @@ -152,7 +166,7 @@
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simProCANcoder",
"version": "25.1.0",
"version": "25.2.0",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
Expand All @@ -166,7 +180,7 @@
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simProPigeon2",
"version": "25.1.0",
"version": "25.2.0",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
Expand All @@ -180,7 +194,7 @@
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simProCANrange",
"version": "25.1.0",
"version": "25.2.0",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
Expand All @@ -196,7 +210,7 @@
{
"groupId": "com.ctre.phoenix6",
"artifactId": "wpiapi-cpp",
"version": "25.1.0",
"version": "25.2.0",
"libName": "CTRE_Phoenix6_WPI",
"headerClassifier": "headers",
"sharedLibrary": true,
Expand All @@ -212,7 +226,7 @@
{
"groupId": "com.ctre.phoenix6",
"artifactId": "tools",
"version": "25.1.0",
"version": "25.2.0",
"libName": "CTRE_PhoenixTools",
"headerClassifier": "headers",
"sharedLibrary": true,
Expand All @@ -228,7 +242,7 @@
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "wpiapi-cpp-sim",
"version": "25.1.0",
"version": "25.2.0",
"libName": "CTRE_Phoenix6_WPISim",
"headerClassifier": "headers",
"sharedLibrary": true,
Expand All @@ -244,7 +258,7 @@
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "tools-sim",
"version": "25.1.0",
"version": "25.2.0",
"libName": "CTRE_PhoenixTools_Sim",
"headerClassifier": "headers",
"sharedLibrary": true,
Expand All @@ -260,7 +274,7 @@
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simTalonSRX",
"version": "25.1.0",
"version": "25.2.0",
"libName": "CTRE_SimTalonSRX",
"headerClassifier": "headers",
"sharedLibrary": true,
Expand All @@ -276,7 +290,7 @@
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simVictorSPX",
"version": "25.1.0",
"version": "25.2.0",
"libName": "CTRE_SimVictorSPX",
"headerClassifier": "headers",
"sharedLibrary": true,
Expand All @@ -292,7 +306,7 @@
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simPigeonIMU",
"version": "25.1.0",
"version": "25.2.0",
"libName": "CTRE_SimPigeonIMU",
"headerClassifier": "headers",
"sharedLibrary": true,
Expand All @@ -308,7 +322,7 @@
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simCANCoder",
"version": "25.1.0",
"version": "25.2.0",
"libName": "CTRE_SimCANCoder",
"headerClassifier": "headers",
"sharedLibrary": true,
Expand All @@ -324,7 +338,7 @@
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simProTalonFX",
"version": "25.1.0",
"version": "25.2.0",
"libName": "CTRE_SimProTalonFX",
"headerClassifier": "headers",
"sharedLibrary": true,
Expand All @@ -337,10 +351,26 @@
],
"simMode": "swsim"
},
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simProTalonFXS",
"version": "25.2.0",
"libName": "CTRE_SimProTalonFXS",
"headerClassifier": "headers",
"sharedLibrary": true,
"skipInvalidPlatforms": true,
"binaryPlatforms": [
"windowsx86-64",
"linuxx86-64",
"linuxarm64",
"osxuniversal"
],
"simMode": "swsim"
},
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simProCANcoder",
"version": "25.1.0",
"version": "25.2.0",
"libName": "CTRE_SimProCANcoder",
"headerClassifier": "headers",
"sharedLibrary": true,
Expand All @@ -356,7 +386,7 @@
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simProPigeon2",
"version": "25.1.0",
"version": "25.2.0",
"libName": "CTRE_SimProPigeon2",
"headerClassifier": "headers",
"sharedLibrary": true,
Expand All @@ -372,7 +402,7 @@
{
"groupId": "com.ctre.phoenix6.sim",
"artifactId": "simProCANrange",
"version": "25.1.0",
"version": "25.2.0",
"libName": "CTRE_SimProCANrange",
"headerClassifier": "headers",
"sharedLibrary": true,
Expand Down
Loading