Go to Post I've completely figured [the hint] out: Robots will have to move around, and also displace objects in order to score points. What do I win? - pfreivald [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 24-11-2015, 16:25
Joe Finkel Joe Finkel is online now
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
  #2   Spotlight this post!  
Unread 26-11-2015, 16:47
origamitaco origamitaco is offline
Registered User
FRC #4328
 
Join Date: Nov 2015
Location: Richmond, TX
Posts: 35
origamitaco is an unknown quantity at this point
Re: Won't import wpilib libraries?

First off, when posting code please use code tags
Code:
 like this
. Also, our team had the same problem. You have to tell Eclipse to use the JDK under "Installed JREs". On some computers we also had to go to the project preferences and have wpilib checked, and we could never find out why on some and not all but it did end up fixing the problem. We also found out that in the future it helps to open one of the included example WPIlib projects and then reimport your code and that seemed to fix all errors with importing.
Reply With Quote
  #3   Spotlight this post!  
Unread 28-11-2015, 12:49
simon-andrews's Avatar
simon-andrews simon-andrews is offline
Registered User
FRC #4761 (Robockets)
Team Role: Programmer
 
Join Date: Feb 2015
Rookie Year: 2015
Location: Reading, MA
Posts: 16
simon-andrews is an unknown quantity at this point
Re: Won't import wpilib libraries?

I'm going to assume that you're using Eclipse with the Robot Java Development plugin installed.

Is it that Eclipse isn't allowing you to import them, or is it just that Eclipse can't find them?

If it's the latter then make sure the WPILib JARs are in the build path. Right click on your project in the Project Explorer, then click Properties... > Java Build Path > Libraries and see if the JAR files you need are there. It should look something like this: http://i.imgur.com/GI5WzH9

The WPILib JAR files should have been automatically installed to your home directory in wpilib/current/lib when you installed the Eclipse plugin.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 11:51.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi