View Single Post
  #1   Spotlight this post!  
Unread 24-11-2015, 16:25
Joe Finkel Joe Finkel is offline
Registered User
FRC #0369 (High Voltage)
Team Role: Coach
 
Join Date: Sep 2007
Rookie Year: 2000
Location: Brooklyn,N.Y.
Posts: 35
Joe Finkel has a spectacular aura aboutJoe Finkel has a spectacular aura aboutJoe Finkel has a spectacular aura about
Exclamation Won't import wpilib libraries?

this is our code thus far. For whatever reason, it won't let us import Victor, SimpleRobot, and rumble joysticks.

any help would be appreciated. Thanks.

/*----------------------------------------------------------------------------*/
/* 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 org.usfirst.frc.team369.frisbeerobot;

import edu.wpi.first.wpilibj.*;
import edu.wpi.first.wpilibj.Victor;
import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpliibj.Joystick.RumbleType;
/**
* The VM is configured to automatically run this class, and to call the
* functions corresponding to each mode, as described in the SimpleRobot
* 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 SimpleRobot {
/**
* This function is called once each time the robot enters autonomous mode.
*/
Victor drive1;
Victor drive2;
Victor drive3;
Victor drive4;
Victor shooter1;
Victor shooter2;
Relay load;
RobotDrive robot;
Joystick joy1;
Joystick joy2;
Compressor airIntake;
Solenoid degree1;
Solenoid degree2;
Solenoid shoot1;
Solenoid shoot2;
DriverStation ds;
public RobotTemplate(){
drive1 = new Victor(1);
drive2 = new Victor(2);
drive3 = new Victor(3);
drive4 = new Victor(4);
shooter1 = new Victor(5);
shooter2 = new Victor(6);
load = new Relay(1, 4);
robot = new RobotDrive(drive1, drive2, drive3, drive4);
joy1 = new Joystick(1);
joy2 = new Joystick(2);
airIntake = new Compressor(1, 1);
degree1 = new Solenoid(1);
degree2 = new Solenoid(2);
shoot1 = new Solenoid(7);
shoot2 = new Solenoid(8);
ds = DriverStation.getInstance();
airIntake.start();
}





public void autonomous() {

}
public void changeDegree(boolean deg){
if(deg = true){
degree1.set(true);
degree2.set(false);
}else if(deg = false){
degree1.set(false);
degree2.set(true);
}
}
public void shoot(boolean sh){
if(sh == true){
shoot1.set(true);
shoot2.set(false);
}else if(false){
shoot1.set(false);
shoot2.set(true);
}
}

/**
* This function is called once each time the robot enters operator control.
*/
public void operatorControl() {
int count = 0;
while(isOperatorControl()){
Timer.delay(0.001);
robot.tankDrive(joy1.getY(), joy2.getY());
if(!ds.getDigitalIn(6)){
changeDegree(true);
}else if(!ds.getDigitalIn(8)){
changeDegree(false);
}
if(!ds.getDigitalIn(1)){
shooter1.set(1);
shooter2.set(1);
}else{
shooter1.set(0);
shooter2.set(0);
}
if(!ds.getDigitalIn(3)){
shoot(true);
}else{
shoot(false);
}
if(!ds.getDigitalIn(5)){
load.set(Relay.Value.kOn);
}else{
load.set(Relay.Value.kOff);
}
}
}

/**
* This function is called once each time the robot enters test mode.
*/
public void test() {

}
}
Reply With Quote