I got help earlier but I have tried to program one in and just cant figure it out. I am completely lost and need lots of help so if anyone out there is willing id be forever grateful.
THANKS!
I got help earlier but I have tried to program one in and just cant figure it out. I am completely lost and need lots of help so if anyone out there is willing id be forever grateful.
THANKS!
Its just like any other controller, except with more axes and buttons. See the following post: http://www.chiefdelphi.com/forums/showpost.php?p=921551&postcount=4. Go to “Run” on your computer and type in “joy.cpl” (without quotes, with the controller plugged in). Then go to properties to see the button numbers.
I sorry but I have tried for hours now and just cant seem to figure out how to implement both your ways. Like how do I use buttons - because the regular “button.whenPressed(new exampleCommand());” isn’t working. How do I make it work with tankdrive when there are not two joysticks connected but rather one controller. I am sooooo confused and I tried to figure it out on my own but I have gotten nowhere.
THANKS for the help.
Can we see the code you have so far?
Assuming you’re using a RobotDrive object to control your drivetrain, and the tankDrive method, your Xbox controller (like ekapalka said) should behave much like a pair of joysticks in tank drive - with each Xbox stick controlling one side of the drivetrain.
drive.tankDrive(gamepad.getLeftStickY(), gamepad.getRightStickY();
Okay - im still confused about how to implement it in my DriveTele command and how to make buttons work.
Here’s is the Chassis subsystem - I think I have this figured out:
package edu.wpi.first.XBoxBot2014.subsystems;
import edu.wpi.first.XBoxBot2014.OI;
import edu.wpi.first.XBoxBot2014.RobotMap;
import edu.wpi.first.XBoxBot2014.commands.DriveTele;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.command.Subsystem;
/**
*
* @author FrankyMonezz
*/
public class Chassis extends Subsystem {
// Put methods for controlling this subsystem
// here. Call these from Commands.
RobotDrive drive;
OI oi = new OI();
public void initDefaultCommand() {
// Set the default command for a subsystem here.
setDefaultCommand(new DriveTele());
}
public Chassis(){
drive = new RobotDrive(RobotMap.leftMotorPort, RobotMap.rightMotorPort);
drive.setSafetyEnabled(false);
}
public void driveTele(Joystick leftStick, Joystick rightStick){
drive.tankDrive(oi.xcon2.getLeftJoyY(), oi.xcon2.getRightJoyY());
}
public void setSpeed(double speed){
drive.setMaxOutput(speed);
}
public void driveAuton(double speed, double turnRate)
{
drive.arcadeDrive(speed, turnRate);
}
}
Here is the XBoxController class that im using - kindly given to me by cgmv123:
package edu.wpi.first.XBoxBot2014.subsystems;
import edu.wpi.first.wpilibj.DriverStation;
/**
*
* @author Jon Morton
*/
public class XBoxController {
private DriverStation _ds;
private final int _port;
public XBoxController(int port) {
_ds = DriverStation.getInstance();
_port = port;
}
public double getRawAxis(final int axis) {
return _ds.getStickAxis(_port, axis);
}
public boolean getRawButton(final int button) {
return ((0x1 << (button - 1)) & _ds.getStickButtons(_port)) != 0;
}
/**
* Warning! getRightTrigger() and getLeftTrigger() both use getRawAxis(3).
* As getRawAxis(3) goes below zero, getRightTrigger() increases, and as
* getRawAxis(3) goes above zero, getLeftTrigger() increases. If both
* triggers are pressed, both of them will be treated as zero. You can only
* use one trigger at a time.
*
* @return
*/
public double getRightTrigger() {
return -Math.min(getRawAxis(3), 0);
}
public double getLeftTrigger() {
return Math.max(getRawAxis(3), 0);
}
public double getRightJoyX() {
return getRawAxis(4);
}
public double getRightJoyY() {
return getRawAxis(5);
}
public double getLeftJoyX() {
return getRawAxis(1);
}
public double getLeftJoyY() {
return getRawAxis(2);
}
public boolean getButtonA() {
return getRawButton(1);
}
public boolean getButtonB() {
return getRawButton(2);
}
public boolean getButtonX() {
return getRawButton(3);
}
public boolean getButtonY() {
return getRawButton(4);
}
public boolean getButtonBack() {
return getRawButton(7);
}
public boolean getButtonStart() {
return getRawButton(8);
}
public boolean getButtonRB() {
return getRawButton(6);
}
public boolean getButtonLB() {
return getRawButton(5);
}
public boolean getButtonLS() {
return getRawButton(9);
}
public boolean getButtonRS() {
return getRawButton(10);
}
}
I instantiate XBoxController here(conPort is an integer value of 1 stored in RobotMap) - I have the
boolean button = xcon2.getWHATEVER()
figured out - but how do I use that to turn say a motor on - because for example
button.whenPressed or button.when released
does not work with boolean values:
package edu.wpi.first.XBoxBot2014;
import edu.wpi.first.XBoxBot2014.subsystems.XBoxController;
public class OI {
public XBoxController xcon2 = new XBoxController(RobotMap.conPort);
public OI() {
boolean button = xcon2.getButtonA();
}
}
whenPressed() and whenReleased() are methods of the Button class, not of booleans. As a result, if you want to perform a command when a button is being pressed or released you need to call the method on a Button object, not a boolean.
The JoystickButton constructor takes a human interface device (Xbox controller object) and a button number as parameters. In your code, you could do the following:
package edu.wpi.first.XBoxBot2014;
import edu.wpi.first.XBoxBot2014.subsystems.XBoxController;
public class OI {
public XBoxController xcon2 = new XBoxController(RobotMap.conPort);
**private Button button = new JoystickButton(xcon2, 1);** //Button A = 1
public OI() {
button.whenPressed(doThing());
}
}
As for driveTele(), you don’t need to take a leftStick and a rightStick as parameters if you don’t use them in the method. Instead, drive.tankDrive() takes values from the xcon2 object in oi:
public void driveTele(Joystick leftStick, Joystick rightStick){
drive.tankDrive(oi.xcon2.getLeftJoyY(), oi.xcon2.getRightJoyY());
}
I don’t have much expertise with command-based programming (sorry), but here’s what I’d do to fix that problem with your current setup:
Replace the parameters with doubles, and take advantage of the fact that tankDrive() will also take a leftValue and rightValue as input:
public void driveTele(double leftValue, double rightValue){
drive.tankDrive(leftValue, rightValue);
}
Your DriveTele() command will then look something like this.
Hope it works!
Thanks soooo much. It all worked except for the
private Button button = new JoystickButton(xcon2, 1);
Netbeans gets all mad and says
incompatible types: XBoxController cannot be converted to GenericHID
What I would do in your case is scrap the use of the XBoxController class and use the provided Joystick class with these button/joystick mappings.
So for the A button it would be:
Joystick joystick = new Joystick(1);
private Button button = new JoystickButton(joystick, 0);
And to access the left and right sticks for tank drive it would be:
oi.joystick.getRawAxis(7); //Left stick
oi.joystick.getRawAxis(5); //Rightstick
The best way to do this would be to create a class that extends the Joystick class then:
-create getter methods for each of the buttons and axis
-create static constants that hold the mapped button numbers and axis
If you’d like more information on how to do this I can assist you there too.
You can have the XBoxController class extend GenericHID and have NetBeans implement all abstract methods:
public class XBoxController extends GenericHID{
...
}
and that should allow you to cast XBoxController to a GenericHID.
notmattlythgoe’s suggestion is much better, but for a quick fix right now this should work.
Okay I get it - but why cant I just continue to use
Joystick joystick = new Joystick(1);
private Button button = new JoystickButton(joystick, 0);
to assign my buttons or even
private Button button = new JoystickButton(joystick, joystick.getRawButton(0));
instead of having to create a whole new class.
And if it is completely necessary to do so I would need some help - I have an idea of what to do but I would still need some guidance.
THANKS!
You don’t need a whole new class. Writing the new class will just make it easier in the future to write code using the xbox controller, but they literally do the exact same thing.
Just using the JoystickButton along with the Joystick class is a perfectly fine way to do it. So for you I’d suggest you stick with the below for now.
Joystick joystick = new Joystick(1);
private Button button = new JoystickButton(joystick, 0);
@NWChen I tried that but it didn’t work - THANKS though!
@notmattlythgoe In that case id like to do it - wouldn’t it be a lot like the XBoxController class other than the fact that it extends the Joystick class - at least the getters would be the same
Yes the getters would be similar.
You’ll want to get rid of the getRaw…() methods from the XBoxController class because you get those automatically from extending the Joystick class. Also remove the port and driver station fields since the Joystick class takes care of that communication for you.
Don’t forget to include a single parameter constructor that calls the Joystick constructor.
Then what you’ll want to do is create a list of static final variables that hold the mapping values for the buttons, this way you don’t have to memorize what button maps to what value. I would also suggest using these static fields as the values in the getter methods, this way if you ever have to change the value you only have to change it in one place.
Example:
public static final int A_BUTTON = 0;
public static final int B_BUTTON = 1;
etc...
public boolean getButtonA() {
return getRawButton(A_BUTTON);
}
Then you can use it like so:
XBoxController joystick = new XBoxController(1);
private Button button = new JoystickButton(joystick, XBoxController.A_BUTTON);
Ok AWESOME - now this may seem like a dumb question to you but im a beginner programmer so here it is
How exactly do I extend the Joystick class - I tried it like this:
public class XBox extends Joystick {
}
but Netbeans doesn’t like that
When you say
include a single parameter constructor that calls the Joystick constructor
do you want that in the class and would that just look like
Joystick stick = new Joystick();
THANKS for all your help!
That is the correct way to extend a class. The compiler is most likely complaining about the missing constructor. Anything that extends the Joystick class is required to have a constructor that calls the Joystick(int port) constructor. So your constructor will look like this inside of your class:
public XBox(int port) {
super(port);
}
The super() method will call the super class’s (Joystick) constructor.
Ok AWESOME now it works just fine.
I tried uploading this https://github.com/MrSTUDofCODE/XBoxBot2014/tree/master/src/edu/wpi/first code to the robot and it does not work - the button assignments don’t work and the joysticks don’t work
Here’s the output:
ant -f C:\\Users\\Developer\\Documents\\NetBeansProjects\\XBoxBot2014 deploy run
clean:
Deleting directory C:\Users\Developer\Documents\NetBeansProjects\XBoxBot2014\build
Created dir: C:\Users\Developer\Documents\NetBeansProjects\XBoxBot2014\build
Created dir: C:\Users\Developer\Documents\NetBeansProjects\XBoxBot2014\build\classes
[crio-compile] ./src, C:/Users/Developer/sunspotfrcsdk\lib\wpilibj.jar;C:/Users/Developer/sunspotfrcsdk\lib
etworktables-crio.jar, C:/Users/Developer/sunspotfrcsdk\lib\squawk.jar -> ./build/classes
Compiling 37 source files to C:\Users\Developer\Documents\NetBeansProjects\XBoxBot2014\build\classes
compile:
preverify:
Created dir: C:\Users\Developer\Documents\NetBeansProjects\XBoxBot2014\build\preverify
Created dir: C:\Users\Developer\Documents\NetBeansProjects\XBoxBot2014\build\preverify.raw.util
[crio-preverify] ./build/classes, , C:/Users/Developer/sunspotfrcsdk\lib\wpilibj.jar;C:/Users/Developer/sunspotfrcsdk\lib
etworktables-crio.jar, C:/Users/Developer/sunspotfrcsdk\lib\squawk.jar -> ./build/preverify
Expanding: C:\Users\Developer\sunspotfrcsdk\lib\wpilibj.jar into C:\Users\Developer\Documents\NetBeansProjects\XBoxBot2014\build\preverify
Expanding: C:\Users\Developer\sunspotfrcsdk\lib
etworktables-crio.jar into C:\Users\Developer\Documents\NetBeansProjects\XBoxBot2014\build\preverify
jar:
[crio-jar] ./build/preverify, ./resources -> ./build/app.jar
Building jar: C:\Users\Developer\Documents\NetBeansProjects\XBoxBot2014\build\app.jar
suite:
Created dir: C:\Users\Developer\Documents\NetBeansProjects\XBoxBot2014\build\suite
[crio-suite] ./build/app.jar -> ./build/suite/image
CompilerOracle: exclude com/sun/squawk/Method.getParameterTypes
CompilerOracle: exclude com/sun/squawk/SymbolParser.getSignatureTypeAt
CompilerOracle: exclude com/sun/squawk/SymbolParser.stripMethods
[translating suite image [closed: false, parent: squawk] ...]
### Excluding compile: com.sun.squawk.Method::getParameterTypes
### Excluding compile: com.sun.squawk.SymbolParser::getSignatureTypeAt
[Including resource: META-INF/MANIFEST.MF]
[Including resource: META-INF/maven/edu.wpi.first.wpilib.networktables.java/NetworkTablesAzalea/pom.properties]
[Including resource: META-INF/maven/edu.wpi.first.wpilib.networktables.java/NetworkTablesAzalea/pom.xml]
Romizer processed 424 classes and generated 4 files.
Expanding: C:\Users\Developer\Documents\NetBeansProjects\XBoxBot2014\build\app.jar into C:\Users\Developer\Documents\NetBeansProjects\XBoxBot2014\build\suite
Moving 1 file to C:\Users\Developer\Documents\NetBeansProjects\XBoxBot2014\build\suite
Moving 1 file to C:\Users\Developer\Documents\NetBeansProjects\XBoxBot2014\build\suite
Moving 1 file to C:\Users\Developer\Documents\NetBeansProjects\XBoxBot2014\build\suite
Deleting: C:\Users\Developer\Documents\NetBeansProjects\XBoxBot2014\image.suite.api
deploy:
[crio-configure] Configuration files not included in this version of the sdk
[crio-configure] Checking that crio is configured for Java
Host OS: Windows 7 6.1, 6.1
Host JVM: Java HotSpot(TM) Client VM 24.51-b03
Target IP: 10.46.23.2
Network interfaces on host:
Realtek PCIe FE Family Controller: address: 10.46.23.5 netmask: 255.255.255.0 <--- on robot's subnet
Connecting FTP @10.46.23.2
[crio-deploy] ./build/suite/image.suite -> 10.46.23.2
Sending local file image.suite
run:
[cRIO] [OTA Server] ********* REBOOTING cRIO *********
[cRIO]
Waiting for cRIO to reboot (1s)
Waiting for cRIO to reboot (2s)
Waiting for cRIO to reboot (3s)
Waiting for cRIO to reboot (4s)
Waiting for cRIO to reboot (5s)
Waiting for cRIO to reboot (6s)
Waiting for cRIO to reboot (7s)
Waiting for cRIO to reboot (8s)
Waiting for cRIO to reboot (9s)
Waiting for cRIO to reboot (10s)
Waiting for cRIO to reboot (11s)
Waiting for cRIO to reboot (12s)
[cRIO]
[cRIO] -> * Loading debug.o: debug
[cRIO] Debugging is up, target server mounted at /tsfs
[cRIO]
[cRIO]
[cRIO] VxWorks
[cRIO]
[cRIO] Copyright 1984-2006 Wind River Systems, Inc.
[cRIO]
[cRIO] CPU: cRIO-FRC II
[cRIO] Runtime Name: VxWorks
[cRIO] Runtime Version: 6.3
[cRIO] BSP version: 1.0/0
[cRIO] Created: May 23 2013, 16:00:09
[cRIO] ED&R Policy Mode: Deployed
[cRIO] WDB Comm Type: WDB_COMM_END
[cRIO] WDB: Ready.
[cRIO]
[cRIO] * Loading nisysrpc.out: nisysrpc
[cRIO] * Loading NiRioRpc.out: NiRioRpc
[cRIO] * Loading nivissvc.out: nivissvc
[cRIO] task 0x18b9b98 (VISA Jungo Init Thread) deleted: errno=196709 (0x30065) status=-1073807360 (0xbfff0000)
[cRIO] * Loading nivision.out: nivision
[cRIO] task 0x1896118 (Service Locator Thread 5) deleted: errno=0 (0) status=0 (0)
[cRIO] NI-RIO Server 13.0 started successfully.
[cRIO] task 0x17a5ee0 (NiRioRpc) deleted: errno=0 (0) status=0 (0)
[cRIO] task 0x1916ba8 (Service Locator Thread 6) deleted: errno=0 (0) status=0 (0)
[cRIO] task 0x1916ba8 (Service Locator Thread 7) deleted: errno=0 (0) status=0 (0)
[cRIO] task 0x1916ba8 (Service Locator Thread 8) deleted: errno=0 (0) status=0 (0)
[cRIO] task 0x13ab7f8 (nisysapi-mDns) deleted: errno=0 (0) status=0 (0)
[cRIO] * Loading visa32.out: visa32
[cRIO] * Loading niserial.out: niserial
[cRIO] * Loading NiFpgaLv.out: NiFpgaLv
[cRIO] * Loading FRC_FPGA_ChipObject.out: FRC_FPGA_ChipObject
[cRIO] * Loading FRC_NetworkCommunication.out: FRC_NetworkCommunication
[cRIO] FRC_NetworkCommunication version: p4-1.4.0a18
[cRIO] FPGA Hardware GUID: 0x1394F6DC1FEB42EC6910E5767ED1D22C
[cRIO] FPGA Software GUID: 0x1394F6DC1FEB42EC6910E5767ED1D22C
[cRIO] FPGA Hardware Version: 2012
[cRIO] FPGA Software Version: 2012
[cRIO] FPGA Hardware Revision: 1.6.4
[cRIO] FPGA Software Revision: 1.6.4
[cRIO] * Loading FRC_JavaVM.out: FRC_JavaVM
[cRIO]
[cRIO]
[cRIO] [OTA Server] Version: 2012 FRC, Jan 5 2012, 17:20:48
[cRIO]
[cRIO]
[cRIO] Welcome to LabVIEW Real-Time 13.0
[cRIO] task 0x1879bd8 (sysapi-rpc) deleted: errno=0 (0) status=0 (0)
[cRIO]
[cRIO] [Squawk VM] Version: 2011 FRC, Nov 5 2011, 14:34:13
[cRIO] FPGA Hardware GUID: 0x1394f6dc1feb42ec6910e5767ed1d22c
[cRIO] FPGA Software GUID: 0xa14c11bde4bb64aef6a86fc52a294cd9
[cRIO] java.lang.IllegalArgumentException: Subsystem must not be null.
[cRIO] at edu.wpi.first.wpilibj.command.Command.requires(Command.java:173)
[cRIO] at edu.wpi.first.XBoxBot2014.commands.ReleaseTension.<init>(ReleaseTension.java:17)
[cRIO] at edu.wpi.first.XBoxBot2014.OI.<init>(OI.java:55)
[cRIO] at edu.wpi.first.XBoxBot2014.subsystems.Chassis.<init>(Chassis.java:24)
[cRIO] at edu.wpi.first.XBoxBot2014.commands.CommandBase.<clinit>(CommandBase.java:23)
[cRIO] in virtual method #109 of com.sun.squawk.Klass(bci=49)
[cRIO] in virtual method #106 of com.sun.squawk.Klass(bci=328)
[cRIO] in virtual method #106 of com.sun.squawk.Klass(bci=156)
[cRIO] in virtual method #105 of com.sun.squawk.Klass(bci=32)
[cRIO] in static method #25 of com.sun.squawk.VM(bci=4)
[cRIO] at edu.wpi.first.XBoxBot2014.commands.AUTONOMOUS.<init>(AUTONOMOUS.java:40)
[cRIO] at edu.wpi.first.XBoxBot2014.XBoxBot2014.robotInit(XBoxBot2014.java:36)
[cRIO] at edu.wpi.first.wpilibj.IterativeRobot.startCompetition(IterativeRobot.java:72)
[cRIO] at edu.wpi.first.wpilibj.RobotBase.startApp(RobotBase.java:235)
[cRIO] in virtual method #10 of javax.microedition.midlet.MIDlet(bci=17)
[cRIO] at javax.microedition.midlet.MIDletTunnelImpl.callStartApp(64)
[cRIO] at com.sun.squawk.imp.MIDletMainWrapper.main(110)
[cRIO] in virtual method #95 of com.sun.squawk.Klass(bci=25)
[cRIO] at com.sun.squawk.Isolate.run(1506)
[cRIO] at java.lang.Thread.run(231)
[cRIO] in virtual method #47 of com.sun.squawk.VMThread(bci=42)
[cRIO] in static method #3 of com.sun.squawk.VM(bci=6)
[cRIO] java.lang.Error: ExceptionInInitializer: edu.wpi.first.XBoxBot2014.commands.CommandBase:java.lang.IllegalArgumentException: Subsystem must not be null.
[cRIO] in virtual method #106 of com.sun.squawk.Klass(bci=409)
[cRIO] in virtual method #106 of com.sun.squawk.Klass(bci=156)
[cRIO] in virtual method #105 of com.sun.squawk.Klass(bci=32)
[cRIO] in static method #25 of com.sun.squawk.VM(bci=4)
[cRIO] at edu.wpi.first.XBoxBot2014.commands.AUTONOMOUS.<init>(AUTONOMOUS.java:40)
[cRIO] at edu.wpi.first.XBoxBot2014.XBoxBot2014.robotInit(XBoxBot2014.java:36)
[cRIO] at edu.wpi.first.wpilibj.IterativeRobot.startCompetition(IterativeRobot.java:72)
[cRIO] at edu.wpi.first.wpilibj.RobotBase.startApp(RobotBase.java:235)
[cRIO] in virtual method #10 of javax.microedition.midlet.MIDlet(bci=17)
[cRIO] at javax.microedition.midlet.MIDletTunnelImpl.callStartApp(64)
[cRIO] at com.sun.squawk.imp.MIDletMainWrapper.main(110)
[cRIO] in virtual method #95 of com.sun.squawk.Klass(bci=25)
[cRIO] at com.sun.squawk.Isolate.run(1506)
[cRIO] at java.lang.Thread.run(231)
[cRIO] in virtual method #47 of com.sun.squawk.VMThread(bci=42)
[cRIO] in static method #3 of com.sun.squawk.VM(bci=6)
[cRIO] WARNING: Robots don't quit!
[cRIO] ---> The startCompetition() method (or methods called by it) should have handled the exception above.
[cRIO] edu.wpi.first.wpilibj.networktables2.server.ServerConnectionAdapter@a entered connection state: GOT_CONNECTION_FROM_CLIENT
[cRIO] edu.wpi.first.wpilibj.networktables2.server.ServerConnectionAdapter@a entered connection state: CONNECTED_TO_CLIENT
BUILD STOPPED (total time: 1 minute 20 seconds)
In XBoxBot2014.java, you need to move the instantiation of your AUTONOMOUS command below the initialization of CommandBase. Since CommandBase hadn’t been initialized prior to creating a command all of your subsystems hadn’t been set up yet.
Ok I think I fixed that - here’s https://github.com/MrSTUDofCODE/XBoxBot2014/tree/master/src/edu/wpi/first the updated code
But it still shows an error:
ant -f C:\\Users\\Developer\\Documents\\NetBeansProjects\\XBoxBot2014 deploy run
clean:
Deleting directory C:\Users\Developer\Documents\NetBeansProjects\XBoxBot2014\build
Created dir: C:\Users\Developer\Documents\NetBeansProjects\XBoxBot2014\build
Created dir: C:\Users\Developer\Documents\NetBeansProjects\XBoxBot2014\build\classes
[crio-compile] ./src, C:/Users/Developer/sunspotfrcsdk\lib\wpilibj.jar;C:/Users/Developer/sunspotfrcsdk\lib
etworktables-crio.jar, C:/Users/Developer/sunspotfrcsdk\lib\squawk.jar -> ./build/classes
Compiling 37 source files to C:\Users\Developer\Documents\NetBeansProjects\XBoxBot2014\build\classes
compile:
preverify:
Created dir: C:\Users\Developer\Documents\NetBeansProjects\XBoxBot2014\build\preverify
Created dir: C:\Users\Developer\Documents\NetBeansProjects\XBoxBot2014\build\preverify.raw.util
[crio-preverify] ./build/classes, , C:/Users/Developer/sunspotfrcsdk\lib\wpilibj.jar;C:/Users/Developer/sunspotfrcsdk\lib
etworktables-crio.jar, C:/Users/Developer/sunspotfrcsdk\lib\squawk.jar -> ./build/preverify
Expanding: C:\Users\Developer\sunspotfrcsdk\lib\wpilibj.jar into C:\Users\Developer\Documents\NetBeansProjects\XBoxBot2014\build\preverify
Expanding: C:\Users\Developer\sunspotfrcsdk\lib
etworktables-crio.jar into C:\Users\Developer\Documents\NetBeansProjects\XBoxBot2014\build\preverify
jar:
[crio-jar] ./build/preverify, ./resources -> ./build/app.jar
Building jar: C:\Users\Developer\Documents\NetBeansProjects\XBoxBot2014\build\app.jar
suite:
Created dir: C:\Users\Developer\Documents\NetBeansProjects\XBoxBot2014\build\suite
[crio-suite] ./build/app.jar -> ./build/suite/image
CompilerOracle: exclude com/sun/squawk/Method.getParameterTypes
CompilerOracle: exclude com/sun/squawk/SymbolParser.getSignatureTypeAt
CompilerOracle: exclude com/sun/squawk/SymbolParser.stripMethods
[translating suite image [closed: false, parent: squawk] ...]
### Excluding compile: com.sun.squawk.Method::getParameterTypes
### Excluding compile: com.sun.squawk.SymbolParser::getSignatureTypeAt
[Including resource: META-INF/MANIFEST.MF]
[Including resource: META-INF/maven/edu.wpi.first.wpilib.networktables.java/NetworkTablesAzalea/pom.properties]
[Including resource: META-INF/maven/edu.wpi.first.wpilib.networktables.java/NetworkTablesAzalea/pom.xml]
Romizer processed 424 classes and generated 4 files.
Expanding: C:\Users\Developer\Documents\NetBeansProjects\XBoxBot2014\build\app.jar into C:\Users\Developer\Documents\NetBeansProjects\XBoxBot2014\build\suite
Moving 1 file to C:\Users\Developer\Documents\NetBeansProjects\XBoxBot2014\build\suite
Moving 1 file to C:\Users\Developer\Documents\NetBeansProjects\XBoxBot2014\build\suite
Moving 1 file to C:\Users\Developer\Documents\NetBeansProjects\XBoxBot2014\build\suite
Deleting: C:\Users\Developer\Documents\NetBeansProjects\XBoxBot2014\image.suite.api
deploy:
[crio-configure] Configuration files not included in this version of the sdk
[crio-configure] Checking that crio is configured for Java
Host OS: Windows 7 6.1, 6.1
Host JVM: Java HotSpot(TM) Client VM 24.51-b03
Target IP: 10.46.23.2
Network interfaces on host:
Realtek PCIe FE Family Controller: address: 10.46.23.5 netmask: 255.255.255.0 <--- on robot's subnet
Connecting FTP @10.46.23.2
[crio-deploy] ./build/suite/image.suite -> 10.46.23.2
Sending local file image.suite
run:
[cRIO] [OTA Server] ********* REBOOTING cRIO *********
[cRIO]
Waiting for cRIO to reboot (1s)
Waiting for cRIO to reboot (2s)
Waiting for cRIO to reboot (3s)
Waiting for cRIO to reboot (4s)
Waiting for cRIO to reboot (5s)
Waiting for cRIO to reboot (6s)
Waiting for cRIO to reboot (7s)
Waiting for cRIO to reboot (8s)
Waiting for cRIO to reboot (9s)
Waiting for cRIO to reboot (10s)
Waiting for cRIO to reboot (11s)
Waiting for cRIO to reboot (12s)
[cRIO]
[cRIO] -> * Loading debug.o: debug
[cRIO] Debugging is up, target server mounted at /tsfs
[cRIO]
[cRIO]
[cRIO] VxWorks
[cRIO]
[cRIO] Copyright 1984-2006 Wind River Systems, Inc.
[cRIO]
[cRIO] CPU: cRIO-FRC II
[cRIO] Runtime Name: VxWorks
[cRIO] Runtime Version: 6.3
[cRIO] BSP version: 1.0/0
[cRIO] Created: May 23 2013, 16:00:09
[cRIO] ED&R Policy Mode: Deployed
[cRIO] WDB Comm Type: WDB_COMM_END
[cRIO] WDB: Ready.
[cRIO]
[cRIO] * Loading nisysrpc.out: nisysrpc
[cRIO] * Loading NiRioRpc.out: NiRioRpc
[cRIO] * Loading nivissvc.out: nivissvc
[cRIO] task 0x18beed8 (Service Locator Thread 5) deleted: errno=0 (0) status=0 (0)
[cRIO] NI-RIO Server 13.0 started successfully.
[cRIO] task 0x17531c8 (NiRioRpc) deleted: errno=0 (0) status=0 (0)
[cRIO] * Loading nivision.out: nivision
[cRIO] * Loading visa32.out: visa32
[cRIO] task 0x193a2c0 (VISA Jungo Init Thread) deleted: errno=196709 (0x30065) status=-1073807360 (0xbfff0000)
[cRIO] * Loading niserial.out: niserial
[cRIO] * Loading NiFpgaLv.out: NiFpgaLv
[cRIO] task 0x19e14f0 (Service Locator Thread 6) deleted: errno=0 (0) status=0 (0)
[cRIO] task 0x19e14f0 (Service Locator Thread 7) deleted: errno=0 (0) status=0 (0)
[cRIO] task 0x19e14f0 (Service Locator Thread 8) deleted: errno=0 (0) status=0 (0)
[cRIO] * Loading FRC_FPGA_ChipObject.out: FRC_FPGA_ChipObject
[cRIO] task 0x13c2300 (nisysapi-mDns) deleted: errno=0 (0) status=0 (0)
[cRIO] * Loading FRC_NetworkCommunication.out: FRC_NetworkCommunication
[cRIO] FRC_NetworkCommunication version: p4-1.4.0a18
[cRIO] FPGA Hardware GUID: 0x1394F6DC1FEB42EC6910E5767ED1D22C
[cRIO] FPGA Software GUID: 0x1394F6DC1FEB42EC6910E5767ED1D22C
[cRIO] FPGA Hardware Version: 2012
[cRIO] FPGA Software Version: 2012
[cRIO] FPGA Hardware Revision: 1.6.4
[cRIO] FPGA Software Revision: 1.6.4
[cRIO] * Loading FRC_JavaVM.out: FRC_JavaVM
[cRIO]
[cRIO]
[cRIO] [OTA Server] Version: 2012 FRC, Jan 5 2012, 17:20:48
[cRIO]
[cRIO]
[cRIO] Welcome to LabVIEW Real-Time 13.0
[cRIO] task 0x17ae568 (sysapi-rpc) deleted: errno=0 (0) status=0 (0)
[cRIO]
[cRIO] [Squawk VM] Version: 2011 FRC, Nov 5 2011, 14:34:13
[cRIO] FPGA Hardware GUID: 0x1394f6dc1feb42ec6910e5767ed1d22c
[cRIO] FPGA Software GUID: 0xa14c11bde4bb64aef6a86fc52a294cd9
[cRIO] java.lang.IllegalArgumentException: Subsystem must not be null.
[cRIO] at edu.wpi.first.wpilibj.command.Command.requires(Command.java:173)
[cRIO] at edu.wpi.first.XBoxBot2014.commands.ReleaseTension.<init>(ReleaseTension.java:17)
[cRIO] at edu.wpi.first.XBoxBot2014.OI.<init>(OI.java:55)
[cRIO] at edu.wpi.first.XBoxBot2014.subsystems.Chassis.<init>(Chassis.java:24)
[cRIO] at edu.wpi.first.XBoxBot2014.commands.CommandBase.<clinit>(CommandBase.java:23)
[cRIO] in virtual method #109 of com.sun.squawk.Klass(bci=49)
[cRIO] in virtual method #106 of com.sun.squawk.Klass(bci=328)
[cRIO] in virtual method #105 of com.sun.squawk.Klass(bci=32)
[cRIO] in static method #24 of com.sun.squawk.VM(bci=4)
[cRIO] at edu.wpi.first.XBoxBot2014.commands.CommandBase.init(CommandBase.java:0)
[cRIO] at edu.wpi.first.XBoxBot2014.XBoxBot2014.robotInit(XBoxBot2014.java:36)
[cRIO] at edu.wpi.first.wpilibj.IterativeRobot.startCompetition(IterativeRobot.java:72)
[cRIO] at edu.wpi.first.wpilibj.RobotBase.startApp(RobotBase.java:235)
[cRIO] in virtual method #10 of javax.microedition.midlet.MIDlet(bci=17)
[cRIO] at javax.microedition.midlet.MIDletTunnelImpl.callStartApp(64)
[cRIO] at com.sun.squawk.imp.MIDletMainWrapper.main(110)
[cRIO] in virtual method #95 of com.sun.squawk.Klass(bci=25)
[cRIO] at com.sun.squawk.Isolate.run(1506)
[cRIO] at java.lang.Thread.run(231)
[cRIO] in virtual method #47 of com.sun.squawk.VMThread(bci=42)
[cRIO] in static method #3 of com.sun.squawk.VM(bci=6)
[cRIO] java.lang.Error: ExceptionInInitializer: edu.wpi.first.XBoxBot2014.commands.CommandBase:java.lang.IllegalArgumentException: Subsystem must not be null.
[cRIO] in virtual method #106 of com.sun.squawk.Klass(bci=409)
[cRIO] in virtual method #105 of com.sun.squawk.Klass(bci=32)
[cRIO] in static method #24 of com.sun.squawk.VM(bci=4)
[cRIO] at edu.wpi.first.XBoxBot2014.commands.CommandBase.init(CommandBase.java:0)
[cRIO] at edu.wpi.first.XBoxBot2014.XBoxBot2014.robotInit(XBoxBot2014.java:36)
[cRIO] at edu.wpi.first.wpilibj.IterativeRobot.startCompetition(IterativeRobot.java:72)
[cRIO] at edu.wpi.first.wpilibj.RobotBase.startApp(RobotBase.java:235)
[cRIO] in virtual method #10 of javax.microedition.midlet.MIDlet(bci=17)
[cRIO] at javax.microedition.midlet.MIDletTunnelImpl.callStartApp(64)
[cRIO] at com.sun.squawk.imp.MIDletMainWrapper.main(110)
[cRIO] in virtual method #95 of com.sun.squawk.Klass(bci=25)
[cRIO] at com.sun.squawk.Isolate.run(1506)
[cRIO] at java.lang.Thread.run(231)
[cRIO] in virtual method #47 of com.sun.squawk.VMThread(bci=42)
[cRIO] in static method #3 of com.sun.squawk.VM(bci=6)
[cRIO] WARNING: Robots don't quit!
[cRIO] ---> The startCompetition() method (or methods called by it) should have handled the exception above.
[cRIO] edu.wpi.first.wpilibj.networktables2.server.ServerConnectionAdapter@a entered connection state: GOT_CONNECTION_FROM_CLIENT
[cRIO] edu.wpi.first.wpilibj.networktables2.server.ServerConnectionAdapter@a entered connection state: CONNECTED_TO_CLIENT
In your Chassis subsystem you have an OI declaration, remove it.
FYI, your XBox class looks perfect.
I have also attached my version of the XBoxController and PS4Controller classes for anybody out there that would like to use them. We are working on creating a utilities library and will post it later. I have not tested the mappings on a robot yet, so if you notice anything that is not mapped correctly when you use it please let me know.
PS4Ccontroller.java (4.97 KB)
XBoxController.java (4.53 KB)
PS4Ccontroller.java (4.97 KB)
XBoxController.java (4.53 KB)