|
Re: Remote command failed with exit status 1
I got the following message in the DS message window:
Code:
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:
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);
}
}
}
What are we doing wrong?
__________________
2010: FRC 3043, Build Assistant
2011: FRC 3043, Head of Minibot subteam; FLL 12762, Team Captain
2012: FRC 3043, Electrical; FLL 12762, Team Captain; FTC 5670, Team Captain
2013: FRC 4301, Electrical, Team Co-Captain
2014: FRC 4301, Electrical/Programming, Team Co-Captain
2015: FRC 4301, Electrical/Programming, Team Captain
2016: FRC 4301, Chief Technical Officer; FTC 10860, 10861, and 11004: Mentor. Winner, Hub City Regional (3310 & 4063)
Last edited by Whippet : 29-01-2015 at 17:52.
Reason: Formatting
|