forked from CurtinFRC/2024-Crescendo
-
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.
Started auto, merged subsystems to auto
- Loading branch information
Showing
9 changed files
with
176 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright (c) 2023-2024 CurtinFRC | ||
// Open Source Software, you can modify it according to the terms | ||
// of the MIT License at the root of this project | ||
|
||
#include "AlphaArm.h" | ||
|
||
AlphaArm::AlphaArm(AlphaArmConfig config) : _config(config) {} | ||
|
||
void AlphaArm::OnUpdate(units::second_t dt) { | ||
switch (_state) { | ||
case AlphaArmState::kIdle: | ||
// transmission translate | ||
_config.alphaArmGearbox.motorController->SetVoltage(0_V); | ||
_config.wristGearbox.motorController->SetVoltage(0_V); | ||
|
||
break; | ||
case AlphaArmState::kRaw: | ||
setAlphaArmVoltage = _armVoltage; | ||
break; | ||
default: | ||
std::cout << "oops, wrong state" << std::endl; | ||
break; | ||
} | ||
// transmission translate | ||
// _config.armGearBox.motorController->SetVoltage(setAlphaArmVoltage); | ||
_config.alphaArmGearbox.motorController->SetVoltage(setAlphaArmVoltage); | ||
_config.wristGearbox.motorController->SetVoltage(setWristVoltage); | ||
} | ||
|
||
void AlphaArm::SetState(AlphaArmState state) { | ||
_state = state; | ||
} | ||
|
||
void AlphaArm::SetRaw(units::volt_t voltR) { | ||
_voltR = voltR; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (c) 2023-2024 CurtinFRC | ||
// Open Source Software, you can modify it according to the terms | ||
// of the MIT License at the root of this project | ||
|
||
#include "Behaviours/AlphaArmBehaviour.h" | ||
|
||
#include <frc/XboxController.h> | ||
|
||
AlphaArmManualControl::AlphaArmManualControl(AlphaArm* alphaArm, frc::XboxController* codriver) | ||
: _alphaArm(alphaArm), _codriver(codriver) { | ||
Controls(alphaArm); | ||
} | ||
|
||
void AlphaArmManualControl::OnTick(units::second_t dt) { | ||
if (_codriver->GetXButtonPressed()) { | ||
if (_rawControl == true) { | ||
_rawControl = false; | ||
} else { | ||
_rawControl = true; | ||
} | ||
} | ||
|
||
if (_rawControl) { | ||
_alphaArm->SetState(AlphaArmState::kRaw); | ||
// mess around with _rightStick later | ||
_alphaArm->SetRaw(_codriver->GetRightY() * 2_V); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright (c) 2023-2024 CurtinFRC | ||
// Open Source Software, you can modify it according to the terms | ||
// of the MIT License at the root of this project | ||
|
||
#pragma once | ||
#include <frc/DigitalInput.h> | ||
|
||
#include "Wombat.h" | ||
|
||
struct AlphaArmConfig { | ||
// wom::Gearbox armGearBox; | ||
wom::Gearbox alphaArmGearbox; | ||
wom::Gearbox wristGearbox; | ||
}; | ||
|
||
enum class AlphaArmState { kIdle, kIntakeAngle, kAmpAngle, kSpeakerAngle, kRaw }; | ||
|
||
class AlphaArm : public ::behaviour::HasBehaviour { | ||
public: | ||
explicit AlphaArm(AlphaArmConfig config); | ||
|
||
void OnUpdate(units::second_t dt); | ||
void SetRaw(units::volt_t volt); | ||
void SetState(AlphaArmState state); | ||
|
||
private: | ||
AlphaArmConfig _config; | ||
AlphaArmState _state = AlphaArmState::kIdle; | ||
units::volt_t setAlphaArmVoltage = 0_V; | ||
units::volt_t setWristVoltage = 0_V; | ||
units::volt_t _armVoltage; | ||
units::volt_t _voltR; | ||
}; |
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 |
---|---|---|
@@ -1,17 +1,19 @@ | ||
// #pragma once | ||
#pragma once | ||
|
||
// #include "Wombat.h" | ||
#include "Wombat.h" | ||
|
||
// namespace autos { | ||
// std::shared_ptr<behaviour::Behaviour> Taxi(Drivebase driveBase, Shooter shooter, Mag mag, Intake intake, Arm _arm); | ||
namespace autos { | ||
std::shared_ptr<behaviour::Behaviour> AutoTest(Drivebase driveBase, Shooter shooter, Mag mag, Intake intake, Arm _arm); | ||
|
||
// std::shared_ptr<behaviour::Behaviour> QuadrupleClose(Drivebase driveBase, Shooter shooter, Mag mag, Intake intake, Arm _arm); | ||
// std::shared_ptr<behaviour::Behaviour> Taxi(Drivebase driveBase, Shooter shooter, Mag mag, Intake intake, Arm _arm); | ||
|
||
// std::shared_ptr<behaviour::Behaviour> QuadrupleFar(Drivebase driveBase, Shooter shooter, Mag mag, Intake intake, Arm _arm); | ||
// std::shared_ptr<behaviour::Behaviour> QuadrupleClose(Drivebase driveBase, Shooter shooter, Mag mag, Intake intake, Arm _arm); | ||
|
||
// std::shared_ptr<behaviour::Behaviour> QuadrupleCloseDoubleFar(Drivebase driveBase, Shooter shooter, Mag mag, Intake intake, Arm _arm); | ||
// std::shared_ptr<behaviour::Behaviour> QuadrupleFar(Drivebase driveBase, Shooter shooter, Mag mag, Intake intake, Arm _arm); | ||
|
||
// std::shared_ptr<behaviour::Behaviour> QuadrupleCloseSingleFar(Drivebase driveBase, Shooter shooter, Mag mag, Intake intake, Arm _arm); | ||
// } | ||
// std::shared_ptr<behaviour::Behaviour> QuadrupleCloseDoubleFar(Drivebase driveBase, Shooter shooter, Mag mag, Intake intake, Arm _arm); | ||
|
||
// std::shared_ptr<behaviour::Behaviour> QuadrupleCloseSingleFar(Drivebase driveBase, Shooter shooter, Mag mag, Intake intake, Arm _arm); | ||
} | ||
|
||
|
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,24 @@ | ||
// Copyright (c) 2023-2024 CurtinFRC | ||
// Open Source Software, you can modify it according to the terms | ||
// of the MIT License at the root of this project | ||
|
||
#pragma once | ||
|
||
#pragma once | ||
#include <frc/XboxController.h> | ||
|
||
#include "AlphaArm.h" | ||
#include "Wombat.h" | ||
|
||
class AlphaArmManualControl : public behaviour::Behaviour { | ||
public: | ||
explicit AlphaArmManualControl(AlphaArm* alphaArm, frc::XboxController* codriver); | ||
void OnTick(units::second_t dt); | ||
|
||
private: | ||
AlphaArm* _alphaArm; | ||
frc::XboxController* _codriver; | ||
// units::volt_t _rightStick = ((_codriver->GetRightY()>0.05 || _codriver->GetRightY() < -0.05 | ||
// )?_codriver->GetRightY():0) * 2_V; | ||
bool _rawControl; | ||
}; |
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