Skip to content
This repository was archived by the owner on Dec 13, 2023. It is now read-only.

switched roll and pitch #30

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 7 additions & 7 deletions src/main/java/frc/robot/commands/SmartClimb.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,18 @@ public void step(GenericRobot robot) {
climbPowerPort = 0.6;
climbPowerStarboard = 0.6;

if (-robot.getPitch()> rollTolerance)
if (robot.getRoll()> rollTolerance)
{
climbPowerStarboard += 0.2;
}
if (-robot.getPitch() < -rollTolerance)
if (robot.getRoll() < -rollTolerance)
{
climbPowerPort += 0.2;
}

encoderPort = robot.getClimberPortTicks();
encoderStarboard = robot.getClimberStarboardTicks();
rollTrim = -robot.getPitch();
rollTrim = robot.getRoll();
PIDPortHold.reset();
PIDStarboardHold.reset();
PIDRollHold.reset();
Expand All @@ -100,7 +100,7 @@ public void hold(GenericRobot robot){

double correctionStarboard = PIDStarboardHold.calculate(robot.getClimberStarboardTicks() - encoderStarboard);

double rollCorrection = PIDRollHold.calculate((-robot.getPitch()) - rollTrim);
double rollCorrection = PIDRollHold.calculate((robot.getRoll()) - rollTrim);

/*
rollTrim, encoderPort and encoderStarboard represent the state that we are trying to hold.
Expand All @@ -110,12 +110,12 @@ public void hold(GenericRobot robot){
If you are listing to port, lower the stb side and hold the port side.
*/

if (Math.abs(-robot.getPitch() - rollTrim)>rollTolerance) {
if (-robot.getPitch() > rollTrim) {
if (Math.abs(robot.getRoll() - rollTrim)>rollTolerance) {
if (robot.getRoll() > rollTrim) {
robot.setClimbVerticalPortPower(-rollCorrection);
robot.setClimbVerticalStarboardPower(correctionStarboard);
encoderPort = robot.getClimberPortTicks();
} else if (-robot.getPitch() < rollTrim) {
} else if (robot.getRoll() < rollTrim) {
robot.setClimbVerticalStarboardPower(rollCorrection);
robot.setClimbVerticalPortPower(correctionPort);
encoderStarboard = robot.getClimberStarboardTicks();
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/frc/robot/genericrobot/Falcon.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,11 @@ public double getYaw() {

@Override
public double getPitch() {
return navx.getPitch();
return navx.getRoll();
}

@Override
public double getRoll() {
return navx.getRoll();
}
public double getRoll() { return -navx.getPitch(); }

@Override
public void resetAttitude() {
Expand Down