Skip to content

Commit 77fe57f

Browse files
committed
YIPEEEEEEEEE
2 parents 1d6144f + eaa0623 commit 77fe57f

35 files changed

+1723
-718
lines changed

.editorconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
* text=auto
22
*.sh text eol=lf
3+
<<<<<<< HEAD
34
*.bat text eol=crlf
5+
=======
6+
>>>>>>> eaa0623252b24fabd56e50f6a52c382e4c9640a4
47
*.gradle text eol=lf
58
*.java text eol=lf
69
*.json text eol=lf

.github/workflows/format.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ jobs:
2121
with:
2222
python-version: 3.8
2323
- name: Install wpiformat
24+
<<<<<<< HEAD
2425
run: pip3 install wpiformat==2024.31
26+
=======
27+
run: pip3 install wpiformat==2023.36
28+
>>>>>>> eaa0623252b24fabd56e50f6a52c382e4c9640a4
2529
- name: Run
2630
run: wpiformat
2731
- name: Check output

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@ bin/
161161
# clangd
162162
/.cache
163163
compile_commands.json
164+
<<<<<<< HEAD
164165

165166
# sim
166167
ctre_sim
168+
=======
169+
>>>>>>> eaa0623252b24fabd56e50f6a52c382e4c9640a4

.styleguide

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
<<<<<<< HEAD
2+
=======
3+
4+
>>>>>>> eaa0623252b24fabd56e50f6a52c382e4c9640a4
15
cppHeaderFileInclude {
26
\.h$
37
\.hpp$

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,21 @@ Fork this repository then open up a terminal and run :
1010
```bash
1111
git clone https://github.com/*yourusernamehere*/2024-Crescendo.git
1212
cd 2024-Crescendo
13+
chmod +x init.sh
14+
./init.sh
1315
```
1416
Now look in [CONTRIBUTING.md](./CONTRIBUTING.md) before continuing!
17+
18+
Windows
19+
---
20+
Fork this repository then open up a terminal and run :
21+
```powershell
22+
git clone https:\\github.com\*yourusernamehere*\2024-Crescendo.git
23+
cd 2024-Crescendo
24+
.\init
25+
```
26+
Now look in [CONTRIBUTING.md](./CONTRIBUTING.md) before continuing!
27+
1528
Quick Commands
1629
===
1730
These commands can be used in a variety of combinations, feel free to experiment!
@@ -42,7 +55,6 @@ Runs a simulation of your code at highest optimisation.
4255

4356
**Debug**
4457
`./gradlew :simulateNativeDebug`
45-
4658
Runs a debug simulation of your code, including a variety of debugging tools similar to glass but at lower optimisation.
4759

4860
Documentation

init.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
./gradlew installRoborioToolchain
2+
./gradlew build

init.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/sh
2+
sudo apt update
3+
chmod +x gradlew
4+
./gradlew installRoborioToolchain
5+
./gradlew build

src/main/cpp/AlphaArm.cpp

Lines changed: 28 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -4,117 +4,63 @@
44

55
#include "AlphaArm.h"
66

7-
// fiddle with these values
8-
AlphaArm::AlphaArm(AlphaArmConfig config)
9-
: _config(config),
10-
_pidWom(_config.path + "/pid",
11-
config.pidConfigA) /*_table(nt::NetworkTableInstance::GetDefault().GetTable(config.path)*/ {}
7+
AlphaArm::AlphaArm(AlphaArmConfig config) : _config(config) {}
128

13-
void AlphaArm::OnStart() {
14-
started = false;
15-
// _pidWom.Reset();
16-
// _pidWom.SetSetpoint(_config.alphaArmGearbox.encoder->GetEncoderPosition());
9+
AlphaArmConfig AlphaArm::GetConfig() {
10+
return _config;
1711
}
1812

1913
void AlphaArm::OnUpdate(units::second_t dt) {
20-
_table->GetEntry("Error").SetDouble(_pidWom.GetError().value());
21-
_table->GetEntry("Current Pos").SetDouble(_config.alphaArmGearbox.encoder->GetEncoderPosition().value());
22-
_table->GetEntry("Setpoint").SetDouble(_pidWom.GetSetpoint().value());
23-
_table->GetEntry("State ").SetString(_stateName);
2414
switch (_state) {
2515
case AlphaArmState::kIdle:
26-
_stateName = "Idle";
27-
// _pidWom.SetSetpoint(_config.alphaArmGearbox.encoder->GetEncoderPosition());
2816

17+
// _config.alphaArmGearbox.motorController->SetVoltage(0_V);
18+
// _config.wristGearbox.motorController->SetVoltage(0_V);
2919
_setAlphaArmVoltage = 0_V;
20+
_setWristVoltage = 0_V;
3021

3122
break;
3223
case AlphaArmState::kRaw:
33-
_stateName = "Raw";
34-
3524
_setAlphaArmVoltage = _rawArmVoltage;
25+
_setWristVoltage = _rawWristVoltage;
26+
_config.alphaArmGearbox.motorController->SetVoltage(_rawArmVoltage);
27+
_config.wristGearbox.motorController->SetVoltage(_rawWristVoltage);
3628

3729
break;
38-
case AlphaArmState::kAmpAngle: {
39-
_stateName = "Amp Angle";
40-
41-
// _pidWom.SetSetpoint(_goal);
42-
// _setAlphaArmVoltage = _pidWom.Calculate(_config.alphaArmGearbox.encoder->GetEncoderPosition(), dt,
43-
// 0_V);
30+
case AlphaArmState::kForwardWrist:
31+
_config.wristGearbox.motorController->SetVoltage(3_V);
32+
_setWristVoltage = 3_V;
4433

45-
if (started) {
46-
if (_controlledRawVoltage.value() == 0) {
47-
if (-_config.alphaArmGearbox.encoder->GetEncoderPosition() > (_startingPos + (3.1415_rad / 2))) {
48-
// _pidWom.SetSetpoint(_encoderSetpoint);
49-
// _setAlphaArmVoltage =
50-
// -_pidWom.Calculate(-_config.alphaArmGearbox.encoder->GetEncoderPosition(), dt, 0.0_V);
51-
// _table->GetEntry("Demand").SetDouble(_setAlphaArmVoltage.value());
52-
// } else if (_config.alphaArmGearbox.encoder->GetEncoderPosition() < 0_rad) {
53-
// _pidWom.SetSetpoint(_encoderSetpoint);
54-
// _setAlphaArmVoltage =
55-
// _pidWom.Calculate(_config.alphaArmGearbox.encoder->GetEncoderPosition(), dt, 0.0_V);
56-
// _table->GetEntry("Demand").SetDouble(_setAlphaArmVoltage.value());
57-
_setAlphaArmVoltage = 0_V;
58-
} else {
59-
_pidWom.SetSetpoint(_encoderSetpoint);
60-
_setAlphaArmVoltage =
61-
-_pidWom.Calculate(-_config.alphaArmGearbox.encoder->GetEncoderPosition(), dt, 0.0_V);
62-
// _pidWom.Reset();
63-
// _encoderSetpoint = _config.alphaArmGearbox.encoder->GetEncoderPosition();
64-
// _setAlphaArmVoltage = _controlledRawVoltage;
65-
}
66-
} else {
67-
_pidWom.Reset();
68-
_encoderSetpoint = -_config.alphaArmGearbox.encoder->GetEncoderPosition();
69-
_setAlphaArmVoltage = _controlledRawVoltage;
70-
}
71-
} else {
72-
_pidWom.Reset();
73-
_encoderSetpoint = -_config.alphaArmGearbox.encoder->GetEncoderPosition();
74-
_setAlphaArmVoltage = _controlledRawVoltage;
75-
76-
if (std::abs(_controlledRawVoltage.value()) > 0) {
77-
_startingPos = -_config.alphaArmGearbox.encoder->GetEncoderPosition();
78-
started = true;
79-
}
80-
}
81-
} break;
82-
case AlphaArmState::kSpeakerAngle:
83-
_stateName = "Speaker Angle";
84-
// _pidWom.SetSetpoint(_goal);
85-
// _setAlphaArmVoltage = _pidWom.Calculate(_config.alphaArmGearbox.encoder->GetEncoderPosition(), dt,
86-
// 0_V);
87-
break;
88-
case AlphaArmState::kStowed:
89-
_stateName = "Stowed";
90-
// _pidWom.SetSetpoint(_goal);
91-
// _setAlphaArmVoltage = _pidWom.Calculate(_config.alphaArmGearbox.encoder->GetEncoderPosition(), dt,
92-
// 0_V);
93-
break;
34+
case AlphaArmState::kReverseWrist:
35+
_config.wristGearbox.motorController->SetVoltage(-3_V);
36+
_setWristVoltage = -3_V;
9437
default:
95-
_stateName = "Error";
9638
std::cout << "oops, wrong state" << std::endl;
9739
break;
9840
}
99-
std::cout << " ARM POSITION: " << _config.alphaArmGearbox.encoder->GetEncoderPosition().value()
100-
<< std::endl;
101-
// std::cout << "OUTPUT VOLTAGE: " << _setAlphaArmVoltage.value() << std::endl;
41+
// transmission translate
42+
// _config.armGearBox.motorController->SetVoltage(setAlphaArmVoltage);
43+
// _config.alphaArmGearbox.motorController->SetVoltage(setAlphaArmVoltage);
44+
// _config.wristGearbox.motorController->SetVoltage(setWristVoltage);
10245
_config.alphaArmGearbox.motorController->SetVoltage(_setAlphaArmVoltage);
46+
_config.wristGearbox.motorController->SetVoltage(_setWristVoltage);
47+
48+
// _config.wristGearbox.motorController->SetVoltage(_setVoltage);
10349
}
10450

10551
void AlphaArm::SetState(AlphaArmState state) {
10652
_state = state;
10753
}
10854

109-
void AlphaArm::SetGoal(units::radian_t goal) {
110-
_goal = goal;
111-
}
55+
// void AlphaArm::SetRaw(units::volt_t voltage){
56+
// _rawArmVoltage = voltage;
57+
// _rawWristVoltage = voltage;
58+
// }
11259

11360
void AlphaArm::SetArmRaw(units::volt_t voltage) {
114-
std::cout << "VOLTAGE: " << voltage.value() << std::endl;
11561
_rawArmVoltage = voltage;
11662
}
11763

118-
void AlphaArm::setControllerRaw(units::volt_t voltage) {
119-
_controlledRawVoltage = voltage;
64+
void AlphaArm::setWristRaw(units::volt_t voltage) {
65+
_rawWristVoltage = voltage;
12066
}

src/main/cpp/AlphaArmBehaviour.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ AlphaArmManualControl::AlphaArmManualControl(AlphaArm* alphaArm, frc::XboxContro
1212
}
1313

1414
void AlphaArmManualControl::OnTick(units::second_t dt) {
15-
if (_codriver->GetStartButtonPressed()) {
15+
if (_codriver->GetXButtonPressed()) {
1616
if (_rawControl == true) {
1717
_rawControl = false;
1818
} else {
@@ -22,9 +22,14 @@ void AlphaArmManualControl::OnTick(units::second_t dt) {
2222

2323
if (_rawControl) {
2424
_alphaArm->SetState(AlphaArmState::kRaw);
25-
_alphaArm->SetArmRaw(_codriver->GetRightY() * 12_V);
25+
_alphaArm->SetArmRaw(_codriver->GetRightY() * 6_V);
26+
_alphaArm->setWristRaw(_codriver->GetLeftY() * -6_V);
2627
} else {
27-
_alphaArm->SetState(AlphaArmState::kAmpAngle);
28-
_alphaArm->setControllerRaw(wom::deadzone(_codriver->GetRightY()) * 12_V);
28+
if (_codriver->GetRightBumperPressed()) {
29+
_alphaArm->SetState(AlphaArmState::kForwardWrist);
30+
}
31+
if (_codriver->GetLeftBumperPressed()) {
32+
_alphaArm->SetState(AlphaArmState::kReverseWrist);
33+
}
2934
}
3035
}

0 commit comments

Comments
 (0)