View Single Post
  #4   Spotlight this post!  
Unread 04-02-2014, 23:27
LFRobotics's Avatar
LFRobotics LFRobotics is offline
Registered User
FRC #4623
 
Join Date: Jan 2014
Location: Little Falls, MN
Posts: 95
LFRobotics is on a distinguished road
Re: addSequential NOT Working for Servos

Here are the commands:

Code:
package edu.wpi.first.LFRobot2014.commands;

/**
 *
 * @author FrankyMonezz
 */
public class PrepBall extends CommandBase {
    
    public PrepBall() {
        // Use requires() here to declare subsystem dependencies
        // eg. requires(chassis);
        requires(launchservo);
    }

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

    // Called repeatedly when this Command is scheduled to run
    protected void execute() {
        //move servo to 45 degrees
        launchservo.setPos(45);
    }

    // Make this return true when this Command no longer needs to run execute()
    protected boolean isFinished() {
        return (launchservo.getPos() == 45);
         
    }

    // 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() {
    }
}
Code:
package edu.wpi.first.LFRobot2014.commands;

/**
 *
 * @author FrankyMonezz
 */
public class PrepBall2 extends CommandBase {
    
    public PrepBall2() {
        // Use requires() here to declare subsystem dependencies
        // eg. requires(chassis);
        requires(launchservo);
    }

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

    // Called repeatedly when this Command is scheduled to run
    protected void execute() {
        //move servo back to default location
        launchservo.setPos(0);
    }

    // Make this return true when this Command no longer needs to run execute()
    protected boolean isFinished() {
        return (launchservo.getPos() == 0);
    }

    // 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() {
    }
}
I will try putting in a wait command tomorrow - THANKS!
Reply With Quote