|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Main Robot Code NOT Working
I uploaded this code to the robot and it won't work. Also a lot of the methods such as increment() and turnRight() in Chassis are "dead code" according to Eclipse. increment() and decrement() change the value of rspeed up and down.
Here is a link to the code on gitHub: https://github.com/LFRobotics/Robot2015 THANKS for the help! |
|
#2
|
||||
|
||||
|
Re: Main Robot Code NOT Working
Okay, two easy issues to fix.
1. Code taken from DriveTele.java Code:
protected void execute() {
Robot.base.mecanumDrive(
(XBox.LEFTJOY_X+XBox.LEFTJOY_Y)/2,
(XBox.LEFTJOY_Y-XBox.LEFTJOY_X)/2,
-(XBox.LEFTJOY_Y-XBox.LEFTJOY_X)/2,
-(XBox.LEFTJOY_X+XBox.LEFTJOY_Y)/2);
}
Code:
Robot.oi.joystick.getLeftJoyX(); Code:
public void initDefaultCommand() {
// Set the default command for a subsystem here.
//setDefaultCommand(new DriveTele());
}
Also you said that increment() and decrement() are dead, but they are just commented out... |
|
#3
|
||||||
|
||||||
|
The dead code is also caused by reading joystick constants, rather the joystick values.
XBox.RIGHTJOY_Y < 0 is always false, so the code in the if statement never executed and is thus dead code. |
|
#4
|
||||
|
||||
|
Re: Main Robot Code NOT Working
I commented out one pair of increment/decrement methods but left the other pair - I was testing which one worked better.
So .LEFTJOY_X is enum but .LEFTJOY_Y is not - those are pointers to getRawAxis() in the XBox class - I will try that but I don't know if it will do anything. Why is XBox.RIGHTJOY_Y < 0 always going to be false - dont joystick axis return values from -1 to 1? How else would I make a program that would change the robots speed using the right joysticks X axis on an XBox controller? |
|
#5
|
||||
|
||||
|
Re: Main Robot Code NOT Working
Quote:
Code:
public boolean getButtonA() {
return getRawButton(A_BUTTON);
}
public boolean getButtonB() {
return getRawButton(B_BUTTON);
}
public boolean getButtonX() {
return getRawButton(X_BUTTON);
}
public boolean getButtonY() {
return getRawButton(Y_BUTTON);
}
public boolean getButtonRB() {
return getRawButton(RB_BUTTON);
}
public boolean getButtonLB() {
return getRawButton(LB_BUTTON);
}
public boolean getButtonRS() {
return getRawButton(RS_BUTTON);
}
public boolean getButtonLS() {
return getRawButton(LS_BUTTON);
}
public boolean getButtonStart() {
return getRawButton(START_BUTTON);
}
public boolean getButtonBack() {
return getRawButton(BACK_BUTTON);
}
public double getLeftJoyY() {
return getRawAxis(LEFTJOY_Y);
}
public double getLeftJoyX() {
return getRawAxis(LEFTJOY_X);
}
public double getRightJoyY() {
return getRawAxis(RIGHTJOY_Y);
}
public double getRightJoyX(){
return getRawAxis(RIGHTJOY_X);
}
public double getRightTrigger() {
return -Math.min(getRawAxis(RIGHT_TRIGGER), 0);
}
public double getLeftTrigger() {
return Math.max(getRawAxis(LEFT_TRIGGER), 0);
}
|
|
#6
|
||||
|
||||
|
Re: Main Robot Code NOT Working
Okay I changed all that.
Here's the updated code: https://github.com/LFRobotics/Robot2015 But when I upload it the DriverStation puts out an error and says the robot has no code. Eclipse Build Output: Code:
Buildfile: C:\Users\Kristen\Documents\GitHub\Robot2015\build.xml
Trying to override old definition of task classloader
clean:
[delete] Deleting directory C:\Users\Kristen\Documents\GitHub\Robot2015\build
[delete] Deleting directory C:\Users\Kristen\Documents\GitHub\Robot2015\dist
compile:
[mkdir] Created dir: C:\Users\Kristen\Documents\GitHub\Robot2015\build
[echo] [athena-compile] Compiling src with classpath=C:\Users\Kristen/wpilib/java/current/lib/WPILib.jar:C:\Users\Kristen/wpilib/java/current/lib/NetworkTables.jar to build
[javac] Compiling 12 source files to C:\Users\Kristen\Documents\GitHub\Robot2015\build
jar:
[echo] [athena-jar] Making jar dist/FRCUserProgram.jar.
[mkdir] Created dir: C:\Users\Kristen\Documents\GitHub\Robot2015\dist
[mkdir] Created dir: C:\Users\Kristen\Documents\GitHub\Robot2015\build\jars
[echo] [athena-jar] Copying jars from C:\Users\Kristen/wpilib/java/current/lib/WPILib.jar:C:\Users\Kristen/wpilib/java/current/lib/NetworkTables.jar to build/jars.
[copy] Copying 2 files to C:\Users\Kristen\Documents\GitHub\Robot2015\build\jars
[jar] Building jar: C:\Users\Kristen\Documents\GitHub\Robot2015\dist\FRCUserProgram.jar
get-target-ip:
[echo] Trying Target: roboRIO-4623.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-4623.local:22
[sshexec] cmd : test -d /usr/local/frc/JRE
deploy:
[echo] [athena-deploy] Copying code over.
[scp] Connecting to roboRIO-4623.local:22
[scp] done.
[scp] Connecting to roboRIO-4623.local:22
[scp] done.
[echo] [athena-deploy] Starting program.
[sshexec] Connecting to roboRIO-4623.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 5656: No such process
BUILD SUCCESSFUL
Total time: 11 seconds
Code:
ERROR Unhandled exception instantiating robot org.usfirst.frc.team4623.robot.Robot java.lang.ExceptionInInitializerError at [java.lang.Class.forName0(Native Method), java.lang.Class.forName(Class.java:259), edu.wpi.first.wpilibj.RobotBase.main(RobotBase.java:197)] |
|
#7
|
||||
|
||||
|
Re: Main Robot Code NOT Working
I am trying everything but I can't get it to work.
|
|
#8
|
|||||
|
|||||
|
Re: Main Robot Code NOT Working
In your Chassis class you have a RobotDrive that is using the same channels as the 4 Jaguars you created. What you want to do is pass those 4 Jaguars into the RobotDrive constructor, not pass in the channels again.
Code:
roborDrive = new RobotDrive(frontLeftMotor, rearLeftMotor, frontRightMotor, rearRightMotor); |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|