Log in

View Full Version : No Robot Code Driver station


Yildirim
04-11-2016, 12:41
We have written our code.We are using command based program. When we deploy our code it builds succesfully but on the driver station it said no robot code. I can not understand the reason and we have very few time to fix it I need a quick help pls.

Logan Byers
04-11-2016, 12:50
We have written our code.We are using command based program. When we deploy our code it builds succesfully but on the driver station it said no robot code. I can not understand the reason and we have very few time to fix it I need a quick help pls.

Look at how you initialized your classes. That is a common issue that would cause the conditions you are seeing.

Could you post or PM your code?

euhlmann
04-11-2016, 13:11
Sometimes crashes can happen so fast that the DS doesn't see them. Instead, start an SSH session and do
tail -f /home/lvuser/FRCUserProgram.log

Yildirim
04-11-2016, 15:17
Look at how you initialized your classes. That is a common issue that would cause the conditions you are seeing.

Could you post or PM your code?

DriveTrain(subsystem):
package org.usfirst.frc6429.NewDimension.subsystems;

import org.usfirst.frc6429.NewDimension.RobotMap;
import org.usfirst.frc6429.NewDimension.commands.*;

import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.SpeedController;
import edu.wpi.first.wpilibj.VictorSP;

import edu.wpi.first.wpilibj.command.Subsystem;


/**
*
*/
public class DriveTrain extends Subsystem {

// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTANTS

// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTANTS

// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS
private final SpeedController rightFrontMotor = RobotMap.driveTrainRightFrontMotor;
private final SpeedController rightRearMotor = RobotMap.driveTrainRightRearMotor;
private final SpeedController leftFrontMotor = RobotMap.driveTrainLeftFrontMotor;
private final SpeedController leftRearMotor = RobotMap.driveTrainLeftRearMotor;
private final RobotDrive robotDrive41 = RobotMap.driveTrainRobotDrive41;

// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS


// Put methods for controlling this subsystem
// here. Call these from Commands.

public SpeedController getLeftRearMotor() {
return leftRearMotor;
}

public SpeedController getLeftFrontMotor() {
return leftFrontMotor;
}

public SpeedController getRightRearMotor() {
return rightRearMotor;
}

public SpeedController getRightFrontMotor() {
return rightFrontMotor;
}

public void initDefaultCommand() {
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DEFAULT_COMMAND


// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DEFAULT_COMMAND

// Set the default command for a subsystem here.
// setDefaultCommand(new MySpecialCommand());
}

public void takeJoystickInput(Joystick Left,Joystick Right) {
robotDrive41.tankDrive(Left,Right);
}

public void stop() {
robotDrive41.drive(0,0);
}
}



Tank Drive(command):

package org.usfirst.frc6429.NewDimension.commands;

import edu.wpi.first.wpilibj.command.Command;
import org.usfirst.frc6429.NewDimension.Robot;

/**
*
*/
public class TankDrive extends Command {

// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=VARIABLE_DECLARATIONS

// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=VARIABLE_DECLARATIONS

// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTOR
public TankDrive() {

// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTOR
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=VARIABLE_SETTING

// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=VARIABLE_SETTING
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=REQUIRES
requires(Robot.driveTrain);

// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=REQUIRES
}

// Called just before this Command runs the first time
protected void initialize() {
}

// Called repeatedly when this Command is scheduled to run
protected void execute() {
Robot.driveTrain.takeJoystickInput(Robot.oi.getLef tJoystick(),
Robot.oi.getRightJoystick());
}

// Make this return true when this Command no longer needs to run execute()
protected boolean isFinished() {
return false;
}

// Called once after isFinished returns true
protected void end() {
Robot.driveTrain.stop();
}

// Called when another command which requires one or more of the same
// subsystems is scheduled to run
protected void interrupted() {
end();
}
}

I can not figure out what the problem is

mattyokan
05-11-2016, 11:26
DriveTrain(subsystem):
package org.usfirst.frc6429.NewDimension.subsystems;

import org.usfirst.frc6429.NewDimension.RobotMap;
import org.usfirst.frc6429.NewDimension.commands.*;

import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.SpeedController;
import edu.wpi.first.wpilibj.VictorSP;

import edu.wpi.first.wpilibj.command.Subsystem;


/**
*
*/
public class DriveTrain extends Subsystem {

// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTANTS

// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTANTS

// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS
private final SpeedController rightFrontMotor = RobotMap.driveTrainRightFrontMotor;
private final SpeedController rightRearMotor = RobotMap.driveTrainRightRearMotor;
private final SpeedController leftFrontMotor = RobotMap.driveTrainLeftFrontMotor;
private final SpeedController leftRearMotor = RobotMap.driveTrainLeftRearMotor;
private final RobotDrive robotDrive41 = RobotMap.driveTrainRobotDrive41;

// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS


// Put methods for controlling this subsystem
// here. Call these from Commands.

public SpeedController getLeftRearMotor() {
return leftRearMotor;
}

public SpeedController getLeftFrontMotor() {
return leftFrontMotor;
}

public SpeedController getRightRearMotor() {
return rightRearMotor;
}

public SpeedController getRightFrontMotor() {
return rightFrontMotor;
}

public void initDefaultCommand() {
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DEFAULT_COMMAND


// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DEFAULT_COMMAND

// Set the default command for a subsystem here.
// setDefaultCommand(new MySpecialCommand());
}

public void takeJoystickInput(Joystick Left,Joystick Right) {
robotDrive41.tankDrive(Left,Right);
}

public void stop() {
robotDrive41.drive(0,0);
}
}



Tank Drive(command):

package org.usfirst.frc6429.NewDimension.commands;

import edu.wpi.first.wpilibj.command.Command;
import org.usfirst.frc6429.NewDimension.Robot;

/**
*
*/
public class TankDrive extends Command {

// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=VARIABLE_DECLARATIONS

// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=VARIABLE_DECLARATIONS

// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTOR
public TankDrive() {

// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTOR
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=VARIABLE_SETTING

// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=VARIABLE_SETTING
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=REQUIRES
requires(Robot.driveTrain);

// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=REQUIRES
}

// Called just before this Command runs the first time
protected void initialize() {
}

// Called repeatedly when this Command is scheduled to run
protected void execute() {
Robot.driveTrain.takeJoystickInput(Robot.oi.getLef tJoystick(),
Robot.oi.getRightJoystick());
}

// Make this return true when this Command no longer needs to run execute()
protected boolean isFinished() {
return false;
}

// Called once after isFinished returns true
protected void end() {
Robot.driveTrain.stop();
}

// Called when another command which requires one or more of the same
// subsystems is scheduled to run
protected void interrupted() {
end();
}
}

I can not figure out what the problem is

Robot.oi.getLef tJoystick(), That could be it?

EmileH
05-11-2016, 11:43
The compiler should throw an error before deploying if that's the issue though.

Joey1939
05-11-2016, 15:01
This behavior means that your code is experiencing an Exception somewhere in the initialization. I would recommend connecting with net console to watch the initialization and find the bug. I have seen often that the error exception doesn't tell you the line number in your code but rather in WPILib because they catch the error. If you surround all your initialization code with your own try catch loop and print the Exception it should tell you exactly where the Exception occurred.

(One of my most common mistakes is trying to push data to the SmartDashboard in the robot constructor. For some reason you have to wait to write to SmartDashboard in robotInit, when commands call init, or a period begins.)