Go to Post If there are no top tier teams, then who do we look up to for inspiration? - artdutra04 [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

 
Reply
Thread Tools Rating: Thread Rating: 4 votes, 5.00 average. Display Modes
  #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
  #2   Spotlight this post!  
Unread 10-02-2015, 23:01
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,586
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Unhandled exception instantiating robot: No Robot Code

Did you rename your main class after creating the project?
Reply With Quote
  #3   Spotlight this post!  
Unread 10-02-2015, 23:06
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
Re: Unhandled exception instantiating robot: No Robot Code

Yes, I did. I renamed it Robot15 from Robot.
Reply With Quote
  #4   Spotlight this post!  
Unread 10-02-2015, 23:12
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
Re: Unhandled exception instantiating robot: No Robot Code

Do you think that maybe by changing the main classes name the RobotBase.class can't call it by name?
Reply With Quote
  #5   Spotlight this post!  
Unread 10-02-2015, 23:14
MrRoboSteve MrRoboSteve is offline
Mentor
AKA: Steve Peterson
FRC #3081 (Kennedy RoboEagles)
Team Role: Mentor
 
Join Date: Mar 2012
Rookie Year: 2011
Location: Bloomington, MN
Posts: 581
MrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond repute
Re: Unhandled exception instantiating robot: No Robot Code

If you create a new project from the template, and deploy it to the robot, does it have the same behavior?
__________________
2016-17 events: 10000 Lakes Regional, Northern Lights Regional, FTC Burnsville Qualifying Tournament

2011 - present · FRC 3081 Kennedy RoboEagles mentor
2013 - present · event volunteer at 10000 Lakes Regional, Northern Lights Regional, North Star Regional, Lake Superior Regional, Minnesota State Tournament, PNW District 4 Glacier Peak, MN FTC, CMP
http://twitter.com/MrRoboSteve · www.linkedin.com/in/speterson
Reply With Quote
  #6   Spotlight this post!  
Unread 10-02-2015, 23:16
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
Re: Unhandled exception instantiating robot: No Robot Code

It should since the initial project was created by me as well. But that's just my logic, I'm not 100% certain.
Reply With Quote
  #7   Spotlight this post!  
Unread 10-02-2015, 23:17
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
Re: Unhandled exception instantiating robot: No Robot Code

I also deleted the other templates so that they wouldn't conflict with the current code, so there is only one project.
Reply With Quote
  #8   Spotlight this post!  
Unread 11-02-2015, 09:20
nickmcski nickmcski is offline
Registered User
AKA: Nicholas McCurry
FRC #1482 (Grandin Ghosts)
Team Role: Alumni
 
Join Date: Nov 2012
Rookie Year: 2012
Location: Canada
Posts: 112
nickmcski has a spectacular aura aboutnickmcski has a spectacular aura aboutnickmcski has a spectacular aura about
If you renamed the main project then you need to change the build settings since it's still looking for your code in the Robot.java class
Reply With Quote
  #9   Spotlight this post!  
Unread 11-02-2015, 11:06
Ben Wolsieffer Ben Wolsieffer is offline
Dartmouth 2020
AKA: lopsided98
FRC #2084 (Robots by the C)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Manchester, MA (Hanover, NH)
Posts: 520
Ben Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud of
Re: Unhandled exception instantiating robot: No Robot Code

If you rename the Robot class, you need to change the settings in the build.properties file of your project.
__________________



2016 North Shore District - Semifinalists and Excellence in Engineering Award
2015 Northeastern University District - Semifinalists and Creativity Award
2014 Granite State District - Semifinalists and Innovation in Control Award
2012 Boston Regional - Finalists
Reply With Quote
  #10   Spotlight this post!  
Unread 11-02-2015, 14:46
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
Re: Unhandled exception instantiating robot: No Robot Code

Could you give the steps to doing this, I would really appreciate it. Thanks in advance.
Reply With Quote
  #11   Spotlight this post!  
Unread 13-02-2015, 10:57
Pratik Kunapuli's Avatar
Pratik Kunapuli Pratik Kunapuli is offline
Probably browning-out on Astro-Turf
FRC #1648 (G3 Robotics)(EWCP)
Team Role: Mentor
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Atlanta, GA
Posts: 143
Pratik Kunapuli is a name known to allPratik Kunapuli is a name known to allPratik Kunapuli is a name known to allPratik Kunapuli is a name known to allPratik Kunapuli is a name known to allPratik Kunapuli is a name known to all
Re: Unhandled exception instantiating robot: No Robot Code

Here is how to solve this issue:

Open Eclipse and in the package explorer on the left side of the screen, click the arrow next to the name of your project. Towards the bottom of the new entries, you should see a file called "build.properties". Double click on that file to open it. Now, where it says "package=", write the package that your main class is in after the "=", and where it says "robot.class=${package}.Robot", change whatever is after the "." to what your main class is called. We had this exact same issue and these are the steps we took to solve it.
__________________
Official Driving Record: 101-59-0
2012-2015 Student 341 Miss Daisy
2015-Current Mentor 1648 G3 Robotics
Reply With Quote
  #12   Spotlight this post!  
Unread 15-02-2015, 21:43
JacobD's Avatar
JacobD JacobD is offline
Registered User
AKA: Jacob
FRC #1672 (Mahwah Robo T-Birds)
Team Role: Leadership
 
Join Date: Jan 2015
Rookie Year: 2013
Location: New Jersey
Posts: 93
JacobD is an unknown quantity at this point
Re: Unhandled exception instantiating robot: No Robot Code

I had the same error for a while. If you find that the DS is telling you to look in RobotBase.java, then it is an error on your end. Try checking all pwm channels that you are using and maybe changing them out. I'm not sure if there is a specific reason why you are using higher numbered pwm channels. But, 0-3 should work perfectly.
Reply With Quote
Reply


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 18:05.

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