Frc driverstation problem?


#1

i’m not sure that it is DriverStation’s problem

the “Build” and “Depoly” are work

but when I click " enable " ,
after about 2 seconds it just show up " no Robotcode",and I can’t click " enable "
and then,after few seconds ,the " enable " is able to click again

Is it about Driverstation? or it about program?or I miss some download file when i download DriverStation.
does anyone know or run into same problem?

thanks for any reply


#2

Are there any errors being printed to the Driver Station console? Usually when the robot code encounters an error, it crashes which leads to it disabling and saying no robotcode. Given what you just said, it appears the error is happening during either teleop/auto/(whatever youre using) init or periodic methods.


#3

this is my testing program
package frc.robot;

import edu.wpi.first.wpilibj.Encoder;
import com.ctre.phoenix.motorcontrol.ControlMode;
import com.ctre.phoenix.motorcontrol.IMotorController;
import com.ctre.phoenix.motorcontrol.NeutralMode;
import com.ctre.phoenix.motorcontrol.can.VictorSPX;
import com.ctre.phoenix.motorcontrol.can.WPI_VictorSPX;

import java.lang.Object;
import edu.wpi.first.wpilibj.SendableBase;
import edu.wpi.first.wpilibj.PWM;
import edu.wpi.first.wpilibj.GenericHID;
import edu.wpi.first.wpilibj.buttons.Trigger;
import edu.wpi.first.wpilibj.buttons.POVButton;
import edu.wpi.first.wpilibj.PWMVictorSPX;
import edu.wpi.first.wpilibj.TimedRobot;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.GenericHID.Hand;
import edu.wpi.first.wpilibj.Joystick.AxisType;
import edu.wpi.first.wpilibj.Joystick.ButtonType;
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj.command.Subsystem;
import edu.wpi.cscore.CameraServerJNI;
import edu.wpi.first.wpilibj.CameraServer;
import edu.wpi.first.wpilibj.buttons.Trigger;
import edu.wpi.first.wpilibj.buttons.Button;
import edu.wpi.first.wpilibj.buttons.JoystickButton;
import edu.wpi.first.wpilibj.Compressor;
import edu.wpi.first.wpilibj.Solenoid;
import edu.wpi.first.wpilibj.XboxController;
import java.text.NumberFormat;
import edu.wpi.first.wpilibj.Servo;
import java.util.Date;
import java.util.concurrent.TimeUnit;
import edu.wpi.first.wpilibj.Counter;
import edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first.wpilibj.AnalogTriggerOutput;
import edu.wpi.first.wpilibj.AnalogTrigger;
import edu.wpi.first.wpilibj.Counter;

public class Robot extends TimedRobot
{

private AnalogTrigger encoder;
public static Subsystem m_subsystem;
private Timer timer;
private WPI_VictorSPX MM;
private WPI_VictorSPX LMotor;
private WPI_VictorSPX RMotor;
private VictorSPX FLMotor;
private VictorSPX FRMotor;
private DifferentialDrive myRobot;
private Joystick stick;
private CameraServer camera;
private JoystickButton button;
private Compressor compressor;
private Solenoid sol1,sol2,sol3,sol4,sol5,sol0;
private CameraServer cam,cam1;
private XboxController stick1;
private WPI_VictorSPX hand;
private Servo ser;
int handtype=0;
private Counter counter;
private DigitalInput swich;
@Override
public void robotInit()
{
LMotor = new WPI_VictorSPX(7);
RMotor = new WPI_VictorSPX(5);
hand = new WPI_VictorSPX(6);
FLMotor = new VictorSPX(2);
FRMotor = new VictorSPX(3);
myRobot = new DifferentialDrive(LMotor, RMotor);
FLMotor.set(ControlMode.Follower,0);
FRMotor.set(ControlMode.Follower,1);
stick = new Joystick(0);
button = new JoystickButton(stick,3);

counter=new Counter(0);

compressor = new Compressor(1);

stick1 = new XboxController(1);
//swich= new DigitalInput(0);
LMotor.setInverted(true);
RMotor.setInverted(true);
LMotor.setNeutralMode(NeutralMode.Brake);
RMotor.setNeutralMode(NeutralMode.Brake);
FLMotor.setNeutralMode(NeutralMode.Brake);
FRMotor.setNeutralMode(NeutralMode.Brake);

timer=new Timer();
}
@Override
public void autonomousInit()
{
}

@Override
public void autonomousPeriodic()
{

}
@Override
public void teleopInit()
{
}
@Override
public void teleopPeriodic()
{

//dashboard
//=========================================//
double current = compressor.getCompressorCurrent();
String.valueOf(current);
NumberFormat cur = NumberFormat.getInstance();
cur.setGroupingUsed(false);
String cout = cur.format(current);
SmartDashboard.putString(“DB/String 0”, cout);
//=========================================//

//compressor
//=========================================//
if(compressor.getCompressorCurrent() == 115)
{
compressor.setClosedLoopControl(false);
compressor.close();
}
else
{
compressor.setClosedLoopControl(true);
compressor.start();
}

//=================================//

//SERVO
//=========================================//

ser.getAngle();
if(ser.getAngle() < 90)
ser.setAngle(90);
System.out.print(Math.round(ser.getAngle()));
if(stick.getRawButton(11))
{
ser.setAngle(0);
}
//=========================================//

//=========================================//

if(stick.getRawButton(6))
{
if(handtype==1)
{
hand.set(ControlMode.PercentOutput,1);
timer.delay(1);
handtype=0;
}
else
{
hand.set(ControlMode.PercentOutput,-1);
sol0.set(false);
timer.delay(1);
handtype=1;
}
}
else
{
hand.set(ControlMode.PercentOutput,0);
}

//Counter
//=======================================
System.out.print(counter.get());

//motor
//=========================================//
myRobot.arcadeDrive(stick.getAxis(AxisType.kY),stick.getAxis(AxisType.kZ));
//=======================================//

}
@Override
public void testPeriodic()
{

}
}


#4

is it because the counter?


#5

Could you see if there are any errors being printed to the driver station? That could provide further insight into where the problem is coming from.

What do you mean by this?


#6

System.out.print( counter.get());


#7

ERROR 1 DifferentialDrive… Output not updated often enough. edu.wpi.first.wpilibj.MotorSafety.check(MotorSafety.java:101)
ERROR 1 CTRE CAN Receive Timeout frc.robot.Robot.teleopPeriodic(Robot.java:132)
ERROR 1 Unhandled exception: java.lang.NullPointerException frc.robot.Robot.teleopPeriodic(Robot.java:149)
Warning at edu.wpi.first.wpilibj.RobotBase.startRobot(RobotBase.java:274): Robots should not quit, but yours did!

what’s this means?


#8

i find it…

is the command
"
System.out.print(counter.get());
"
it work after i delete it


#9

There are a few things here.

ERROR 1 DifferentialDrive… Output not updated often enough. edu.wpi.first.wpilibj.MotorSafety.check(MotorSafety.java:101)

This means that your DifferentialDrive object is not being updated often enough. Likely, something is blocking the loop. In this case, it’s probably the timer delay functions that you are running:

timer.delay(1);

Each time you call that, it delays the main loop for one second. You should not call delay functions in periodic functions. Remove those to eliminate this error.

ERROR 1 CTRE CAN Receive Timeout frc.robot.Robot.teleopPeriodic(Robot.java:132)

This means that the RoboRIO cannot communicate with a CAN device. The error occurs on line 132 of Robot.java. Based on your code, it’s likely having trouble communicating with the PCM. PCM devices come with a default id of 0. Unless you have changed it, you should be calling the compressor constructor without any parameters (defaults to 0).

compressor = new Compressor();

ERROR 1 Unhandled exception: java.lang.NullPointerException frc.robot.Robot.teleopPeriodic(Robot.java:149)

This error means that you are trying to run a method on an uninitialized object. This error occurs on line 149 of Robot.java. Based on your code, it’s likely your servo. In robotInit(), initialize the servo:

ser = new Servo(port);

replace port with whatever pwm port the servo is plugged in to.

Try these fixes and see if it works.

I highly doubt that truly fixed it.


#10

but after I delete “ System.out.print(counter.get())
the error on the station had been fixed.
it don’t shows up others error