Go to Post Real engineers don't need sleep... Just ask our bosses! - Mike Betts [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

 
 
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 02-12-2013, 15:58
PANTHERPROJECT's Avatar
PANTHERPROJECT PANTHERPROJECT is offline
Registered User
FRC #2064 (The Panther Project)
Team Role: Webmaster
 
Join Date: Dec 2013
Rookie Year: 2007
Location: Southbury, Middlebury
Posts: 14
PANTHERPROJECT will become famous soon enoughPANTHERPROJECT will become famous soon enough
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
Reply With Quote
 


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 08:40.

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