Skip to content

Commit

Permalink
Merge pull request #561 from marcelosin1010/main
Browse files Browse the repository at this point in the history
marcelo's preseason
  • Loading branch information
truher authored Nov 26, 2024
2 parents 35aa06c + e34c1bd commit 07ba885
Show file tree
Hide file tree
Showing 5 changed files with 135 additions and 111 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,4 +204,14 @@ public void periodic() {
m_mechanism.periodic();
m_encoder.periodic();
}

public void setProfile(Profile100 profile) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setProfile'");
}

public void setSpeed(double input2) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'setSpeed'");
}
}
12 changes: 9 additions & 3 deletions studies/temp/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,24 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [

{
"type": "java",
"name": "Main",
"request": "launch",
"mainClass": "frc.robot.Main",
"projectName": "temp"
},
{
"type": "wpilib",
"name": "WPILib Desktop Debug",
"request": "launch",
"desktop": true,
"desktop": true
},
{
"type": "wpilib",
"name": "WPILib roboRIO Debug",
"request": "launch",
"desktop": false,
"desktop": false
}
]
}
71 changes: 61 additions & 10 deletions studies/temp/src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
package frc.robot;

import java.io.IOException;


import org.team100.lib.config.Feedforward100;
import org.team100.lib.config.Identity;
import org.team100.lib.config.PIDConstants;
import org.team100.lib.experiments.Experiment;
import org.team100.lib.experiments.Experiments;
import org.team100.lib.framework.TimedRobot100;
import org.team100.lib.logging.JvmLogger;
import org.team100.lib.logging.Level;
import org.team100.lib.logging.Logging;
import org.team100.lib.motor.Falcon6Motor;
import org.team100.lib.motor.MotorPhase;
import org.team100.lib.logging.LoggerFactory;
import org.team100.lib.logging.LoggerFactory.BooleanLogger;
import org.team100.lib.logging.LoggerFactory.DoubleLogger;
Expand All @@ -20,6 +24,8 @@
import edu.wpi.first.networktables.NetworkTableInstance;
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.RobotController;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.XboxController;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj.util.WPILibVersion;
import edu.wpi.first.wpilibj2.command.CommandScheduler;
Expand All @@ -37,7 +43,11 @@ public class Robot extends TimedRobot100 {
private final DoubleLogger m_log_voltage;
private final JvmLogger m_jvmLogger;

private RobotContainer m_robotContainer;
private final Logging logging = Logging.instance();
private final Falcon6Motor falconMotor1;
private final Falcon6Motor falconMotor2;
private final Timer timer;
XboxController controller = new XboxController(0);

public Robot() {
LoggerFactory dsLog = m_robotLogger.child("DriverStation");
Expand All @@ -49,6 +59,13 @@ public Robot() {
m_log_key_list_size = m_robotLogger.intLogger(Level.TRACE, "key list size");
m_log_voltage = m_robotLogger.doubleLogger(Level.TRACE, "voltage");
m_jvmLogger = new JvmLogger(m_robotLogger);

LoggerFactory parent = logging.rootLogger;
falconMotor1 = new Falcon6Motor(parent, 11, MotorPhase.FORWARD, 40, 40, new PIDConstants(0.1),
Feedforward100.makeShooterFalcon6());
falconMotor2 = new Falcon6Motor(parent, 18, MotorPhase.FORWARD, 40, 40, new PIDConstants(0.1),
Feedforward100.makeShooterFalcon6());
timer = new Timer();
}

@Override
Expand All @@ -66,13 +83,6 @@ public void robotInit() {
// log what the scheduler is doing
SmartDashboard.putData(CommandScheduler.getInstance());

try {
m_robotContainer = new RobotContainer(this);
} catch (IOException e) {
throw new IllegalStateException("Robot Container Instantiation Failed", e);
}


NetworkTableInstance.getDefault().startServer();

// DataLogManager.start();
Expand Down Expand Up @@ -123,6 +133,8 @@ public void disabledPeriodic() {

@Override
public void autonomousInit() {
timer.start();

}

@Override
Expand Down Expand Up @@ -155,6 +167,27 @@ public void close() {

@Override
public void autonomousPeriodic() {
if (timer.get() < 1) {
falconMotor1.setDutyCycle(0.1); // forward
falconMotor2.setDutyCycle(-0.1); // forward

} else {
falconMotor1.setDutyCycle(0);
falconMotor2.setDutyCycle(0);
}
if (timer.get() < 2 && timer.get() > 1) { // backward
falconMotor1.setDutyCycle(-0.1);
falconMotor2.setDutyCycle(0.1);
} else if (timer.get() < 3 && timer.get() > 2) { // right
falconMotor1.setDutyCycle(0.1);
falconMotor2.setDutyCycle(0.1);

} else if (timer.get() < 4 && timer.get() > 3) {
falconMotor1.setDutyCycle(-0.1);
falconMotor2.setDutyCycle(-0.1);
} else
falconMotor1.setDutyCycle(0);
falconMotor2.setDutyCycle(0);
m_log_mode.log(() -> "autonomous");
}

Expand All @@ -165,7 +198,25 @@ public void simulationPeriodic() {

@Override
public void teleopPeriodic() {
m_robotContainer.teleopPeriodic();
double input2 = controller.getLeftY();
falconMotor1.setDutyCycle(input2);
double input3 = controller.getRightY();
falconMotor2.setDutyCycle(-1 * input3);

if (controller.getLeftBumper()) {
falconMotor1.setDutyCycle(0.5);
}
if (controller.getRightBumper()) {
falconMotor2.setDutyCycle(-0.5);
}

if (controller.getLeftTriggerAxis() != 0) {
falconMotor1.setDutyCycle(-0.5);
}
if (controller.getRightTriggerAxis() != 0) {
falconMotor2.setDutyCycle(0.5);
}

m_log_mode.log(() -> "teleop");
m_log_voltage.log(RobotController::getBatteryVoltage);
}
Expand Down
98 changes: 0 additions & 98 deletions studies/temp/src/main/java/frc/robot/RobotContainer.java

This file was deleted.

55 changes: 55 additions & 0 deletions studies/temp/vendordeps/ReduxLib_2024.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"fileName": "ReduxLib_2024.json",
"name": "ReduxLib",
"version": "2024.3.1",
"frcYear": 2024,
"uuid": "151ecca8-670b-4026-8160-cdd2679ef2bd",
"mavenUrls": [
"https://maven.reduxrobotics.com/"
],
"jsonUrl": "https://frcsdk.reduxrobotics.com/ReduxLib_2024.json",
"javaDependencies": [
{
"groupId": "com.reduxrobotics.frc",
"artifactId": "ReduxLib-java",
"version": "2024.3.1"
}
],
"jniDependencies": [
{
"groupId": "com.reduxrobotics.frc",
"artifactId": "ReduxLib-driver",
"version": "2024.3.1",
"isJar": false,
"skipInvalidPlatforms": true,
"validPlatforms": [
"linuxathena",
"linuxx86-64",
"linuxarm32",
"linuxarm64",
"osxuniversal",
"windowsx86-64"
]
}
],
"cppDependencies": [
{
"groupId": "com.reduxrobotics.frc",
"artifactId": "ReduxLib-cpp",
"version": "2024.3.1",
"libName": "ReduxLib-cpp",
"headerClassifier": "headers",
"sourcesClassifier": "sources",
"sharedLibrary": true,
"skipInvalidPlatforms": true,
"binaryPlatforms": [
"linuxathena",
"linuxx86-64",
"linuxarm32",
"linuxarm64",
"osxuniversal",
"windowsx86-64"
]
}
]
}

0 comments on commit 07ba885

Please sign in to comment.