Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
17d2885
added hardware files
Jan 12, 2023
b8d2f6e
changed names of motors
Jan 12, 2023
b64846a
defined
Jan 13, 2023
d0d54e7
labeled buttons
Jan 13, 2023
2a914ec
arm sw, hw, cpp, and IO
Jan 14, 2023
ce32b48
changed file names
AbbeySieg Jan 14, 2023
dcc6c2d
renamed more files
AbbeySieg Jan 14, 2023
e277766
added swerve drive to branch
AbbeySieg Jan 14, 2023
72adfe6
changed hw, actua, and sen names
Jan 16, 2023
7db2094
changed names
Jan 16, 2023
e9bf872
it's being weird
Jan 16, 2023
db16ef7
test commit
X-EX3-X Jan 21, 2023
91016a4
functions added I think
X-EX3-X Jan 21, 2023
c15cb65
last changes for 1-21-23, added parameter,util
X-EX3-X Jan 21, 2023
b7b9314
I update the hardware and software interfaces
Jan 28, 2023
8e06a1e
I changed the software and hardware interfaces and I defined function…
Jan 28, 2023
c102f34
Merge branch 'feat/actual_claw' of https://github.com/Team-OKC-Roboti…
Jan 28, 2023
d43dd10
fleshed out claw subsystem
Jan 28, 2023
df6ec31
Merge branch 'master' into feat/actual_claw
Jan 28, 2023
f8333d7
IT WORKSSSS EVERYTHING WORKSSSSSSSSSSSSSSS
Jan 28, 2023
b2d58fb
fixed include error, added Reset() to claw
Jan 28, 2023
69e94f8
The changes Justin asked for
X-EX3-X Feb 13, 2023
4fa5a99
final changes i think
X-EX3-X Feb 17, 2023
3e6ad25
fixed errors
X-EX3-X Feb 20, 2023
9203b9e
Merge branch 'master' into feat/actual_claw
X-EX3-X Feb 20, 2023
0ee8017
final changes hopefully
X-EX3-X Feb 20, 2023
dfabc38
changing the #include
X-EX3-X Feb 21, 2023
b705eca
solving the case errors
X-EX3-X Feb 21, 2023
3a3b2f5
removed claw files for fix
X-EX3-X Feb 21, 2023
b3e2f7a
added files back
X-EX3-X Feb 21, 2023
ec4a031
change backwards slash to a forwards slash because maybe that's makin…
danielbrownmsm Feb 21, 2023
4ae2d05
fix backward->forward slash in ClawIO.cpp
danielbrownmsm Feb 21, 2023
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
1 change: 1 addition & 0 deletions src/main/cpp/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ namespace TeamOKC {
return true;
}
} // namespace TeamOKC

30 changes: 30 additions & 0 deletions src/main/cpp/io/ClawIO.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

#include "io/ClawIO.h"

void ClawIO::Periodic() {
// Process all the inputs and outputs to/from high level software.
VOKC_CALL(ProcessIO());
}

void ClawIO::SimulationPeriodic() {
// SimulationPeriodic
}

bool ClawIO::ProcessIO() {
OKC_CHECK(sw_interface_ != nullptr);
OKC_CHECK(hw_interface_ != nullptr);
OKC_CHECK(hw_interface_->claw_open_and_close_encoder != nullptr);

// Set the software outputs
// If the encoder should be reset, reset it
if (sw_interface_->reset_claw_open_and_close) {
hw_interface_->claw_open_and_close_encoder->SetPosition (0);
// Lower the encoder reset flag
sw_interface_->reset_claw_open_and_close = false;
}
hw_interface_->claw_open_and_close_motor->Set(sw_interface_->claw_open_and_close_power);
sw_interface_->encoder_reading = hw_interface_->claw_open_and_close_encoder->GetPosition();

return true;
}

27 changes: 27 additions & 0 deletions src/main/cpp/subsystems/Claw.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include "subsystems/Claw.h"

bool Claw::Init(){
return true;
}

bool Claw::ResetPositionEncoder(){
return true;
}
bool Claw::ResetPositionPID(){
return true;
}
bool Claw::SetPosition(){
// SetPosition (30); //cone
// SetPosition (0); //close
// SetPosition (50);//cube
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, really this PR has no functionality, but at least getting the framework is something

return true;
}
bool Claw::Reset(){
return true;
}
void Claw::Periodic(){
return;
}
void Claw::SimulationPeriodic(){
return;
}
1 change: 1 addition & 0 deletions src/main/include/Parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ namespace RobotParams {
return true;
}
} // namespace RobotParams

1 change: 0 additions & 1 deletion src/main/include/RobotContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
#include "commands/arm/ManualArmCommand.h"



/**
* This class is where the bulk of the robot should be declared. Since
* Command-based is a "declarative" paradigm, very little robot logic should
Expand Down
5 changes: 5 additions & 0 deletions src/main/include/hardware/Actuators.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <memory>
#include <rev/CANSparkMax.h>
#include "frc/DigitalInput.h"



Expand Down Expand Up @@ -44,4 +45,8 @@ typedef struct actuators_t {
std::unique_ptr<rev::CANSparkMax> arm_up_motor;
std::unique_ptr<rev::CANSparkMax> arm_extend_motor;

// Claw things
std::unique_ptr<rev::CANSparkMax> claw_motor;
std::unique_ptr<frc::DigitalInput> claw_IR_sensor;

} Actuators;
1 change: 0 additions & 1 deletion src/main/include/hardware/Hardware.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once


#include <frc/motorcontrol/MotorControllerGroup.h>

#include "hardware/Actuators.h"
Expand Down
13 changes: 11 additions & 2 deletions src/main/include/hardware/Sensors.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@
#include <memory>

#include "AHRS.h"
#include "frc/AnalogEncoder.h"

#include <frc/DigitalInput.h>
#include <rev/RelativeEncoder.h>
#include "frc/AnalogEncoder.h"

// == sensor ports ==
#define DEPLOY_LIMIT_SWITCH 2
#define RETRACTED_LIMIT_SWITCH 3

#define BALL_DETECTOR 9

// == sensor ports ==
#define LEFT_FRONT_STEER_ENCODER 0
Expand All @@ -16,6 +24,7 @@ typedef struct sensors_t {
// navX IMU
std::unique_ptr<AHRS> ahrs;


// swerve drive drive encoders
std::unique_ptr<rev::SparkMaxRelativeEncoder> left_front_drive_encoder;
std::unique_ptr<rev::SparkMaxRelativeEncoder> left_back_drive_encoder;
Expand All @@ -37,4 +46,4 @@ typedef struct sensors_t {
// arm encoders
std::unique_ptr<rev::SparkMaxRelativeEncoder> arm_lift_encoder;

} Sensors;
} Sensors;
52 changes: 52 additions & 0 deletions src/main/include/io/ClawIO.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#pragma once

#include <memory>

#include <frc/motorcontrol/MotorControllerGroup.h>
#include <frc2/command/SubsystemBase.h>
#include <frc/DigitalInput.h>
#include <rev/CANSparkMax.h>

#include "Utils.h"


typedef struct claw_config_t {

} ClawConfig;

typedef struct claw_hardware_interface_t {
rev::CANSparkMax *const claw_open_and_close_motor;
rev::SparkMaxRelativeEncoder *const claw_open_and_close_encoder;
} ClawHardware;

typedef struct claw_software_interface_t {

// actuator outputs
double claw_open_and_close_power;
double encoder_reading;
bool reset_claw_open_and_close;
} ClawSoftware;

class ClawIO : public frc2::SubsystemBase {
public:
ClawIO(ClawHardware *hw_interface,
ClawSoftware *sw_interface)
: hw_interface_(hw_interface), sw_interface_(sw_interface) {}

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

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

bool ProcessIO();

private:
ClawHardware *const hw_interface_;
ClawSoftware *const sw_interface_;
};
39 changes: 39 additions & 0 deletions src/main/include/subsystems/Claw.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// 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>

class Claw : public frc2::SubsystemBase {
public:
Claw();
~Claw();

bool Init();

bool ResetPositionEncoder();
bool ResetPositionPID();

bool SetPosition();
bool Reset();

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

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

private:
// Components (e.g. motor controllers and sensors) should generally be
// declared private and exposed only through public methods.

};