View Single Post
  #4   Spotlight this post!  
Unread 10-29-2016, 04:43 AM
Yildirim Yildirim is offline
Registered User
FRC #6429
 
Join Date: Oct 2016
Location: Turkey
Posts: 7
Yildirim is an unknown quantity at this point
Re: Pneumatics with command based programming

Quote:
Originally Posted by GoldenGollem View Post
Do you have some of the code to post or any snipbit of it to show.
This is my subsystem's "wrist" code:
package org.usfirst.frc123.pnmatik.subsystems;

import org.usfirst.frc123.pnmatik.RobotMap;
import org.usfirst.frc123.pnmatik.commands.*;
import edu.wpi.first.wpilibj.Compressor;
import edu.wpi.first.wpilibj.Solenoid;

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


/**
*
*/
public class Wrist extends Subsystem {

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

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

// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATİONS
private final Compressor compressor1 = RobotMap.wristCompressor1;
private final Solenoid solenoid1 = RobotMap.wristSolenoid1;

// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATİONS


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

public Compressor getCompressor1() {
return compressor1;
}

public Solenoid getSolenoid1() {
return solenoid1;
}

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());
}
}


And this is the command's "Raise Wrist" code:

// RobotBuilder Version: 2.0
//
// This file was generated by RobotBuilder. It contains sections of
// code that are automatically generated and assigned by robotbuilder.
// These sections will be updated in the future when you export to
// Java from RobotBuilder. Do not put any code or make any change in
// the blocks indicating autogenerated code or it will be lost on an
// update. Deleting the comments indicating the section will prevent
// it from being updated in the future.


package org.usfirst.frc123.pnmatik.commands;

import edu.wpi.first.wpilibj.command.Command;
import org.usfirst.frc123.pnmatik.Robot;

/**
*
*/
public class RaiseWrist extends Command {

// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=VARİABLE_DECLARATİONS

// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=VARİABLE_DECLARATİONS

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

// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTOR
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=VARİABLE_SETTİNG

// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=VARİABLE_SETTİNG
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=REQUİRES
requires(Robot.wrist);

// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=REQUİRES
}

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

}

// Called repeatedly when this Command is scheduled to run
protected void execute() {
}

// 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() {
}

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

}
}

So what am i going to write and where (I think I should write the code to the execute in command) and am I need to write something t o subsytems actually I have no idea about pneumatics on command based programing as I said .

Thanks for your helps.
Reply With Quote