Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   No Robot Code Driver station (http://www.chiefdelphi.com/forums/showthread.php?t=152200)

Yildirim 04-11-2016 12:41

No Robot Code Driver station
 
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

Re: No Robot Code Driver station
 
Quote:

Originally Posted by Yildirim (Post 1615165)
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

Re: No Robot Code Driver station
 
Sometimes crashes can happen so fast that the DS doesn't see them. Instead, start an SSH session and do
Code:

tail -f /home/lvuser/FRCUserProgram.log

Yildirim 04-11-2016 15:17

Re: No Robot Code Driver station
 
Quote:

Originally Posted by Logan Byers (Post 1615166)
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

Re: No Robot Code Driver station
 
Quote:

Originally Posted by Yildirim (Post 1615180)
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

Code:

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

EmileH 05-11-2016 11:43

Re: No Robot Code Driver station
 
The compiler should throw an error before deploying if that's the issue though.

Joey1939 05-11-2016 15:01

Re: No Robot Code Driver station
 
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.)


All times are GMT -5. The time now is 03:21.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi