My servos lock up just thinking of you
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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 06-02-2017, 20:37
verlander13 verlander13 is offline
Registered User
AKA: Ian
FRC #1025 (IMPIS)
Team Role: Programmer
 
Join Date: Jan 2017
Rookie Year: 2015
Location: Ferndale
Posts: 14
verlander13 is an unknown quantity at this point
Autonomous for gears

Does this work?

package org.usfirst.frc.team1025.robot.commands.VisionM;

import org.usfirst.frc.team1025.robot.Robot;

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

/**
*
*/
public class VisionMa extends Command {
private double centerX;
public VisionMa() {
requires(Robot.visionMaybe);
requires(Robot.chassisSubsystem);
}

// Called just before this Command runs the first time
protected void initialize() {
Robot.visionMaybe.visionThread.start();

}

// Called repeatedly when this Command is scheduled to run
protected void execute() {
synchronized (Robot.visionMaybe.imgLock) {
Robot.visionMaybe.centerX1 = this.centerX;
}
double turn = centerX - (Robot.visionMaybe.IMG_WIDTH / 2);
Robot.chassisSubsystem.robotDrive.arcadeDrive(-0.6, turn * 0.005);
}


// Make this return true when this Command no longer needs to run execute()
public boolean isFinished() {
if(centerX>0.0)
return false;
else if(centerX<237.0){
return false;
}
else{
return true;
}
}



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


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 15:34.

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