aweso_meme
10-01-2015, 14:05
Hi,
The following code does not work on the new RoboRio. The original code WORKS on the old cRIO. All I did was update how Robot Drive Works as per the WPI Screen Steps Live Website. Information as to what does not work is as follows:
1) The program builds correctly.
2) The computer connects to the Robo Rio.
3) The joystick is detected.
4) When the joystick is moved, nothing happens.
Here is my code:
package org.usfirst.frc.team4687.robot;
import edu.wpi.first.wpilibj.SampleRobot;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.*;
public class Robot extends SampleRobot
{
//Definitions
Jaguar j1 = new Jaguar(1);
Jaguar j2 = new Jaguar(2);
Jaguar j3 = new Jaguar(3);
Jaguar j4 = new Jaguar(4);
Jaguar j5 = new Jaguar(5);
Jaguar j6 = new Jaguar(6);
Jaguar j7 = new Jaguar(7);
Jaguar j8 = new Jaguar(8);
RobotDrive driveA = new RobotDrive(j1,j2,j3,j4);
RobotDrive driveB = new RobotDrive(j5,j6,j7,j8);
Joystick drivestick = new Joystick(1);
public void autonomous()
{
}
public void operatorControl()
{
//INSTANTIATION STATEMENTS
double joyX, joyY, joyZ;
if(isOperatorControl() && isEnabled())
{
//Define the dead zone for driving
if(drivestick.getX() < 0.1 && drivestick.getX() > -0.1) joyX=0;
else joyX = drivestick.getX();
if(drivestick.getY() < 0.1 && drivestick.getY() > -0.1) joyY=0;
else joyY = drivestick.getY();
if(drivestick.getZ() < 0.1 && drivestick.getZ() > -0.1) joyZ=0;
else joyZ = drivestick.getZ();
//Drive
driveA.mecanumDrive_Cartesian(joyX, joyY, joyZ, 0);
driveB.mecanumDrive_Cartesian(joyX, joyY, joyZ, 0);
}
}
public void test()
{
}
@Override
public void disabled()
{
}
}
Everything is hooked up correctly on the power distribution board and the other electronics issues. Does anyone see what is wrong?
Thanks all.
PS: Is there any way to run System.out.println() statements as there was in Netbeans? Can I just type System.out.println() and it will print to the eclipse console each time it is called?
The following code does not work on the new RoboRio. The original code WORKS on the old cRIO. All I did was update how Robot Drive Works as per the WPI Screen Steps Live Website. Information as to what does not work is as follows:
1) The program builds correctly.
2) The computer connects to the Robo Rio.
3) The joystick is detected.
4) When the joystick is moved, nothing happens.
Here is my code:
package org.usfirst.frc.team4687.robot;
import edu.wpi.first.wpilibj.SampleRobot;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.*;
public class Robot extends SampleRobot
{
//Definitions
Jaguar j1 = new Jaguar(1);
Jaguar j2 = new Jaguar(2);
Jaguar j3 = new Jaguar(3);
Jaguar j4 = new Jaguar(4);
Jaguar j5 = new Jaguar(5);
Jaguar j6 = new Jaguar(6);
Jaguar j7 = new Jaguar(7);
Jaguar j8 = new Jaguar(8);
RobotDrive driveA = new RobotDrive(j1,j2,j3,j4);
RobotDrive driveB = new RobotDrive(j5,j6,j7,j8);
Joystick drivestick = new Joystick(1);
public void autonomous()
{
}
public void operatorControl()
{
//INSTANTIATION STATEMENTS
double joyX, joyY, joyZ;
if(isOperatorControl() && isEnabled())
{
//Define the dead zone for driving
if(drivestick.getX() < 0.1 && drivestick.getX() > -0.1) joyX=0;
else joyX = drivestick.getX();
if(drivestick.getY() < 0.1 && drivestick.getY() > -0.1) joyY=0;
else joyY = drivestick.getY();
if(drivestick.getZ() < 0.1 && drivestick.getZ() > -0.1) joyZ=0;
else joyZ = drivestick.getZ();
//Drive
driveA.mecanumDrive_Cartesian(joyX, joyY, joyZ, 0);
driveB.mecanumDrive_Cartesian(joyX, joyY, joyZ, 0);
}
}
public void test()
{
}
@Override
public void disabled()
{
}
}
Everything is hooked up correctly on the power distribution board and the other electronics issues. Does anyone see what is wrong?
Thanks all.
PS: Is there any way to run System.out.println() statements as there was in Netbeans? Can I just type System.out.println() and it will print to the eclipse console each time it is called?