Go to Post I suspect the GDC is enjoying watching teams wrap their heads around this ranking algorithm.... and is probably a bit surprised that it has taken teams so long to clue in to the options this ranking system presents to them. - dtengineering [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

 
 
 
Thread Tools Rating: Thread Rating: 4 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 10-02-2015, 22:21
Zalmay's Avatar
Zalmay Zalmay is offline
Registered User
FRC #4528
 
Join Date: Feb 2015
Location: United States
Posts: 11
Zalmay is an unknown quantity at this point
Unhandled exception instantiating robot: No Robot Code

Hello again, I am a member of team 4528 and recently we ran into some issues with putting code into the roboRio. Since then we have called National Instruments and re-imaged the roboRio and re-installed the java 8 jdk. We initially thought that this would clear the roboRio and that it would work again since we heard that we may have caused the code to crash by building conflicting codes. However even after the wipe the following error appeared in the DriverStation logs:

Code:
ERROR Unhandled exception instantiating robot org.usfirst.frc.team4528.robot.Robot java.lang.ClassNotFoundException: org.usfirst.frc.team4528.robot.Robot at [java.net.URLClassLoader$1.run(URLClassLoader.java:372), java.net.URLClassLoader$1.run(URLClassLoader.java:361), java.security.AccessController.doPrivileged(Native Method), java.net.URLClassLoader.findClass(URLClassLoader.java:360), java.lang.ClassLoader.loadClass(ClassLoader.java:424), sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308), java.lang.ClassLoader.loadClass(ClassLoader.java:357), java.lang.Class.forName0(Native Method), java.lang.Class.forName(Class.java:259), edu.wpi.first.wpilibj.RobotBase.main(RobotBase.java:197)]
The eclipse compiler says that the build was successful, but then this message shows up in the eclipse compiler:

Code:
Buildfile: C:\Users\Developer\workspace\FRC2015\build.xml
Trying to override old definition of task classloader
clean:
   [delete] Deleting directory C:\Users\Developer\workspace\FRC2015\build
   [delete] Deleting directory C:\Users\Developer\workspace\FRC2015\dist
compile:
    [mkdir] Created dir: C:\Users\Developer\workspace\FRC2015\build
     [echo] [athena-compile] Compiling src with classpath=C:\Users\Developer/wpilib/java/current/lib/WPILib.jar:C:\Users\Developer/wpilib/java/current/lib/NetworkTables.jar to build
    [javac] Compiling 2 source files to C:\Users\Developer\workspace\FRC2015\build
jar:
     [echo] [athena-jar] Making jar dist/FRCUserProgram.jar.
    [mkdir] Created dir: C:\Users\Developer\workspace\FRC2015\dist
    [mkdir] Created dir: C:\Users\Developer\workspace\FRC2015\build\jars
     [echo] [athena-jar] Copying jars from C:\Users\Developer/wpilib/java/current/lib/WPILib.jar:C:\Users\Developer/wpilib/java/current/lib/NetworkTables.jar to build/jars.
     [copy] Copying 2 files to C:\Users\Developer\workspace\FRC2015\build\jars
      [jar] Building jar: C:\Users\Developer\workspace\FRC2015\dist\FRCUserProgram.jar
get-target-ip:
     [echo] Trying Target: roboRIO-4528.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-4528.local:22
  [sshexec] cmd : test -d /usr/local/frc/JRE
deploy:
     [echo] [athena-deploy] Copying code over.
      [scp] Connecting to roboRIO-4528.local:22
      [scp] done.
      [scp] Connecting to roboRIO-4528.local:22
      [scp] done.
     [echo] [athena-deploy] Starting program.
  [sshexec] Connecting to roboRIO-4528.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 1470: No such process
BUILD SUCCESSFUL
Total time: 25 seconds
For those of you who are interested in our code these are the ones we used:
Note: we are using code that was previously functional.

Code:
package org.usfirst.frc.team4528.robot;


import edu.wpi.first.wpilibj.Joystick;

import edu.wpi.first.wpilibj.RobotDrive;

import edu.wpi.first.wpilibj.SampleRobot;

import edu.wpi.first.wpilibj.Victor;

import edu.wpi.first.wpilibj.Timer;

public class Robot15 extends SampleRobot {

			Victor frontLeft;
		
			Victor rearLeft;

			Victor frontRight;

			Victor rearRight;

			Victor motor;	//add-on
		
			RobotDrive myRobot;	// class that handles basic drive operations
	    
			XBoxJoystick gamepad;	// declare gamepad as a Joystick object to get Joystick functionality, but with different buttons

		public void Robot()
		{
	    	
			frontLeft = new Victor(9);	//change port to appropriate PWM port on roboRIO
	    	
			rearLeft = new Victor(8);	//change port to appropriate PWM port on roboRIO
	    	
			frontRight = new Victor(7);	//change port to appropriate PWM port on roboRIO
	    	
			rearRight = new Victor(6);	//change port to appropriate PWM port on roboRIO

			motor = new Victor(5);		//add-on
	        
			myRobot = new RobotDrive(frontLeft, rearLeft, frontRight, rearRight);	// robot drivetrain functionality; takes in front left motor, rear left motor, front right motor, rear right motor ports
	        
			gamepad = new XBoxJoystick(0);	// port gamepad is plugged into

	    	}

		//add-on
	    

		public void runMotor()
	    
		{

	        	if(gamepad.getLeftZ() > 0)

	        	{

	        		motor.set(gamepad.getLeftZ());

	        	}

	        	else if(gamepad.getRightZ() > 0)

	        	{

	        		motor.set(-gamepad.getRightZ());

	        	}

	        	else

	        	{

	        		motor.set(0.0);

	        	}
	    
		}

	//end of...
	    

	/**
	     
	 * Runs the motors with tank steering.
	     
	 */
	    
		public void operatorControl() 
		{

	        	myRobot.setSafetyEnabled(false);
	        
			while (isOperatorControl() && isEnabled()) 
			{

				//myRobot.tankDrive(gametpad.getLeftY(), gamepad.getRightY());
	        	
				myRobot.tankDrive(gamepad.getRightY(), gamepad.getLeftY());
	            
				Timer.delay(0.005);		// wait for a motor update time
				
				gamepad.getAButton();
	            
				runMotor();
	            
	        
			}
	    
		}


}
Code:
package org.usfirst.frc.team4528.robot;

import edu.wpi.first.wpilibj.Joystick;

public class XBoxJoystick {
    private Joystick joystick;
    private int port;

    private final double DEAD_ZONE = 0.08; // Chief Delphi said 0.05;

    public XBoxJoystick(int port) {
            this.port = port;
            this.joystick = new Joystick(port);
    }

    public double getLeftX() {
            return correctDeadSpot(joystick.getRawAxis(0));
    }

    public double getLeftY() {
            return correctDeadSpot(joystick.getRawAxis(1));
    }

    public double getLeftZ() {
        return joystick.getRawAxis(2);
    }
    
    public double getRightZ() 
    {
        return joystick.getRawAxis(3);
    }

    public double getRightX() {
            return correctDeadSpot(joystick.getRawAxis(4));
    }

    public double getRightY() {
            return correctDeadSpot(joystick.getRawAxis(5));
    }

    public double getDpadX() {
            return joystick.getRawAxis(6);
    }

    // WARNING this doesn't work with vanilla driver station
    public double getDpadY() {
            return joystick.getRawAxis(7);
    }

    public boolean getAButton() {
            return getButton(1);
    }

    public boolean getBButton() {
            return getButton(2);
    }

    public boolean getXButton() {
            return getButton(3);
    }

    public boolean getYButton() {
            return getButton(4);
    }

    public boolean getLBButton() {
            return getButton(5);
    }

    public boolean getRBButton() {
            return getButton(6);
    }

    public boolean getBackButton() {
            return getButton(7);
    }

    public boolean getStartButton() {
            return getButton(8);
    }

    public boolean getLSButton() {
            return getButton(9);
    }

    public boolean getRSButton() {
            return getButton(10);
    }

    private double correctDeadSpot(double value) {
            if (Math.abs(value) < DEAD_ZONE)
                    return 0;
            return value;
    }

    private boolean getButton(int buttonNumber) {
            return joystick.getRawButton(buttonNumber);
    }
}
I would really appreciate if someone could explain what I did wrong and how I can fix it. I tried looking at the RobotBase.class from wpilib but couldn't really understand it, all I could gather was that the code allowed the program to compile despite some errors that normally would be caught by the compiler. Thanks in advance for the help and sorry for the long post .
Reply With Quote
 


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 12:41.

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