Thread: Threading?
View Single Post
  #5   Spotlight this post!  
Unread 09-02-2016, 16:30
fireXtract fireXtract is offline
MegaHertz_Lux
FRC #2847 (Mega Hertz)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2012
Location: fmt
Posts: 42
fireXtract is an unknown quantity at this point
Re: Threading?

Thank you! I was thinking quite narrow minded by thinking the only way I could do it was with threading! Thanks for showing me the way! One question, what does the super() thing do in the commandgroup? I use it in my PIDSubsystem to pass PID info, but what does it do in this case?

EDIT: I ended up doing this, the second parameter of the command can be used as a timeout ex. (addSequential(),1.5). I needed to do this so that the list doesn't get stuck in the SetShooterSpeedCommand as I don't have it exit unless its interrupted. This works as desired. Thanks for the help pblankenbaker!
Code:
	public KickNShootCommandGroup() {
		// super("KickNShootCommandGroup " + RobotMap.shootSpeed);

		// to get into default position
		addSequential(new SetKickerPositionCommand(RobotMap.kickDefaultAngle));

		// Start spinning up shooters and give them 2 seconds to reach speed
		addSequential(new SetShooterSpeedCommand(RobotMap.shootSpeed), 1.5);

		// Move kicker into kick position and give .5 second for boulder
		// to pass through
		addSequential(new SetKickerPositionCommand(RobotMap.kickHitAngle));
		addSequential(new WaitCommand(0.7));

		// Stop shooter and return kicker to default position

		addSequential(new SetKickerPositionCommand(RobotMap.kickDefaultAngle));
		addParallel(new SetShooterSpeedCommand(0), 0.5);
	}

Last edited by fireXtract : 09-02-2016 at 16:57. Reason: code
Reply With Quote