|
Help with Test Robot program (NetBeans)
I am running a test program on my team's test robot and the victors keep blinking even when the robot is enabled. As far as I know, the victors are not receiving information but according to my program they should. I've been working to solve this problem for a very long time now so I've changed the victors, PWM and wires but still no luck. I don't think there is a problem with program but here it is:
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.GenericHID;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.Victor;
//import edu.wpi.first.wpilibj.PWM;
import edu.wpi.first.wpilibj.RobotBase;
import edu.wpi.first.wpilibj.SpeedController;
import edu.wpi.first.wpilibj.Timer;
/**
* 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 TestRobot extends RobotBase {
private static RobotDrive driveTrain;
private static GenericHID leftJoystick;
private static GenericHID rightJoystick;
private SpeedController leftVictor;
private SpeedController rightVictor;
//private static PWM rightPWM;
//private static PWM leftPWM;
private boolean m_robotMainOverridden;
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
public void robotInit() {
driveTrain = new RobotDrive(2,1);
leftJoystick = new Joystick(2);
leftVictor = new Victor (1);
//leftPWM = new PWM (2);
rightJoystick = new Joystick(1);
rightVictor = new Victor (1);
//rightPWM = new PWM (1);
}
/**
* This function is called periodically during autonomous
*/
public void autonomousPeriodic() {
}
/**
* This function is called periodically during operator control
*/
public void teleopPeriodic() {
getWatchdog().setEnabled(true);
getWatchdog().setExpiration(0.2);
while (isOperatorControl() && isEnabled()) {
//driveTrain.arcadeDrive(rightJoystick);
driveTrain.tankDrive(leftJoystick, rightJoystick);
if(leftJoystick.getTrigger())
{
leftVictor.set(0.7);
}
else
{
leftVictor.set(0.0);
}
if(rightJoystick.getTrigger())
{
rightVictor.set(0.7);
}
else
{
rightVictor.set(0.0);
}
}
getWatchdog().feed();
}
public void robotMain() { // supplied default robotMain
System.out.println("Information: No user-supplied robotMain()");
m_robotMainOverridden = false;
}
public void autonomous() { // supplied default autonomous()
System.out.println("Provided Autonomous() method running");
}
public void operatorControl() { // suppled default operatorControl()
System.out.println("Provided OperatorControl() method running");
}
public void startCompetition() {
robotMain();
if (!m_robotMainOverridden) {
while(true) {
// Wait for robot to be enabled
while (isDisabled()) {
Timer.delay(.01);
}
// Now enabled - check if we should run Autonomous code
if (isAutonomous()) {
autonomous();
while (isAutonomous() && !isDisabled()) {
Timer.delay(.01);
}
} else {
operatorControl(); // run the operator control method
while (isOperatorControl() && !isDisabled()) {
Timer.delay(.01);
}
}
}
}
}
}
please give me any advice that you can come up with thank you!
- Team 2064
Captain/Programmer
|