Go to Post I would argue that you are not overdosed if you don't know the correct name of this year's game - KarenH [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 28-10-2016, 17:46
Yildirim Yildirim is offline
Registered User
FRC #6429
 
Join Date: Oct 2016
Location: Turkey
Posts: 7
Yildirim is an unknown quantity at this point
Pneumatics with command based programming

Hello everyone I am from team 6429 this is our forst year in FRC and I am the programmer I am doing command based programming it was going well until the pneumatics showed their faces to me I do not know how to control pneumatics (single solenoid) on command based programming. I have short time to finish program so I need a quick help pls. Also I am using java.
Reply With Quote
  #2   Spotlight this post!  
Unread 28-10-2016, 20:59
GoldenGollem's Avatar
GoldenGollem GoldenGollem is offline
Java Programmer
FRC #2509 (Hutchinson Tigerbots)
Team Role: Programmer
 
Join Date: Dec 2015
Rookie Year: 2015
Location: Minnesota
Posts: 24
GoldenGollem is an unknown quantity at this point
Re: Pneumatics with command based programming

Do you have some of the code to post or any snipbit of it to show.
__________________
GoldenGollem -Hutchinson Tigerbots 2509
2015 - Mini-MN Regional 2nd Place Finalist
2016 - Mini-MN Regional 1st Place Finalist
Reply With Quote
  #3   Spotlight this post!  
Unread 28-10-2016, 23:02
Penchant Penchant is offline
Registered User
FRC #4607
Team Role: College Student
 
Join Date: Jan 2015
Rookie Year: 2015
Location: Becker, MN, USA
Posts: 3
Penchant has a spectacular aura aboutPenchant has a spectacular aura about
Re: Pneumatics with command based programming

WPI Screensteps is very helpful for things like this, including their page on solenoids here.
Reply With Quote
  #4   Spotlight this post!  
Unread 29-10-2016, 04:43
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
  #5   Spotlight this post!  
Unread 29-10-2016, 19:05
bankst's Avatar
bankst bankst is offline
Registered User
FRC #0832 (OSCAR)
Team Role: Mentor
 
Join Date: Feb 2016
Rookie Year: 2012
Location: Roswell, GA
Posts: 9
bankst is an unknown quantity at this point
Re: Pneumatics with command based programming

Going off the assumption you are using a Single solenoid (rather than a double), here is what I would put in 'execute':
Code:
RobotMap.wristSolenoid1.set(true); // open solenoid
And in the 'end' function:
Code:
RobotMap.wristSolenoid1.set(false); // close solenoid
Also make sure in the 'interrupted' function you put:
Code:
 end(); // close solenoid if command is interrupted
If you have any more questions about command-based programming let me know and I'd be more than happy to help.
__________________
2012-Present 832 Oscar (Alumni and Mentor)
Oscar's Website: http://oscarrobotics.meshnet0.com
Reply With Quote
  #6   Spotlight this post!  
Unread 30-10-2016, 05:54
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 bankst View Post
Going off the assumption you are using a Single solenoid (rather than a double), here is what I would put in 'execute':
Code:
RobotMap.wristSolenoid1.set(true); // open solenoid
And in the 'end' function:
Code:
RobotMap.wristSolenoid1.set(false); // close solenoid
Also make sure in the 'interrupted' function you put:
Code:
 end(); // close solenoid if command is interrupted
If you have any more questions about command-based programming let me know and I'd be more than happy to help.
Thank you very very much
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 01:24.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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