HELP MEEEEEEEEEEEEEEE!!!

my code won’t go onto roboRio, i have tried to reimage it and redownload the java, but it still won’t go on even though the code from eclispe is still running. my run log is as follows:
Buildfile: C:\Users\student\workspace\Tank Drive\build.xml
Trying to override old definition of task classloader
clean:
[delete] Deleting directory C:\Users\student\workspace\Tank Drive\build
[delete] Deleting directory C:\Users\student\workspace\Tank Drive\dist
compile:
[mkdir] Created dir: C:\Users\student\workspace\Tank Drive\build
[echo] [athena-compile] Compiling src with classpath=C:\Users\student\wpilib\java\current\lib\WPILib.jar;C:\Users\student\wpilib\java\current\lib\NetworkTables.jar;C:\Users\student\wpilib\java\current\lib\opencv.jar;C:\Users\student\wpilib\java\current\lib\cscore.jar to build
[javac] Compiling 1 source file to C:\Users\student\workspace\Tank Drive\build
jar:
[echo] [athena-jar] Making jar dist/FRCUserProgram.jar.
[mkdir] Created dir: C:\Users\student\workspace\Tank Drive\dist
[mkdir] Created dir: C:\Users\student\workspace\Tank Drive\build\jars
[echo] [athena-jar] Copying jars to build/jars.
[copy] Copying 4 files to C:\Users\student\workspace\Tank Drive\build\jars
[jar] Building jar: C:\Users\student\workspace\Tank Drive\dist\FRCUserProgram.jar
get-target-ip:
[echo] Finding roboRIO, please ignore any [hostinfo] error messages
[echo] Trying USB: 172.22.11.2
[echo] Trying mDNS: roboRIO-4598-FRC.local
[echo] Trying DNS: roboRIO-4598-FRC.lan
[echo] Trying mDNS: roboRIO-4598-FRC.frc-robot.local
[echo] roboRIO found at 172.22.11.2
dependencies:
[echo] Trying Static Ethernet: 10.45.98.2
[hostinfo] Error retrieving remote host information for host:roboRIO-4598-FRC.frc-robot.local.
[hostinfo] Error retrieving remote host information for host:roboRIO-4598-FRC.lan.
[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 172.22.11.2:22
[sshexec] cmd : test -d /usr/local/frc/JRE
deploy:
[delete] Deleting: C:\Users\student\wpilib\java\current\lib
ative\lib\WPI_Native_Libraries.properties
[scp] Connecting to 172.22.11.2:22
[scp] Receiving file: /usr/local/frc/lib/WPI_Native_Libraries.properties
[scp] Receiving: WPI_Native_Libraries.properties : 2636
[scp] File transfer time: 0.0 Average Rate: 878,666.67 B/s
[scp] done
[scp] Connecting to 172.22.11.2:22
[scp] Receiving file: /usr/local/frc/lib/User_Libraries.properties
[scp] Caught exception: scp: /usr/local/frc/lib/User_Libraries.properties: No such file or directory
[echo] [athena-deploy] Copying code over.
[scp] Connecting to 172.22.11.2:22
[scp] done.
[sshexec] Connecting to 172.22.11.2:22
[sshexec] cmd : ldconfig
[sshexec] Connecting to 172.22.11.2:22
[echo] Resolved mDNS to 172.22.11.2
[sshexec] cmd : killall -q netconsole-host || :
[delete] Deleting: C:\Users\student\wpilib\java\current\ant
etconsole-host.properties
[scp] Connecting to 172.22.11.2:22
[scp] Receiving file: /usr/local/frc/bin/netconsole-host.properties
[scp] Receiving: netconsole-host.properties : 130
[scp] File transfer time: 0.0 Average Rate: ∞ B/s
[scp] done
[scp] Connecting to 172.22.11.2:22
[scp] done.
[echo] [athena-deploy] Starting program.
[sshexec] Connecting to 172.22.11.2:22
[sshexec] cmd : . /etc/profile.d/natinst-path.sh; /usr/local/frc/bin/frcKillRobot.sh -t -r;
[sshexec] Connecting to 172.22.11.2:22
[sshexec] cmd : sync
BUILD SUCCESSFUL
Total time: 11 seconds
anyone know how to fix it?

This is also my first time doing this, so please be understanding. Also here is my code.
package org.usfirst.frc.team4598.robot;

import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.Victor;
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
{void Disabled()
{
while(isDisabled()){}
}

void RobotInit()
{

}
public void teleopInit() {

}
RobotDrive chassis=new RobotDrive(1,2);
Joystick leftStick = new Joystick(1);
Joystick rightStick = new Joystick(0);
Victor wheel=new Victor(13);
Victor Wheel=new Victor(12);	
Victor belt=new Victor(3);
Victor rightDrive = new Victor(1);
Victor leftDrive = new Victor(2);

boolean toggle = false;
double multiplierLeft = 0;
double multiplierRight = 0;
double gyroAngle;
int autoLoopCounter;

boolean hasAutoRan = false;
public void teleopPeriodic() 
{
	//Drive
		while(isOperatorControl()&&isEnabled())
	chassis.tankDrive(leftStick,rightStick);
		Wheel.set(1);
		wheel.set(1);
	if(leftStick.getRawButton(1)){
		belt.set(1);}
	else
	belt.set(0);
}

/**
 * This function is called periodically during test mode
 */

public void testPeriodic() {
LiveWindow.run();

}}

Next time, please write a less inflammatory and more helpful title to your post. It’s impossible for anyone to discern what you are asking about when you write a title like “HELP MEEEEEEEE”.

In any case, the log you posted looks to me like the log of code being successfully loaded onto the roboRIO. Does something happen when you try to run the robot that leads you to believe the code isnt’ there? Does the driver station log show any errors (e.g. null pointers, etc)?

According to the log, your code is now on the RoboRIO. Whether your code functions is another matter.

I didn’t see the code initially. A few giant things that jumped out at me:

  1. You should basically never run a while loop in this template, or any kind of loop for that matter. Your code will run iteratively / repeatedly already, you do not need or want a while loop as it will prevent any of the rest of your code from running. The watchdog will give errors here as well as you could easily create a state where you have no ability to control the robot this way.

Your while loop conditions depend on if the robot is enabled and is in teleop. teleopPeriodic will only run in this state anyway, so you do not need to check for this.

  1. You should be declaring variables / objects before you use them, ideally. You can declare them at the top of the file, above all of your functions, and then in your robotInit function you can initialize all of the variables / objects used between various states.

I only had a few minutes, I’m sure there are other things to work on.

You’re also using PWM 1 & 2 twice, once in robot drive and once for the victors.

Could you please elaborate more on what the code is intended to do?

It’s rather unclear from the actual code itself what each of the motor controllers is controlling.

the code is for a tennis ball launcher. the wheels are always spinning and the belt feeds the tennis balls to the wheels. and then it can drive around.

what is PWM? like i said, i am very new to this and had to watch a youtube video to just learn how to program the joysticks.

roborio can’t find it, though.

when you get the time, can you trouble shoot my program please? i didn’t know any of this when i started programming the robot. this helps a lot thank you so much.

also can you tell me how to initialize all of the variable in the robotInit function please? There is no guide that i know of that teaches you how to use eclipse to it’s maximum functions. if there is can you post the link please?

  1. PWM 1 / 2 refers to physical ports on the RoboRIO. You bind these multiple times, which is not allowed. PWM is short for “Pulse Width Modulation”, but that is beyond the scope of basic robot programming.

  2. Just because the Dashboard says “No Robot Code” does not mean the code is not on the RIO. It only means the code is not running. In this case, I believe your code crashed because you tried to do something which is invalid (binding a specific PWM port twice)

  3. The closest thing to a guide is the screensteps. I’d also like to point out that eclipse is only an editor. You are programming in Java using WPILib.

I apologize in advance; this may sound a little harsh. I believe, however, that it must be said.

Getting line-by-line code help is not going to help you in any capacity except, perhaps, getting this specific code to a state in which it’s (marginally) functional. You will likely not really learn anything in the process; you cannot learn to program better through having other people debug your code for you. As it is unrealistic for Chief Delphi to hold your hand through the coding of your entire robot, this is of little actual value to you or your team.

Programming is a very deep subject. It is not something you can expect to become proficient at in a short period of time, and without a lot of personal effort. Learning to program the robot is not like learning to wire up the control system. There is no set of instructions to follow.

It is very easy to learn to modify the example robot code to, sort of, do simple things that you want it to do. It is somewhat harder to learn what that code is actually doing to the extent required to be able to troubleshoot it when it goes wrong (the problem presented in this XKCD is pretty universal to the field). What’s more, you fundamentally cannot learn the latter simply by doing a lot of the former. If you are not able to figure out what’s wrong with the very small amount of code you have already written, you are quite simply not going to get anything out of robot coding at this stage.

I would suggest stepping away from robot code, for now, because you do not appear to have yet attained adequate proficiency in Java to attempt to program a robot. Spend time working your way through Java tutorials. Once you feel comfortable with Java itself, then work your way through screensteps (which has been linked in previous posts) and/or read code from other teams (a large number of teams put their code on github; it is not difficult to find).

Everything you said is 100% correct, and at the same time, I’m willing to bet this programmer is in the same situation programmers on 80+% of FRC teams are in - they are the only person even vaguely qualified to or interested in working on robot code. For most FRC programming kids, there is no more experienced person they are taking the reins from, or can ask for help.

It is really such a shame, that the FRC specific tutorials are sparse and assume a strong background in OOP and control theory. I would say “try Vex programming and then switch to FRC”, but then you’ll learn how to write Java programs as if they were embedded C (no objects, etc). I’m never sure where to direct students who are at this level of proficiency with where to go to learn more, because they likely do not have a more experienced programmer to lead on or access to any mentorship at all, and the resources for them to get from this point to even functional if ugly code are so sparse.

OP: I’ll try and walk you through what you are specifically trying to do here when I get the time, which may be a few days, and I’m far from the most qualified… It’s a tough spot you’re in, I know.

Try imagining that each PWM is really just a motor/speed controller. You can only “create” each PWM(motor/speed controller) once in code. Here is the part of your code where you are “creating” PWMs and Joysticks in your code.

RobotDrive chassis=new RobotDrive(1,2); //Creates PWM 1 and PWM 2
Joystick leftStick = new Joystick(1); //Creates Joystick 1
Joystick rightStick = new Joystick(0); //Creates Joystick 0
Victor wheel=new Victor(13); //Creates PWM 13
Victor Wheel=new Victor(12); //Creates PWM 12	
Victor belt=new Victor(3); //Creates PWM 3
Victor rightDrive = new Victor(1); //Creates PWM 1 again!!
Victor leftDrive = new Victor(2); //Creates PWM 2 again!!

As you can see, you are creating PWM 1 and PWM 2 twice in the code. This will break your code and is likely related to the errors you are seeing. Based on the rest of your code, I would remove the following lines from your code:

Victor rightDrive = new Victor(1); 
Victor leftDrive = new Victor(2);

See if doing this at least lets you run the code or gives any other errors.

EDIT: Oops, I missed the reply where you described the bot. Thanks!

I presume you are fairly new to Java code, and I’ll echo others - lots of help docs presume a mild familiarity with how Java/OOP works. Have you gone through any intro-to-java courses yet? Codeacademy has a decent one (https://www.codecademy.com/learn/learn-java) .

Our team also has a handful of presentations we’ve been developing for initial training. Perhaps you might find some use in them:

Basic Java

Using WPILib docs to determine how to write a program

When you pass PWM ports into the RobotDrive constructor like this:

RobotDrive chassis=new RobotDrive(1,2);

the RobotDrive constructor creates Talon speed controllers which most likely won’t work if you are using Victor speed controllers.

Instead, you need to pass the Victor motor controllers into the RobotDrive constructor as shown below.


Joystick leftStick = new Joystick(1); 
Joystick rightStick = new Joystick(0); 
Victor wheel=new Victor(13); 
Victor Wheel=new Victor(12); 
Victor belt=new Victor(3); 
Victor rightDrive = new Victor(1); 
Victor leftDrive = new Victor(2); 
RobotDrive chassis=new RobotDrive(leftDrive,rightDrive); 

As was mentioned previously, definitely remove this line:

while(isOperatorControl()&&isEnabled())

this is for a school project that my grade depends on. Of course i want to learn how to use eclipse properly and want to learn shortcuts for it.

If this is a school project, you should have been taught the necessary skills in class. If you haven’t been taught how to program, it is incredibly unfair for your grade to depend on said skills. I would talk to your teacher about it.