We’ve been trying to deploy our Java code to our roboRIO from a MacBook Pro. However, every time we try, it spits out this log and won’t complete:
Buildfile: /Users/324876/Documents/workspace/2015 Test/build.xml
Trying to override old definition of task classloader
clean:
[delete] Deleting directory /Users/324876/Documents/workspace/2015 Test/build
[delete] Deleting directory /Users/324876/Documents/workspace/2015 Test/dist
compile:
[mkdir] Created dir: /Users/324876/Documents/workspace/2015 Test/build
[echo] [athena-compile] Compiling src with classpath=/Users/324876/wpilib/java/current/lib/WPILib.jar:/Users/324876/wpilib/java/current/lib/NetworkTables.jar to build
[javac] Compiling 1 source file to /Users/324876/Documents/workspace/2015 Test/build
jar:
[echo] [athena-jar] Making jar dist/FRCUserProgram.jar.
[mkdir] Created dir: /Users/324876/Documents/workspace/2015 Test/dist
[mkdir] Created dir: /Users/324876/Documents/workspace/2015 Test/build/jars
[echo] [athena-jar] Copying jars from /Users/324876/wpilib/java/current/lib/WPILib.jar:/Users/324876/wpilib/java/current/lib/NetworkTables.jar to build/jars.
[copy] Copying 2 files to /Users/324876/Documents/workspace/2015 Test/build/jars
[jar] Building jar: /Users/324876/Documents/workspace/2015 Test/dist/FRCUserProgram.jar
get-target-ip:
[echo] Trying Target: roboRIO-4301.local
[echo] roboRIO found via mDNS
dependencies:
[echo] roboRIO image version validated
[echo] Checking for JRE. If this fails install the JRE using these instructions: https://wpilib.screenstepslive.com/s/4485/m/13503/l/288822-installing-java-8-on-the-roborio-using-the-frc-roborio-java-installer-java-only
[sshexec] Connecting to roboRIO-4301.local:22
[sshexec] cmd : test -d /usr/local/frc/JRE
deploy:
[echo] [athena-deploy] Copying code over.
[scp] Connecting to roboRIO-4301.local:22
[scp] done.
[sshexec] Connecting to roboRIO-4301.local:22
[sshexec] cmd : killall netconsole-host
[sshexec] killall: netconsole-host: no process killed
[sshexec] Remote command failed with exit status 1
[scp] Connecting to roboRIO-4301.local:22
[scp] done.
[scp] Connecting to roboRIO-4301.local:22
[scp] done.
[echo] [athena-deploy] Starting program.
[sshexec] Connecting to roboRIO-4301.local:22
[sshexec] cmd : . /etc/profile.d/natinst-path.sh; /usr/local/frc/bin/frcKillRobot.sh -t -r;
[sshexec] start-stop-daemon: warning: killing process 1413: No such process
BUILD SUCCESSFUL
Total time: 11 seconds
Could someone please help us figure out what we’re doing wrong? Thanks!
To clarify, your code was successfully uploaded to the roboRIO. The error you are seeing was that it tried stop any robot code already running but didn’t see any.
I got the following message in the DS message window:
ERROR Unhandled exception: edu.wpi.first.wpilibj.tables.TableKeyNotDefinedException: Unkown Table Key: /SmartDashboard/Forward Time at [edu.wpi.first.wpilibj.networktables2.NetworkTableNode.getDouble(NetworkTableNode.java:51), edu.wpi.first.wpilibj.networktables.NetworkTable.getNumber(NetworkTable.java:294), edu.wpi.first.wpilibj.smartdashboard.SmartDashboard.getNumber(SmartDashboard.java:144), org.usfirst.frc.team4301.robot.Robot.disabled(Robot.java:90), edu.wpi.first.wpilibj.SampleRobot.startCompetition(SampleRobot.java:126), edu.wpi.first.wpilibj.RobotBase.main(RobotBase.java:234)]
Here is our code:
/*
* This is the experimental code for the 2015 robot. DO NOT USE FOR COMPETITION!
* All code that is usable will be in a separate project.
*/
package org.usfirst.frc.team4301.robot;
import edu.wpi.first.wpilibj.SampleRobot;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.Gyro;
import edu.wpi.first.wpilibj.Talon;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
public class Robot extends SampleRobot {
RobotDrive chassis;
Joystick DriverStick;
Joystick OperatorStick;
Gyro gyro;
Talon Lift;
Talon Winch;
public Robot() {
chassis = new RobotDrive(0, 1, 2, 3);
chassis.setExpiration(0.1);
DriverStick = new Joystick(0);
OperatorStick = new Joystick(1);
gyro = new Gyro(0);
Lift = new Talon(4);
Winch = new Talon(5);
}
/**
* Drive left & right motors for 2 seconds then stop
*/
public void autonomous() {
chassis.setSafetyEnabled(false);
gyro.reset();
while (isAutonomous() && isEnabled()) {
double ForwardTime = SmartDashboard.getNumber("Forward Time", 1.00);
double SidewaysTime = SmartDashboard.getNumber("Sideways Time", 5.00);
double rotation = 2.00;
if(Timer.getMatchTime() < ForwardTime) {
chassis.mecanumDrive_Cartesian(0, 0.5, rotation, gyro.getAngle()); //Drive away from driver Station
}
if(Timer.getMatchTime() < SidewaysTime + ForwardTime && Timer.getMatchTime() > ForwardTime) {
chassis.mecanumDrive_Cartesian(1, 0, rotation, gyro.getAngle());
}
// Check if time is less than sideways time and greater than forward time.
else {
chassis.mecanumDrive_Cartesian(0.0, 0.0, 0.0, gyro.getAngle());
}
SmartDashboard.putNumber("Timer", Timer.getMatchTime());
SmartDashboard.putNumber("Gyro", gyro.getAngle());
Timer.delay(0.005); //wait for a short time so the processor doesn't get mad.
}
}
public void operatorControl() {
chassis.setSafetyEnabled(true);
while (isOperatorControl() && isEnabled()) {
//set x, y, and z values by squaring and multiplying by speed limiter
double x = DriverStick.getX() * Math.abs(DriverStick.getX()) * DriverStick.getThrottle();
double y = DriverStick.getY() * Math.abs(DriverStick.getY()) * DriverStick.getThrottle();
double z = DriverStick.getZ() * Math.abs(DriverStick.getZ()) * DriverStick.getThrottle();
chassis.mecanumDrive_Cartesian(x, y, z, gyro.getAngle());
if(DriverStick.getTrigger() == true) {
gyro.reset();
}
Lift.set(OperatorStick.getY());
SmartDashboard.putNumber("Timer", Timer.getMatchTime());
SmartDashboard.putNumber("Gyro", gyro.getAngle());
Timer.delay(0.005); // wait for a motor update time
}
}
/**
* Runs during test mode
*/
public void test() {
}
public void disabled() {
while(isDisabled()) {
gyro.reset();
chassis.mecanumDrive_Cartesian(0.0, 0.0, 0.0, 0.0);
SmartDashboard.getNumber("Forward Time");
SmartDashboard.getNumber("Sideways Time");
SmartDashboard.putNumber("Gyro", gyro.getAngle());
Timer.delay(0.005);
}
}
}
This is telling you that your code is crashing on line 90 because the SmartDashboard value you are getting doesn’t exist. You can either surround those gets by try/catch, or add a default value like you used other places.