DPG2013
21-02-2012, 13:44
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.Jaguar;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.SimpleRobot;
/**
* The VM is configured to automatically run this class, and to call the
* functions corresponding to each mode, as described in the SimpleRobot
* 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 Team4163 extends SimpleRobot {
/**
* This function is called once each time the robot enters autonomous mode.
*/
Joystick leftStick;
Joystick rightStick;
Jaguar arm;
Jaguar claw;
Jaguar launcher;
RobotDrive drive;
Jaguar launcherOpposite;
boolean constant = true;
double LAUNCH_CONSTANT = 0.5;
public Team4163 () {
leftStick = new Joystick(1);
rightStick = new Joystick(2);
drive = new RobotDrive(1,2);
drive.setInvertedMotor(RobotDrive.MotorType.kFront Left, true);
drive.setInvertedMotor(RobotDrive.MotorType.kFront Right, true);
drive.setInvertedMotor(RobotDrive.MotorType.kRearL eft, true);
drive.setInvertedMotor(RobotDrive.MotorType.kRearR ight, true);
arm = new Jaguar (3);
claw = new Jaguar(4);
launcher = new Jaguar(5);
launcherOpposite = new Jaguar (6);
}
public void autonomous() {
}
///This function is called once each time the robot enters operator control.
public void operatorControl() {
drive.setSafetyEnabled(true);
while (isOperatorControl())
{
drive.tankDrive(leftStick, rightStick);
}
drive.setSafetyEnabled(true);
drive.tankDrive(leftStick, rightStick);
double z = leftStick.getZ();
while(constant = true)
{
if (z > 0.5)
{
launcher.set(LAUNCH_CONSTANT * 2);
launcherOpposite.set(LAUNCH_CONSTANT * -2);
}
else
{
launcher.set(LAUNCH_CONSTANT);
launcherOpposite.set(LAUNCH_CONSTANT * -1);
}
}
if (rightStick.getRawButton(3)) arm.set(0.5);
else
arm.set(0);
{
if (rightStick.getRawButton(2))
{
arm.set(-0.5);
}
else
arm.set(0);
}
if (rightStick.getRawButton(1))
{
claw.set(1);
}
else
claw.set(0);
}
}
}
When I build the project in Netbeans nothing is wrong with it, but when it is deployed the robot doesn't respond. everything seems to be wired up correctly. The robot sees that there is code in it based on the driverstation but the robot doesn't do any of the controls
/* Copyright (c) FIRST 2008. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.Jaguar;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.SimpleRobot;
/**
* The VM is configured to automatically run this class, and to call the
* functions corresponding to each mode, as described in the SimpleRobot
* 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 Team4163 extends SimpleRobot {
/**
* This function is called once each time the robot enters autonomous mode.
*/
Joystick leftStick;
Joystick rightStick;
Jaguar arm;
Jaguar claw;
Jaguar launcher;
RobotDrive drive;
Jaguar launcherOpposite;
boolean constant = true;
double LAUNCH_CONSTANT = 0.5;
public Team4163 () {
leftStick = new Joystick(1);
rightStick = new Joystick(2);
drive = new RobotDrive(1,2);
drive.setInvertedMotor(RobotDrive.MotorType.kFront Left, true);
drive.setInvertedMotor(RobotDrive.MotorType.kFront Right, true);
drive.setInvertedMotor(RobotDrive.MotorType.kRearL eft, true);
drive.setInvertedMotor(RobotDrive.MotorType.kRearR ight, true);
arm = new Jaguar (3);
claw = new Jaguar(4);
launcher = new Jaguar(5);
launcherOpposite = new Jaguar (6);
}
public void autonomous() {
}
///This function is called once each time the robot enters operator control.
public void operatorControl() {
drive.setSafetyEnabled(true);
while (isOperatorControl())
{
drive.tankDrive(leftStick, rightStick);
}
drive.setSafetyEnabled(true);
drive.tankDrive(leftStick, rightStick);
double z = leftStick.getZ();
while(constant = true)
{
if (z > 0.5)
{
launcher.set(LAUNCH_CONSTANT * 2);
launcherOpposite.set(LAUNCH_CONSTANT * -2);
}
else
{
launcher.set(LAUNCH_CONSTANT);
launcherOpposite.set(LAUNCH_CONSTANT * -1);
}
}
if (rightStick.getRawButton(3)) arm.set(0.5);
else
arm.set(0);
{
if (rightStick.getRawButton(2))
{
arm.set(-0.5);
}
else
arm.set(0);
}
if (rightStick.getRawButton(1))
{
claw.set(1);
}
else
claw.set(0);
}
}
}
When I build the project in Netbeans nothing is wrong with it, but when it is deployed the robot doesn't respond. everything seems to be wired up correctly. The robot sees that there is code in it based on the driverstation but the robot doesn't do any of the controls