View Full Version : No Code in Driver Station!
BrighidKHeh
16-02-2015, 17:58
I run the code perfectly in Eclipse. There are no errors or warning in the code. When I run the code, the buildpath says "Remote command failed with exit status 1". The code still builds successfully even with this error. When I get to the Driver Station, I have no Robot Code. I receive the following error:
ERROR Unhandled exception instantiating robot org.usfirst.frc.team3871.robot.Robotjava.lang.Clas sNotFoundException: org.usfirst.frc.team3871.robot.Robot at [java.net.URL.ClassLoader$1.run(URLClassLoader.java :372), java.net.URL.ClassLoader$1.run(URLClassLoader.java :361), java.security.AccessController.doPriveleged(Native Method), java.net.URLClassLoader.findClass(URLClassLoader.j ava:360),java.lang.ClassLoader.loadClass(ClassLoad er.java:424), sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:308), java.lang.ClassLoader.loadClass(ClassLoader.java:3 57), java.lang.Class.forName0(NativeMethod), java.lang.forName(Class.java:259), edu.wpi.first.wpilibi.RobotBase.main(RobotBase.jav a:197)]
I have tried renaming the packages, I have tried scanning the code, and I even fixed an issue in the build path.
gbear605
16-02-2015, 18:08
Our team had the same error when our package structure was named incorrectly. If it's not currently the case, replace the lines
package=SOMETHING
robot.class=SOMETHING with package=org.usfirst.frc.team3871.robot
robot.class=${package}.Robot
This is in build.properties.
BrighidKHeh
16-02-2015, 18:45
Everything is already correct in build.properties
The best thing to do is start with a very barebones version of code. Make sure that works. Then, add each part to your code in and test it after each addition. Otherwise, could you post some code so we can help you?
Ben Wolsieffer
16-02-2015, 20:06
Are you sure your robot class is actually called "Robot" in the "org.usfirst.frc.team3871.robot" package?
BrighidKHeh
16-02-2015, 20:50
Yes,I'm sure it's labeled Robot
Ben Wolsieffer
16-02-2015, 20:54
Yes,I'm sure it's labeled Robot
And the package is "org.usfirst.frc.team3871.robot"? Sorry for pestering, but that is usually the cause of this problem.
BrighidKHeh
16-02-2015, 23:07
Yes it is
We cannot help you until you give us the code.
BrighidKHeh
16-02-2015, 23:28
IO? Robot? RobotMap? Build? Subsystems? Commands? There are no errors within the code itself. None that are marked, at least.
IO? Robot? RobotMap? Build? Subsystems? Commands? There are no errors within the code itself. None that are marked, at least.
I have seen that error a few times now. It is always a code error. For a while, we were getting that error because our ultrasonics weren't working correctly.
BrighidKHeh
17-02-2015, 16:35
Robot.java:
package org.usfirst.frc.team3871.Trojans2015.robot;
import org.usfirst.frc.team3871.Trojans2015.commands.Auto nomous;
import org.usfirst.frc.team3871.Trojans2015.robot.IO;
import org.usfirst.frc.team3871.Trojans2015.subsystems.Dr iveTrain;
import org.usfirst.frc.team3871.Trojans2015.subsystems.No odleAndToteSystems;
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.command.Scheduler;
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
/**
* The VM is configured to automatically run this class, and to call the
* functions corresponding to each mode, as described in the IterativeRobot
* 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 Robot extends IterativeRobot {
public static Object NoodleAndToteSystem;
public static Autonomous Autonomous;
public static IO io;
public static DriveTrain driveTrain;
public static NoodleAndToteSystems noodleAndToteSystems;
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
* @param Autonomous
*/
public void robotInit(Autonomous Autonomous) {
RobotMap.init();
driveTrain = new DriveTrain();
noodleAndToteSystems = new NoodleAndToteSystems();
// This MUST be here. If the OI creates Commands (which it very likely
// will), constructing it during the construction of CommandBase (from
// which commands extend), subsystems are not guaranteed to be
// yet. Thus, their requires() statements may grab null pointers. Bad
// news. Don't move it.
io = new IO();
// instantiate the command used for the autonomous period
Autonomous = new Autonomous();
}
public void autonomousInit() {
// schedule the autonomous command (example)
if (Autonomous!= null) Autonomous.start();
}
/**
* This function is called periodically during autonomous
*/
public void autonomousPeriodic() {
Scheduler.getInstance().run();
}
public void teleopInit() {
// This makes sure that the autonomous stops running when
// teleop starts running. If you want the autonomous to
// continue until interrupted by another command, remove
// this line or comment it out.
if (Autonomous != null) Autonomous.cancel();
}
/**
* This function is called periodically during operator control
*/
public void teleopPeriodic() {
Scheduler.getInstance().run();
}
/**
* This function called periodically during test mode
*/
public void testPeriodic() {
LiveWindow.run();
}
}
IO.java
package org.usfirst.frc.team3871.Trojans2015.robot;
//import org.usfirst.frc3871.Trojans3.commands.*;
import org.usfirst.frc.team3871.Trojans2015.commands.Auto nomous;
import org.usfirst.frc.team3871.Trojans2015.commands.Nood leBottomSystem;
import edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.Sendable;
import edu.wpi.first.wpilibj.buttons.JoystickButton;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboar d;
//import edu.wpi.first.wpilibj.smartdashboard.SmartDashboar d;
//import edu.wpi.first.wpilibj.*;
//import edu.wpi.first.wpilibj.Joystick;
//import edu.wpi.first.wpilibj.buttons.*;
/**
* This class is the glue that binds the controls on the physical operator
* interface to the commands and command groups that allow control of the robot.
* @param <Joystick>
* @param <JoystickButton>
* @param <limitSwitch>
*/
public class IO {
//// CREATING BUTTONS
// One type of button is a joystick button which is any button on a joystick.
// You create one by telling it which joystick it's on and which button
// number it is.
// Joystick stick = new Joystick(port);
// Button button = new JoystickButton(stick, buttonNumber);
// Another type of button you can create is a DigitalIOButton, which is
// a button or switch hooked up to the cypress module. These are useful if
// you want to build a customized operator interface.
// Button button = new DigitalIOButton(1);
// There are a few additional built in buttons you can use. Additionally,
// by subclassing Button you can create custom triggers and bind those to
// commands the same as any other Button.
//// TRIGGERING COMMANDS WITH BUTTONS
// Once you have a button, it's trivial to bind it to a button in one of
// three ways:
// Start the command when the button is pressed and let it run the command
// until it is finished as determined by it's isFinished method.
// button.whenPressed(new ExampleCommand());
// Run the command while the button is being held down and interrupt it once
// the button is released.
// button.whileHeld(new ExampleCommand());
// Start the command when the button is released and let it run the command
// until it is finished as determined by it's isFinished method.
// button.whenReleased(new ExampleCommand());
public Joystick rightJoystick;
public JoystickButton NoodleBottomMotorsOn;
public JoystickButton NoodleTopMotorsOn;
public Joystick ArmUpDown;
public Joystick leftJoystick;
public DigitalInput limitSwitch1;
public DigitalInput limitSwitch2;
public DigitalInput limitSwitch3;
public DigitalInput limitSwitch4;
public IO() {
rightJoystick = new Joystick(1);
leftJoystick = new Joystick(2);
NoodleBottomMotorsOn = new JoystickButton(rightJoystick, 3);
NoodleBottomMotorsOn.whileHeld(new NoodleBottomSystem());
NoodleTopMotorsOn = new JoystickButton(rightJoystick, 2);
ArmUpDown = new Joystick(1);
limitSwitch1 = new DigitalInput(1);
limitSwitch2 = new DigitalInput(2);
limitSwitch3 = new DigitalInput(3);
limitSwitch4 = new DigitalInput(4);
// SmartDashboard Buttons
SmartDashboard.putData("Autonomous", (Sendable) new Autonomous());
SmartDashboard.putData("Drive With Joysticks", (Sendable) new org.usfirst.frc.team3871.Trojans2015.commands.Driv eWithJoysticks());
SmartDashboard.putData("Noodle Bottom Motors On", (Sendable) new org.usfirst.frc.team3871.Trojans2015.commands.Nood leBottomSystem());
SmartDashboard.putData("Noodle Top Motors On", (Sendable) new org.usfirst.frc.team3871.Trojans2015.commands.Nood leTopSystem());
SmartDashboard.putData("Arm Up", (Sendable) new org.usfirst.frc.team3871.Trojans2015.commands.ArmU p());
}
public Joystick getrightJoystick() {
return rightJoystick;
}
/**
*
* @return
*/
public Joystick getleftJoystick() {
return leftJoystick;
}
}
RobotMap.java
package org.usfirst.frc.team3871.Trojans2015.robot;
import edu.wpi.first.wpilibj.*;
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
/**
* The RobotMap is a mapping from the ports sensors and actuators are wired into
* to a variable name. This provides flexibility changing wiring, makes checking
* the wiring easier and significantly reduces the number of magic numbers
* floating around.
*/
public class RobotMap {
public static SpeedController driveTrainFrontRightMotor;
public static SpeedController driveTrainFrontLeftMotor;
public static RobotDrive driveTrainRobotDrive41;
public static SpeedController toteLiftSystemArmMotor;
public static SpeedController noodleWheel1SystemMotor;
public static SpeedController noodleWheel2SystemMotor;
public static SpeedController noodleWheel3SystemMotor;
public static RobotDrive noodleBottomSystemMotor;
public static RobotDrive noodleTopSystemMotor;
public static SpeedController ArmMotor;
public static void init() {
driveTrainFrontRightMotor = new Talon(1);
LiveWindow.addActuator("Drive Train", "Front Right Motor", (Talon) driveTrainFrontRightMotor);
driveTrainFrontLeftMotor = new Talon(2);
LiveWindow.addActuator("Drive Train", "Front Left Motor", (Talon) driveTrainFrontLeftMotor);
noodleWheel1SystemMotor = new Talon(3);
LiveWindow.addActuator("NoodleAndToteSystem", "Wheel 1 System", (Talon) noodleWheel1SystemMotor);
noodleWheel2SystemMotor = new Jaguar(4);
LiveWindow.addActuator("NoodleAndToteSystem", "Wheel 2 System", (Jaguar) noodleWheel2SystemMotor);
noodleWheel3SystemMotor = new Jaguar(5);
LiveWindow.addActuator("NoodleAndToteSystem", "Wheel 3 System", (Jaguar) noodleWheel3SystemMotor);
ArmMotor = new Talon(6);
LiveWindow.addActuator("NoodleAndToteSystem", "Tote Lift System", (Talon) ArmMotor);
driveTrainRobotDrive41 = new RobotDrive(driveTrainFrontLeftMotor,
driveTrainFrontRightMotor);
driveTrainRobotDrive41.setSafetyEnabled(true);
driveTrainRobotDrive41.setExpiration(0.1);
driveTrainRobotDrive41.setSensitivity(0.5);
driveTrainRobotDrive41.setMaxOutput(1.0);
}
}
Build Properties
# Project specific information
package=org.usfirst.frc.team3871.robot
robot.class=${package}.Robot
simula/worlds/Geation.world.file=/usr/share/frcsimrsBotDemo.world
Cel Skeggs
18-02-2015, 11:47
package org.usfirst.frc.team3871.Trojans2015.robot;
...
package=org.usfirst.frc.team3871.robot
I suspect that this would be your problem. Your package is clearly not just "org.usfirst.frc.team3871.robot". "Trojans2015" is still part of the package name.
(Also, for future reference, package name elements are usually lower-case: org.usfirst.frc.team3871.trojans2015.robot.)
BrighidKHeh
23-02-2015, 16:46
I fixed that. It still didn't work.
The best thing to do is start with a very barebones version of code. Make sure that works. Then, add each part to your code in and test it after each addition. Otherwise, could you post some code so we can help you?
Did you try this yet?
I have tried renaming the packages, I have tried scanning the code, and I even fixed an issue in the build path.
Which issue did you fix? The robot project won't work right if you rename classes, change packages, or mess with the build path.
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.