It is actually 24 volts according to the manufacture's manual that we printed- don't mean to be a know-it-all.
Anyways, we can't even get the part to move without the sensor. The Jag code all looks normal to me.
We tested and the jag will operate with BDC-Comm.
Anyone have a clue what's wrong with our code?
Code:
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.Jaguar;
import edu.wpi.first.wpilibj.Compressor;
import edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first.wpilibj.DriverStationLCD;
import edu.wpi.first.wpilibj.Gyro;
import edu.wpi.first.wpilibj.Solenoid;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.IterativeRobot;
/**
* The VM is configured to automatically run this class, and to call the
* functions corresponding to each mode, as described in the IterativeRobot
* documentation. If you change the name of this class or the package after
* creating this project, you must also update the manifest file in the resource
* directory.
*/
public class RobotTemplate extends IterativeRobot {
Joystick driver = new Joystick(1);
Joystick operator = new Joystick(2);
Jaguar claw = new Jaguar(6);
Jaguar frontLeft = new Jaguar(2);
Jaguar rearLeft = new Jaguar(3);
Jaguar frontRight = new Jaguar(4);
Jaguar rearRight = new Jaguar(5);
Jaguar defender = new Jaguar(10);
Compressor comp = new Compressor(1, 1);//Constructor Order: Digitial I/O, Relay
Solenoid boomup = new Solenoid(7);
Solenoid boomdown = new Solenoid(1);
RobotDrive drive = new RobotDrive(frontLeft, rearLeft, frontRight, rearRight);
Gyro gyro = new Gyro(1);
//Timer time = new Timer();
DigitalInput photoswitch = new DigitalInput(2);
DriverStationLCD dataPrinter = DriverStationLCD.getInstance();
boolean didAuto = false;
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
public void robotInit() {
gyro.reset();
comp.start();
drive.setSafetyEnabled(false);
/* drive.setInvertedMotor(RobotDrive.MotorType.kFrontLeft, false);
drive.setInvertedMotor(RobotDrive.MotorType.kRearLeft, false);
drive.setInvertedMotor(RobotDrive.MotorType.kFrontRight, false);
drive.setInvertedMotor(RobotDrive.MotorType.kRearRight, false);*/
}
/**
* This function is called periodically during autonomous
*/
public void autonomousPeriodic() {
log("didAuto= " + didAuto);
if (didAuto) {
return;//after value is set to true, the code will stop executing.
}
final double autoSpeed = 1.0;
final long autoTime = 5000; //mili seconds
long start = System.currentTimeMillis();
while (true) {
drive.tankDrive(autoSpeed, autoSpeed);
//frontLeft.set(autoSpeed);//invert these if it drives backwards
//rearLeft.set(autoSpeed);
//frontRight.set(-autoSpeed);//Experimental
//rearRight.set(-autoSpeed);//inversion of input will drive forward (we hope!)
if ((System.currentTimeMillis() - start) > autoTime) {
break;
}
}//moves robot straight forward for five seconds
// log("Time start " + System.currentTimeMillis());
// Timer.delay(autoTime);
// log("Timer stop " + System.currentTimeMillis());
claw.set(-.7);//drops claw
didAuto = true;//prevents autonomous from running again.
}
/**
* This function is called periodically during operator control
*/
public void teleopPeriodic() {
//final double axisOutput = driver.getRawAxis(4);
drive.mecanumDrive_Cartesian(driver.getRawAxis(1), driver.getRawAxis(3), -driver.getRawAxis(2), gyro.getAngle());
/*if (driver.getRawAxis(4) < -0.1) {
//to strafe left
log("I'm going left " + axisOutput);
frontLeft.set(-driver.getRawAxis(4));
rearLeft.set(driver.getRawAxis(4));
frontRight.set(driver.getRawAxis(4));
rearRight.set(-driver.getRawAxis(4));
} else if (driver.getRawAxis(4) > 0.1) {
//to strafe right
log("I'm going right " + axisOutput);
frontLeft.set(driver.getRawAxis(4));
rearLeft.set(-driver.getRawAxis(4));
frontRight.set(-driver.getRawAxis(4));
rearRight.set(driver.getRawAxis(4));
} else if(driver.getRawAxis(5) > 0){
frontLeft.set(driver.getRawAxis(5));
rearLeft.set(driver.getRawAxis(5));
frontRight.set(driver.getRawAxis(5));
rearRight.set(driver.getRawAxis(5));
}
else if(driver.getRawAxis(5) < 0){
frontLeft.set(driver.getRawAxis(5));
rearLeft.set(driver.getRawAxis(5));
frontRight.set(driver.getRawAxis(5));
rearRight.set(driver.getRawAxis(5));
} else {
drive.mecanumDrive_Cartesian(driver.getRawAxis(1), driver.getRawAxis(2), -driver.getRawAxis(3), gyro.getAngle());
log("I'm reaching the else. Yay!");
}*/
if (operator.getRawButton(4)) {
//Y button
claw.set(1);
} else if (operator.getRawButton(1)) {
claw.set(-0.7);
} else {
claw.set(0);
}
if (operator.getRawButton(8)) {
//Start button
comp.start();
} else if (operator.getRawButton(7)) {
//Back
comp.stop();
}
if (driver.getRawButton(8)) {
comp.start();
} else if (driver.getRawButton(7)) {
comp.stop();
}
if (operator.getRawButton(5)) {
boomup.set(true);
boomdown.set(false);
} else if (operator.getRawButton(6)) {
boomdown.set(true);
boomup.set(false);
}
/* if (photoswitch.get() == true) {
if (operator.getRawButton(2)) {
defender.set(1.0);
}
}
else if (photoswitch.get() == false) {
if (operator.getRawButton(3)) {
defender.set(-1.0);
}
}*/
if (operator.getRawButton(2)) {
defender.set(1.0);
} else if (operator.getRawButton(3)) {
defender.set(-1.0);
}
}
/**
* This function is called periodically during test mode
*/
public void testPeriodic() {
didAuto = false;
}
public double centerXbox(double axisOutput) {
double reducedSensitivity = axisOutput;
if (axisOutput > -0.2 || axisOutput < 0.2) {
reducedSensitivity = 0;
}
return reducedSensitivity;
}
private void log(String msg) {
dataPrinter.clear();
dataPrinter.println(DriverStationLCD.Line.kUser1, 1, msg);
dataPrinter.updateLCD();
}
}