|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
We had trouble getting a command to work after another command in autonomous mode. We used a while statement and ended the command with a limit switch changing states, but the next command did not trigger the pnuematic cylinder to fire. Any hints?
|
|
#2
|
|||
|
|||
|
Re: Sequences of Commands
This is a situation where you will want to use CommandGroups.
|
|
#3
|
|||
|
|||
|
Re: Sequences of Commands
Quote:
|
|
#4
|
|||
|
|||
|
Re: Sequences of Commands
Here is the code that we are using to test the latching of our winch after a limit switch is activated.
void shoot() { latchPneumatic.set(DoubleSolenoid.Value.kReverse); } void winch(int direction, double unwindTime) { if (direction == 1) { while (catapultLimitSwitch.get() == true) { winchMotor.set(1); } //latchPneumatic.set(DoubleSolenoid.Value.kReverse); winchMotor.set(0); } else if (direction == -1) { for (int i = 0; i < unwindTime*10000; i++) winchMotor.set(-1); winchMotor.set(0); } else winchMotor.set(0); } |
|
#5
|
|||||
|
|||||
|
Re: Sequences of Commands
Quote:
Code:
public void execute() {
shooter.winch(1);
}
public boolean isFinished() {
if (timeNow - startTime > unwindTime) {
return true;
}
}
public void end() {
shooter.winch(0);
}
Code:
shooter.winch(x) Code:
public boolean isFinished() {
if (timeNow - startTime > unwindTime) {
return true;
}
}
Code:
public void end() {
shooter.winch(0);
}
Last edited by notmattlythgoe : 13-11-2014 at 11:45. |
|
#6
|
|||
|
|||
|
Re: Sequences of Commands
This is why I like being involve with FRC. I appreciate all the tips and advice.
Thanks to everyone who responded. The information will be put to good use on Saturday when our programming group get together to work on this small project for preparation for the new game in January. Thanks again William |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|