what could be wrong with this code. The robot is not responding

/----------------------------------------------------------------------------/
/* Copyright © 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.kFrontLeft, true);
    drive.setInvertedMotor(RobotDrive.MotorType.kFrontRight, true);
    drive.setInvertedMotor(RobotDrive.MotorType.kRearLeft, true);
    drive.setInvertedMotor(RobotDrive.MotorType.kRearRight, 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

Two comments. My best guess is that you need a sleep() or wait() or whatever the java equivalent is in the body of your while(isOperatorControl()) loop. If the brackets in your post match your robot code, then your launcher code will probably never get run, or will only get run before you disable the robot.

public void operatorControl() {

drive.setSafetyEnabled(true);

while (isOperatorControl()) **<-- as long as you're in operator control, your robot will be in this loop.  It should be responsive to your joysticks though.  You may want to put a wait(0.001) call in (or whatever the java equivalent is) because this thread may be monopolizing the cRio CPU**
{
drive.tankDrive(leftStick, rightStick);
}




drive.setSafetyEnabled(true);
drive.tankDrive(leftStick, rightStick); <-- this will only get called once, since you're not in a loop at the time you call it.
double z = leftStick.getZ();

while(constant = true) <-- **if this is java or c++, you need to do constant == true.  As this stands, you're assigning true to constant, and then testing if it is true, which means this loop will never end**
{
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);
}
}
}

Another thing: Our robot was non-responsive yesterday - it turned out we had a gyro in a non-accumulator port, and using the gyro was causing the robot to crash.

wow… You seriously need to start tabbing your code and keeping track of all your brackets. Also you use while loops inapropriatly. this loop:

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);
		}
	} 

never ends or updates driving, and its after this loop

while (isOperatorControl())
{
drive.tankDrive(leftStick, rightStick);
}

that ends when teleop is over, so its going to run when you dissable teleop and then never get out of it.

Once you clean up the loop issues noted above, you should check why you are inverting 4 motors on a robotDrive instantiated with 2. Typically you would only use kLeft and kRight (or instantiate with 4 controllers) and only invert one