|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
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.
|
|
#2
|
||||
|
||||
|
Re: No Robot Code Driver station
Quote:
Could you post or PM your code? |
|
#3
|
||||
|
||||
|
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 |
|
#4
|
|||
|
|||
|
Re: No Robot Code Driver station
Quote:
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 |
|
#5
|
|||
|
|||
|
Re: No Robot Code Driver station
Quote:
Code:
Robot.oi.getLef tJoystick(), |
|
#6
|
|||||
|
|||||
|
Re: No Robot Code Driver station
The compiler should throw an error before deploying if that's the issue though.
|
|
#7
|
||||
|
||||
|
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.) |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|