View Single Post
  #4   Spotlight this post!  
Unread 23-01-2015, 15:27
AnnaliseD AnnaliseD is offline
Registered User
None #4284
 
Join Date: Jan 2015
Location: Cinncinnati, Ohio
Posts: 4
AnnaliseD is an unknown quantity at this point
Re: Driver Station Log Errors

If it helps heres my code

package org.usfirst.frc.team4284.robot;

import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.Jaguar;
import edu.wpi.first.wpilibj.livewindow.LiveWindow;

/**
* The VM is configured to automatically run this class, and to call the
* functions corresponding to each mode, as described in the IterativeRobot
* documentation. If you change the name of this class or the package after
* creating this project, you must also update the manifest file in the resource
* directory.
*/
public class Robot extends IterativeRobot {
RobotDrive Drive;
Joystick drivestick;
int autoLoopCounter;

/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
public void robotInit() {
Jaguar FL = new Jaguar (0);
Jaguar BL = new Jaguar (1);
Jaguar FR = new Jaguar (2);
Jaguar BR = new Jaguar (3);
Drive = new RobotDrive(FL,BL,FR,BR);
drivestick = new Joystick(0);
}

/**
* This function is run once each time the robot enters autonomous mode
*/
public void autonomousInit() {
autoLoopCounter = 0;
}

/**
* This function is called periodically during autonomous
*/
public void autonomousPeriodic() {
if(autoLoopCounter < 100) //Check if we've completed 100 loops (approximately 2 seconds)
{
Drive.drive(-0.5, 0.0); // drive forwards half speed
autoLoopCounter++;
} else {
Drive.drive(0.0, 0.0); // stop robot
}
}

/**
* This function is called once each time the robot enters tele-operated mode
*/
public void teleopInit(){

}

/**
* This function is called periodically during operator control
*/
public void teleopPeriodic() {
Drive.arcadeDrive(drivestick);

{
Jaguar leftArm = new Jaguar(5);
Jaguar rightArm = new Jaguar(6);
/* Jaguar retract = new Jaguar(7); */

if (drivestick.getRawButton(4))
leftArm.set (-1);
rightArm.set (1);

try {
Thread.sleep(500); //stop for 1/2 second
} catch(InterruptedException ex) { // allows for interruption of the sleep period
Thread.currentThread().interrupt();
}
leftArm.set(0.0);
rightArm.set(0.0);

if (drivestick.getRawButton(5))
leftArm.set(1);
rightArm.set(-1);

try {
Thread.sleep(500);
} catch(InterruptedException ex) {
Thread.currentThread().interrupt();
}
leftArm.set(0.0);
rightArm.set(0.0);


/* if(drivestick.getRawButton(8))
retract.set(1);
try {
Thread.sleep(1000); //1000 milliseconds is one second.
} catch(InterruptedException ex) {
Thread.currentThread().interrupt();
}
retract(0.0);

if(drivestick.getRawButton(9))
retract.set(-1);

try {
Thread.sleep(1000); //1000 milliseconds is one second.
} catch(InterruptedException ex) {
Thread.currentThread().interrupt();
}
retract(0.0);
*/
}



}

/**
* This function is called periodically during test mode
*/
public void testPeriodic() {
LiveWindow.run();
}

}
Reply With Quote