Delayed Start

When I enable my robot there is about a 5 second delay before it begins responding to the code. I have another team member who has been writing his own code and when he runs his code there is no delay so I know the problem is with my code not the hardware.

Has anyone had a problem like this before? Any ideas what it could be from?

It would be helpful to post a link to your code.

My guess is that you are initializing something at Teleop.Periodic, rather than Robot Init.

Here is my main class

package org.usfirst.frc.team5407.robot;

import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
import edu.wpi.first.wpilibj.networktables.NetworkTable;
import edu.wpi.first.wpilibj.smartdashboard.*;

/**

  • 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 Robot extends IterativeRobot {

Timer timer;
Sensors sensors;
RobotBase robotBase;
Inputs inputs;
Solenoids solenoids;
Shooter shooter;
Climber climber;

NetworkTable table;




/**
 * This function is run when the robot is first started up and should be
 * used for any initialization code.
 */

//@Override
public void robotInit() {	
	sensors = new Sensors(0); 				//Ultrasonic
	robotBase = new RobotBase(0, 1, 2, 3); 	//These are for the 4 wheel motors
	climber = new Climber(4);				//This is for the 1 winch motor
	shooter = new Shooter(5,					//Ball Shoot
			6);  							//Ball Feed
	inputs = new Inputs(0, 1);				//This is for the 2 xBox controllers
	solenoids = new Solenoids(0,  			//Dual Speed Shift
			1,  								//Gear Lift
			2,								//Gear Tilt
			3,								//Gear Grab
			7);								//Camera Light
	timer = new Timer();
	
	table = NetworkTable.getTable("GRIP/myContourReport");
	
}

/**
 * This function is run once each time the robot enters autonomous mode
 */

//@Override
public void autonomousInit() {
	timer.reset();
	timer.start();
	
}

/**
 * This function is called periodically during autonomous
 */

//@Override
public void autonomousPeriodic() {
	
	
	
	double] defaultValue = new double[0];
	String answer = new String("");
	double] centerX = table.getNumberArray("centerX", defaultValue);

	for (double center:centerX){
		answer.concat(Double.toString(center));
		answer.concat(" ");
	}
	SmartDashboard.putString("Center: ", answer);

	

	
	
}
/**
 * This function is called once each time the robot enters tele-operated
 * mode
 */

//@Override
public void teleopInit() {

	
	
	


}

/**
 * This function is called periodically during operator control
 */

//@Override
public void teleopPeriodic() {
	// Reads all the inputs from the controller
	inputs.readValues();
	

	
	robotBase.omniDrive(inputs.d_RightYAxis1 * Math.abs(inputs.d_RightYAxis1) * Math.abs(inputs.d_RightYAxis1),
			inputs.d_RightXAxis1 * Math.abs(inputs.d_RightXAxis1) * Math.abs(inputs.d_RightXAxis1),
			0.5 * inputs.d_LeftXAxis1 * Math.abs(inputs.d_LeftXAxis1) * Math.abs(inputs.d_LeftXAxis1));
	
	
	shooter.mot_BallShoot.set(-1*inputs.d_RightTrigger1);
	
	shooter.mot_BallFeed.set(inputs.d_LeftTrigger1);
	
	if (inputs.b_StartButton1){
		climber.mot_climbMotor.set(-1.0);
	}
	else {
		climber.mot_climbMotor.set(0.0); 
	}

	if (inputs.tapA1()){
		solenoids.s_GearTilt.set(!solenoids.s_GearTilt.get());
	}
	if (inputs.tapLeftBumper1()){
		solenoids.s_GearGrab.set(!solenoids.s_GearGrab.get());
	}
	if (inputs.tapRightBumper1()){
		solenoids.s_GearLift.set(!solenoids.s_GearLift.get());
	}
	if (inputs.tapX1()){
		solenoids.resetGrabber();
	}
	if (inputs.tapRightStick1()){
		solenoids.s_Light.set(!solenoids.s_Light.get());
	}
	
	
	SmartDashboard.putNumber("Ultrasonic ", sensors.getDistance());

}

/**
 * This function is called periodically during test mode
 */

//@Override
public void testPeriodic() {
	LiveWindow.run();
}

}

Are you using practice mode? There’s a default 5 second delay before it starts.

how do i turn on/off practice mode?

On the driver station, choose “Tele-Operated” instead of “Practice”.

See the attached image on the top middle-left.