View Single Post
  #10   Spotlight this post!  
Unread 05-04-2016, 11:11
RyanN's Avatar
RyanN RyanN is offline
RyanN
AKA: Ryan Nazaretian
FRC #4901 (Garnet Squadron)
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Columbia, SC
Posts: 1,126
RyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond repute
Re: Victor SP toggling from neutral to forward when enabled

Quote:
Originally Posted by Aventek View Post
When our robot is enabled, one of our victor sp's constantly swaps from neutral to forward.
we have tried:
  • swapping the victor with a new one
  • swapping and reimaging the roboRIO
  • changing the cables to and from victor(power and motor output)
  • swapping PWM location on the roboRIO
This is dumbfounding our team and we have no idea whats up with the ghost motor. The only possibility we have thought of is the code, but we cannot find anything. If anyone could take a look at the code or has any idea what else could be the problem, please comment. This is our repository on GitHub: https://github.com/Aventek/ExarchCode
My best guess, as it seems like a really common issue that I debug, is that you are setting the motor speed in two different places.

What motor is giving you trouble in the code? I have found these:
Code:
public static final int leftRearDrivePWM = 3;//3
public static final int leftFrontDrivePWM = 2;//0
public static final int rightRearDrivePWM = 1;//1 
public static final int rightFrontDrivePWM = 0;//2 
public static final int leftLaunchPWM = 4; 
public static final int rightLaunchPWM = 5;
public static final int liftAnglerPWM = 6;  
public static final int liftAngler2PWM =7;
public static final int launchAnglerPWM = 8;
public static final int intakeArmsPMW = 9;
Looking through your code, I'm placing my bets on the launch motor.

In commands/Launch.java, you're calling Robot.launcher.launch(shootSpeed) and Robot.launcher.intakeControl(0):
Code:
protected void execute() {
		
		// spinning launcher motors
		if (Robot.oi.buttonLaunch.get()) {
			// when lBump is held down run motors for launching
			Robot.launcher.launch(shootSpeed);
			Robot.launcherState = LauncherState.LAUNCH;
		} else if (Robot.oi.buttonIntake.get()) {
			// when rBump is held down run motors for intake
			Robot.launcherState = LauncherState.INTAKE;
			Robot.launcher.launch(loadSpeed);
			Robot.launcher.intakeControl(barSpeed);
			Robot.launcherState = LauncherState.INTAKE;
		} else if (auto){
			Robot.launcher.launch(shootSpeed);
			Robot.launcher.intakeControl(0);
			Robot.launcherState = LauncherState.AUTO;
			
		} else {
			// when neither are held down dont run motors
			Robot.launcher.intakeControl(0);
			Robot.launcher.launch(0);
			Robot.launcherState = LauncherState.STILL;
		}
		
		if(Robot.anglerState != AnglerState.PID){
			// activate angler
			if (Robot.oi.buttonShooterDown.get()) {
				// when B is held down angle launcher down
				Robot.launcher.angleLauncher(motorDownSpeed);
				Robot.anglerState = AnglerState.ANGLING_DOWN;
			} else if (Robot.oi.buttonShooterUp.get()) {
				// when X is held down, angle launcher up
				Robot.launcher.angleLauncher(motorUpSpeed);
				Robot.anglerState = AnglerState.ANGLING_UP;
			} else {
				// stop angling
				Robot.launcher.angleLauncher(0);
				Robot.anglerState = AnglerState.STILL;
			}
		}
		
		//control servo based on state
		if(Robot.servoState == ServoState.RETRACTED){
//			Robot.launcher.servoControl(extendedPosition);
		} else if(Robot.servoState == ServoState.EXTENDED){
//			Robot.launcher.servoControl(retractedPosition);
		}

	}
Take a look at the subsystem code for those two commands in subsystem/Launcher.java:
Code:
	public void intakeControl(double speed){
		
		leftLaunch.set(-.4);
		rightLaunch.set(-.4);
		intakeBar.set(speed);
	
	}

	// sets launch motors to spin and then set servo to firing position
	public void launch(double speed) {

		// setting launch motors
		leftLaunch.set(speed);
		rightLaunch.set(speed);

	}
You're setting the speed in two different places. That will cause issues.
__________________
Garnet Squadron
FRC 4901
Controls Mentor
@rnazaretian

Previous mentor and student from Team Fusion, FRC 364
Reply With Quote