Go to Post This our big chance to spread the word and change the culture, let's not waste it. So in the words of one Leroy Jenkins, "Time's up, let's do this." - Frenchie461 [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 Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 01-10-2015, 13:57
xcountry413 xcountry413 is offline
Registered User
FRC #2022
 
Join Date: Oct 2015
Location: Aurora
Posts: 2
xcountry413 is an unknown quantity at this point
Code Not Uploading to Bot

I'm a new programmer for my team and am having trouble uploading code to the bot. The output of the program is:
Code:
run:
java.lang.ExceptionInInitializerError
Caused by: edu.wpi.first.wpilibj.util.BaseSystemNotInitializedException: The Interface for the HLUsageReporting was never set.
	at edu.wpi.first.wpilibj.HLUsageReporting.reportScheduler(HLUsageReporting.java:21)
	at edu.wpi.first.wpilibj.command.Scheduler.<init>(Scheduler.java:92)
	at edu.wpi.first.wpilibj.command.Scheduler.getInstance(Scheduler.java:48)
	at edu.wpi.first.wpilibj.command.Subsystem.<init>(Subsystem.java:60)
	at org.usfirst.frc.team2022.robot.subsystems.TankDriveSubsystem.<init>(TankDriveSubsystem.java:21)
	at org.usfirst.frc.team2022.robot.Robot.<clinit>(Robot.java:25)
Exception in thread "main" Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)
I'm not sure what the HLUsageReporting is and what the exception is saying.

Here's the code for the main class:
Code:
package org.usfirst.frc.team2022.robot;

import org.usfirst.frc.team2022.robot.commands.CompressorCommand;
import org.usfirst.frc.team2022.robot.commands.ForkliftCommand;
import org.usfirst.frc.team2022.robot.commands.IntakeCommand;
import org.usfirst.frc.team2022.robot.commands.TankDriveCommand;
//import org.usfirst.frc.team2022.robot.commands.autonomous.Autonomous;
import org.usfirst.frc.team2022.robot.subsystems.ForkliftSubsystem;
import org.usfirst.frc.team2022.robot.subsystems.GyroSubsystem;
import org.usfirst.frc.team2022.robot.subsystems.IntakeSubsystem;
import org.usfirst.frc.team2022.robot.subsystems.TankDriveSubsystem;

import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.command.Scheduler;

/**
 * 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 final TankDriveSubsystem tankSubsystem = new TankDriveSubsystem();
	public static final ForkliftSubsystem forkliftSubsystem = new ForkliftSubsystem();
	public static final GyroSubsystem gyroSubsystem = new GyroSubsystem();
	public static OI oi;
	public static final IntakeSubsystem intakeSubsystem = new IntakeSubsystem();

//	CommandGroup autonomousCommand;
	TankDriveCommand tankCommand;
	ForkliftCommand forkliftCommand;
	IntakeCommand intakeCommand;
	CompressorCommand compressorCommand;

	/**
	 * This function is run when the robot is first started up and should be
	 * used for any initialization code.
	 */
	@Override
	public void robotInit() {
		oi = new OI();
		// instantiate the command used for the autonomous period
//		autonomousCommand = new Autonomous();
		// instantiate the real commands
		tankCommand = new TankDriveCommand();
		forkliftCommand = new ForkliftCommand();
		intakeCommand = new IntakeCommand();
		compressorCommand = new CompressorCommand();
	}

	@Override
	public void disabledPeriodic() {
		Scheduler.getInstance().run();
	}

	@Override
	public void autonomousInit() {
		// schedule the autonomous command
//		if (autonomousCommand != null)
//			autonomousCommand.start();
	}

	/**
	 * This function is called periodically during autonomous
	 */
	@Override
	public void autonomousPeriodic() {
		Scheduler.getInstance().run();
	}

	@Override
	public void teleopInit() {
//		if (autonomousCommand != null)
//			autonomousCommand.cancel();
		tankCommand.start();
		forkliftCommand.start();
		intakeCommand.start();
		compressorCommand.start();
	}

	/**
	 * This function is called when the disabled button is hit. You can use it
	 * to reset subsystems before shutting down.
	 */
	@Override
	public void disabledInit() {
		//
	}

	/**
	 * This function is called periodically during operator control
	 */
	@Override
	public void teleopPeriodic() {
		Scheduler.getInstance().run();
	}

	/**
	 * This function is called periodically during test mode
	 */
	@Override
	public void testPeriodic() {
	}
}
The error in the subsystem is at the constructor of the class. Any help is appreciated
Reply With Quote
  #2   Spotlight this post!  
Unread 01-10-2015, 14:44
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,574
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: Code Not Uploading to Bot

What's in TankDriveSubsystem.java, particularly line 21?

Is it (wild stab in the dark) trying to schedule its autonomous actions?
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.
Reply With Quote
  #3   Spotlight this post!  
Unread 01-10-2015, 17:30
xcountry413 xcountry413 is offline
Registered User
FRC #2022
 
Join Date: Oct 2015
Location: Aurora
Posts: 2
xcountry413 is an unknown quantity at this point
Re: Code Not Uploading to Bot

It's actually the constructor of the class. Here's the code:
Code:
package org.usfirst.frc.team2022.robot.subsystems;


import org.usfirst.frc.team2022.robot.RobotMap;
import org.usfirst.frc.team2022.robot.commands.TankDriveCommand;

import edu.wpi.first.wpilibj.Encoder;
import edu.wpi.first.wpilibj.Talon;
import edu.wpi.first.wpilibj.command.Subsystem;

/**
 *
 */
public class TankDriveSubsystem extends Subsystem {
	private final Talon frontLeft, frontRight, rearLeft, rearRight;
	private double leftSpeed, rightSpeed;
	private boolean inverted;
	private long lastTime;
	private Encoder encoder;

	public TankDriveSubsystem(){
		// SmartDashboard.putString("TankDrive", "SUBSYSTEM_INIT"); //Will
		// crash. TODO: fix?
            frontLeft = new Talon(RobotMap.leftMotorFront);
            frontRight = new Talon(RobotMap.rightMotorFront);
            rearLeft = new Talon(RobotMap.leftMotorBack);
            rearRight = new Talon(RobotMap.rightMotorBack);

            inverted = false;
            lastTime = System.currentTimeMillis();
		
//		encoder = new Encoder(RobotMap.encoder1, RobotMap.encoder2, false);
//		encoder.setDistancePerPulse(4.7);
//		encoder.setDistancePerPulse((6 * Math.PI) / 360); //No idea if this is right, diameter * pi / pulses per revolution. Change to correct measurements
//		
//		encoder.reset();
		
	}
	
	public double getEncoderDistance(){
		return encoder.getDistance();
	}
	
	public void resetEncoder(){
		encoder.reset();
	}

	@Override	
	// this is important for WPILib.
	public void initDefaultCommand() {
		setDefaultCommand(new TankDriveCommand());

	}

	// Speed Manipulation Methods-these are more fine grained
	public double getLeftSpeed() {
		return leftSpeed;
	}

	public double getRightSpeed() {
		return rightSpeed;
	}

	public void setLeftSpeed(double ls) {
		leftSpeed = ls;
		frontLeft.set(ls);
		rearLeft.set(ls);
	}

	public void setRightSpeed(double rs) {
		rightSpeed = rs;
		frontRight.set(rs);
		rearRight.set(rs);
	}

	// Inversion
	public boolean isInverted() {
		return inverted;
	}

	public void toggleInversion() {
		if (System.currentTimeMillis() > lastTime + 250) {
			lastTime = System.currentTimeMillis();
			inverted = !inverted;
			leftSpeed *= -1;
			rightSpeed *= -1;
		}
	}

	// Forwards and Reverse Control for each side.
	public void stop() {
		frontRight.set(0);
		frontLeft.set(0);
		rearRight.set(0);
		rearLeft.set(0);
		rightSpeed = 0;
		leftSpeed = 0;
	}
}
Reply With Quote
  #4   Spotlight this post!  
Unread 01-10-2015, 18:00
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,574
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: Code Not Uploading to Bot

Looking at our code for last year, we declared our subsystems as public static (though not final), then initialized them (set them = new Subsystem()) in robotInit() rather than the declaration line. Your usage appears to me to be correct, but I see that we didn't do it that way; there may be a good reason. Perhaps static initializers don't work correctly on subsystems?
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.
Reply With Quote
  #5   Spotlight this post!  
Unread 02-10-2015, 09:41
JesseK's Avatar
JesseK JesseK is offline
Expert Flybot Crasher
FRC #1885 (ILITE)
Team Role: Mentor
 
Join Date: Mar 2007
Rookie Year: 2005
Location: Reston, VA
Posts: 3,637
JesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond repute
Re: Code Not Uploading to Bot

This particular error is happening at the instantiation of the parent of TankDriveSubsystem.

Since the declaration for TankDriveSubsystem is the very first static declaration of your main class, I suspect it has little to do with your code and more to do with your environment. I don't know FRC code specifically, but I'd start by figuring out what extends HLUsageReporting and figure out what's missing from your runtime classpath from there.

From the robot, verify that the jars on the classpath actually exist. From Eclipse verify that everything on that classpath is correct (nothing's missing). I don't know the WPILib toolchain, but you may also have the wrong parameters in your build.
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 10:21.

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