Thread: Vision
View Single Post
  #3   Spotlight this post!  
Unread 23-01-2017, 17:07
verlander13 verlander13 is offline
Registered User
AKA: Ian
FRC #1025 (IMPIS)
Team Role: Programmer
 
Join Date: Jan 2017
Rookie Year: 2015
Location: Ferndale
Posts: 12
verlander13 is an unknown quantity at this point
Re: Vision

Thanks. Does this command work with it?

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

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

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

/**
*
*/
public class VisionAuton extends Command {
double centerX;

public VisionAuton() {
// Use requires() here to declare subsystem dependencies
// eg. requires(chassis);
requires(Robot.visionSubsystem);
requires(Robot.ChassisSubsystem);
}

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

}

// Called repeatedly when this Command is scheduled to run
protected void execute() {
synchronized (Robot.visionSubsystem.imgLock) {
Robot.visionSubsystem.centerX = this.centerX;
}
double Turn = centerX - (Vision.IMG_WIDTH / 2 );
// ask
// Robot.chassisSubsystem.SimpleDrive(leftSpeed, rightSpeed);
Robot.ChassisSubsystem.getRobotDrive().arcadeDrive (-0.6, Turn * 0.005);


}

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