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

Color wheel dev #3

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
3913355
initial commit.
erinleonello Feb 6, 2020
03e6a3d
adding rotate to color method
greamy Feb 6, 2020
0eafde2
vaughan, comment out code that won't compile
greamy Feb 8, 2020
74374bd
Added comments to use ColorMatch class
greamy Feb 8, 2020
a361fb9
vaughan - added color matcher code to determine if we are on Red.
greamy Feb 10, 2020
b4d59ac
Vaughan - removed all non color wheel code
slvaughan Feb 12, 2020
1239803
Finishing rotoate to color.
schelcc Feb 13, 2020
cfa311d
Finishing rotoate to color.
erinleonello Feb 13, 2020
cc6d40b
Merge branch 'ColorWheelDev' of https://github.com/Dreadbot/Dreadbots…
schelcc Feb 13, 2020
52d2345
does not compile, trying to fix errors
erinleonello Feb 13, 2020
e43de37
schelcc Feb 18, 2020
6f87b43
color wheel code by Maura and Erin
schelcc Feb 18, 2020
6408eb0
color wheel code by Maura and Erin
schelcc Feb 18, 2020
d0274ef
added print color by Maura and Erin
schelcc Feb 18, 2020
cb104a8
erin - Finished rotate to number
greamy Feb 20, 2020
7a8b50b
erin - added rotate to color code
greamy Feb 20, 2020
b90eb9b
Vaughan, added smart dashboard calls
slvaughan Feb 22, 2020
eb9e4fc
erin and maura Check for correct button and activate actuator
greamy Feb 24, 2020
4296c13
erin and maura speed and sensor changes
greamy Feb 24, 2020
91eac59
maura and erin changed initialization of variables
greamy Feb 28, 2020
fca2ff1
erin and maura solenoid controls and confidence
greamy Feb 29, 2020
dcdf634
erin does not build work in progress
schelcc Mar 3, 2020
f41cb23
erin - builds but not tested
schelcc Mar 5, 2020
96e8709
erin - tested but doesn't work
schelcc Mar 5, 2020
204ee9f
erin - chaged motor identifiers
greamy Mar 9, 2020
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
Prev Previous commit
Next Next commit
Vaughan - removed all non color wheel code
  • Loading branch information
slvaughan committed Feb 12, 2020
commit b4d59ac2409deca821b169a156d7272ba7dd7b25
87 changes: 9 additions & 78 deletions robot/src/main/cpp/Robot.cpp
Original file line number Diff line number Diff line change
@@ -39,32 +39,11 @@
#include <frc/smartdashboard/SmartDashboard.h>

void Robot::RobotInit() {
m_chooser.SetDefaultOption(kAutoNameDefault, kAutoNameDefault);
m_chooser.AddOption(kAutoNameCustom, kAutoNameCustom);
frc::SmartDashboard::PutData("Auto Modes", &m_chooser);
frc::SmartDashboard::PutNumber("Aimpid",0.1);
//frc::SmartDashboard::PutData("Auto Modes", &m_chooser);
//frc::SmartDashboard::PutNumber("Aimpid",0.1);

joystick_1 = new frc::Joystick(kPrimaryDriverJoystickID);
shooter = new Shooter(3,3);//Should have different numbers if your board supports it during testing
//printf("robotcpp joystick_addr = %d \n",joystick_1);
teleopFunctions = new TeleopFunctions(joystick_1, shooter);
//Button assignments

// Unused Variable
// int shooterButton = 1;
intake = new Intake(); //Uses SparkMax motor 3

// Trajectory Test (prints to RioLog)
trajectory_generation_utility = new TrajectoryGenerationUtility();
trajectory_generation_utility->GenerateTestTrajectory();

// Initialize SparkDrive Object using the UltraLord Drivetrain Configuration.
spark_drive = new SparkDrive(new rev::CANSparkMax(kUltraLeftFrontMotorID, rev::CANSparkMax::MotorType::kBrushless),
new rev::CANSparkMax(kUltraRightFrontMotorID, rev::CANSparkMax::MotorType::kBrushless),
new rev::CANSparkMax(kUltraLeftBackMotorID, rev::CANSparkMax::MotorType::kBrushless),
new rev::CANSparkMax(kUltraRightBackMotorID, rev::CANSparkMax::MotorType::kBrushless)
);

colorWheelmotor = new WPI_TalonSRX(1);
colorWheel = new ColorWheel();
}

@@ -90,66 +69,18 @@ void Robot::RobotPeriodic() {}
* make sure to add them to the chooser code above as well.
*/
void Robot::AutonomousInit() {
m_autoSelected = m_chooser.GetSelected();
// m_autoSelected = SmartDashboard::GetString("Auto Selector",
// kAutoNameDefault);
std::cout << "Auto selected: " << m_autoSelected << std::endl;

if (m_autoSelected == kAutoNameCustom) {
// Custom Auto goes here
} else {
// Default Auto goes here
}
}

}

void Robot::AutonomousPeriodic() {
if (m_autoSelected == kAutoNameCustom) {
// Custom Auto goes here
} else {
// Default Auto goes here
}
}

}

void Robot::TeleopInit() {}

void Robot::TeleopPeriodic() {
//teleopFunctions->ShooterFunction();

// need to create sparkdrive above for this code
// spark_drive = new SparkDrive(new rev::CANSparkMax(3, rev::CANSparkMax::MotorType::kBrushless)

std::cout << "Teleop Tick" << std::endl;

double Pid = frc::SmartDashboard::GetNumber("Aimpid",0.1);
//shooter->SetAimHeightPid(Pid);
//std::cout << "pidvalue = " << Pid <<std::endl;
if (joystick_1->GetRawButtonPressed(3)) {
//intake->Start();
shooter->AimHeight(10);
}
if (joystick_1->GetRawButtonPressed(4)) {
shooter->AimHeight(0);
}


//test of intake motor code

if (joystick_1->GetRawButtonPressed(1)) {
//intake->Start();
intake->SetSpeed(100);
}
if (joystick_1->GetRawButtonPressed(2)) {
intake->Stop();
}

// Call SparkDrive::TankDrive() using the drivetrain motors
spark_drive->TankDrive(
joystick_1->GetRawAxis(y_axis),
joystick_1->GetRawAxis(z_axis),
joystick_1->GetRawButton(right_bumper),
joystick_1->GetRawButton(left_bumper)
);

//Call our color wheel class to execute code determining when to count rotations.
colorWheel->RotateToNumber(colorWheelmotor, joystick_1);
}

void Robot::TestPeriodic() {}
26 changes: 2 additions & 24 deletions robot/src/main/include/Robot.h
Original file line number Diff line number Diff line change
@@ -16,11 +16,6 @@

#include "RobotUtilities.h"

#include "SparkDrive.h"
#include "TeleopFunctions.h"
#include "TrajectoryGenerationUtility.h"

#include "Intake.h"
#include "ColorWheel.h"

class Robot : public frc::TimedRobot {
@@ -34,31 +29,14 @@ class Robot : public frc::TimedRobot {
void TestPeriodic() override;

private:
frc::SendableChooser<std::string> m_chooser;
const std::string kAutoNameDefault = "Default";
const std::string kAutoNameCustom = "My Auto";
std::string m_autoSelected;

// Autonomous Functions
TrajectoryGenerationUtility* trajectory_generation_utility;

// INPUTS
frc::Joystick *joystick_1;

// DRIVE
SparkDrive* spark_drive;

TeleopFunctions *teleopFunctions;
Shooter *shooter;

//BUTTONS
int const shooterButton = 1;

// Intake mechanism
Intake* intake;
int const colorWheelButton = 1;

//Color wheel class
WPI_TalonSRX *colorWheelmotor;
ColorWheel* colorWheel;


};