Skip to content

Commit

Permalink
Feeder skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
r4stered committed Sep 5, 2024
1 parent 57f4807 commit d5fe07f
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/main/cpp/RobotContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ IntakeSubsystem &RobotContainer::GetIntakeSubsystem() {
return intakeSubsystem;
}

FeederSubsystem &RobotContainer::GetFeederSubsystem() {
return feederSubsystem;
}

str::Vision &RobotContainer::GetVision() { return vision; }

str::NoteVisualizer &RobotContainer::GetNoteVisualizer() {
Expand Down
16 changes: 16 additions & 0 deletions src/main/cpp/subsystems/FeederSubsystem.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.

#include "subsystems/FeederSubsystem.h"
#include <frc/smartdashboard/SmartDashboard.h>

FeederSubsystem::FeederSubsystem() {
SetName("FeederSubsystem");
//ConfigureFeederMotor(consts::intake::physical::INVERT_MOTOR, consts::intake::physical::INTAKE_RATIO, consts::intake::current_limits::SUPPLY_CURRENT_LIMIT, consts::intake::current_limits::STATOR_CURRENT_LIMIT);
//ConfigureMotorSignals();
frc::SmartDashboard::PutData(this);
}

// This method will be called once per scheduler run
void FeederSubsystem::Periodic() {}
2 changes: 1 addition & 1 deletion src/main/deploy/commit.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
30cedb8
57f4807
6 changes: 4 additions & 2 deletions src/main/include/Autos.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
#include <subsystems/ShooterSubsystem.h>
#include <subsystems/SwerveSubsystem.h>
#include <subsystems/IntakeSubsystem.h>
#include <subsystems/FeederSubsystem.h>

class Autos {
public:
explicit Autos(SwerveSubsystem &swerveSub, ShooterSubsystem &shooterSub, IntakeSubsystem &intakeSub)
: swerveSub(swerveSub), shooterSub(shooterSub), intakeSub(intakeSub) {
explicit Autos(SwerveSubsystem &swerveSub, ShooterSubsystem &shooterSub, IntakeSubsystem &intakeSub, FeederSubsystem &feederSub)
: swerveSub(swerveSub), shooterSub(shooterSub), intakeSub(intakeSub), feederSub(feederSub) {
pathplanner::NamedCommands::registerCommand(
"Shoot", frc2::cmd::Print("Shooting Note"));

Expand Down Expand Up @@ -54,6 +55,7 @@ class Autos {
SwerveSubsystem &swerveSub;
ShooterSubsystem &shooterSub;
IntakeSubsystem &intakeSub;
FeederSubsystem &feederSub;

frc2::CommandPtr selectCommand{frc2::cmd::None()};
};
5 changes: 4 additions & 1 deletion src/main/include/RobotContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "str/NoteVisualizer.h"
#include "str/Vision.h"
#include "subsystems/SwerveSubsystem.h"
#include "subsystems/FeederSubsystem.h"

class RobotContainer {
public:
Expand All @@ -21,6 +22,7 @@ class RobotContainer {
SwerveSubsystem &GetSwerveSubsystem();
ShooterSubsystem &GetShooterSubsystem();
IntakeSubsystem &GetIntakeSubsystem();
FeederSubsystem &GetFeederSubsystem();
str::Vision &GetVision();
str::NoteVisualizer &GetNoteVisualizer();

Expand All @@ -31,8 +33,9 @@ class RobotContainer {
SwerveSubsystem swerveSubsystem;
ShooterSubsystem shooterSubsystem;
IntakeSubsystem intakeSubsystem;
FeederSubsystem feederSubsystem;
str::Vision vision;
str::NoteVisualizer noteVisualizer;

Autos autos{swerveSubsystem, shooterSubsystem, intakeSubsystem};
Autos autos{swerveSubsystem, shooterSubsystem, intakeSubsystem, feederSubsystem};
};
46 changes: 46 additions & 0 deletions src/main/include/constants/FeederConstants.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Copyright (c) FRC 2053.
// Open Source Software; you can modify and/or share it under the terms of
// the MIT License file in the root of this project

#pragma once

#include <frc/system/plant/DCMotor.h>
#include <units/base.h>
#include <units/velocity.h>
#include <wpi/interpolating_map.h>
#include <units/dimensionless.h>
#include <units/moment_of_inertia.h>

#include "str/Gains.h"

namespace consts {
namespace feeder {
namespace can_ids {
inline constexpr int FEEDER = 18;
} // namespace can_ids

namespace current_limits {
inline constexpr units::ampere_t SUPPLY_CURRENT_LIMIT = 60_A;
inline constexpr units::ampere_t STATOR_CURRENT_LIMIT = 180_A;
} // namespace current_limits

namespace physical {

inline constexpr bool INVERT_MOTOR = false;

inline constexpr units::scalar_t INTAKE_RATIO = (24.0 / 16.0);

inline constexpr frc::DCMotor INTAKE_MOTOR = frc::DCMotor::Falcon500(1);

inline constexpr units::meter_t WHEEL_RADIUS = 1_in;

//From onshape doc
inline constexpr units::kilogram_square_meter_t INTAKE_MOI = 12.350445 * 1_in * 1_in * 1_lb;
} // namespace physical

namespace gains {
inline constexpr units::volt_t NOTE_FEED_VOLTAGE = 10_V;
inline constexpr units::volt_t NOTE_EJECT_VOLTAGE = -5_V;
}
} // namespace intake
} // namespace consts
22 changes: 22 additions & 0 deletions src/main/include/subsystems/FeederSubsystem.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.

#pragma once

#include <frc2/command/SubsystemBase.h>
#include <ctre/phoenix6/TalonFX.hpp>
#include <constants/FeederConstants.h>

class FeederSubsystem : public frc2::SubsystemBase {
public:
FeederSubsystem();

/**
* Will be called periodically whenever the CommandScheduler runs.
*/
void Periodic() override;

private:
ctre::phoenix6::hardware::TalonFX feederMotor{consts::feeder::can_ids::FEEDER, "*"};
};

0 comments on commit d5fe07f

Please sign in to comment.