Quote:
Originally Posted by Team1605
Code:
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.*;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.Timer;
/**
* The VM is configured to automatically run this class, and to call the
* functions corresponding to each mode, as described in the SimpleRobot
* 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 Team1605 extends SimpleRobot {
Joystick stickDriverLeft = new Joystick(1);
Joystick stickDriverRight = new Joystick(2);
//remeber to switch jag port values for original robot
Jaguar leftMotor = new Jaguar(2);
Jaguar rightMotor = new Jaguar(1);
Jaguar shooter = new Jaguar(3);
//Victor gatherer = new Victor(4);
//Victor bridgeHandMotor = new Victor(6);
RobotDrive robotDrive = new RobotDrive(leftMotor,rightMotor);
/**
* This function is called once each time the robot enters autonomous mode.
*/
public void autonomous() {
robotDrive.setSafetyEnabled(false);
robotDrive.drive(-0.35,0.0);//drive at 35% speed 0% turn
Timer.delay(1.0);//wait 1 second
robotDrive.drive(0.0, 0.0);//stop
Timer.delay(1.0);//wait 1 second
shooter.set(1.0);//full spped shoots
Timer.delay(1.0);//wait one second
shooter.set(0.0);//stop shooter
Timer.delay(7.0);// wait 7 seconds
//robotDrive.drive(0.5,0.0);//drive at 50% speed 0% turn
//Timer.delay(5.0);//wait 5 seconds
//robotDrive.drive(0.0,0.0);//stop
//Timer.delay(10.0);// wait 10 seconds
//leftMotor.set(-1);
//yrightMotor.set(1);
//Timer.delay(15);
//leftMotor.set(0);
//rightMotor.set(0);
//Timer.delay(3);
}
/**
* This function is called once each time the robot enters operator control.
*/
public void operatorControl() {
while(isOperatorControl() && isEnabled())
{
robotDrive.tankDrive(stickDriverLeft.getAxis(Joystick.AxisType.kY), stickDriverRight.getAxis(Joystick.AxisType.kY));
if(stickDriverRight.getButton(Joystick.ButtonType.kTrigger)) {
shooter.set(1);
}
else {
shooter.set(0);
}
if(stickDriverLeft.getButton(Joystick.ButtonType.kTrigger)) {
shooter.set(-0.5);
}
else {
shooter.set(0);
}
// bridgeHandMotor.set(stickDriverLeft.getAxis(Joystick.AxisType.kY));
Timer.delay(.01);
}
}
}
can someone check if my programming for the shooter is correct...
|
What are you expecting the shooter to do?
From what I'm reading the robot will:
Drive forward at 35% speed for 1 second.
Wait one second.
Turn on the shooter motor at full speed for one second.
Wait 7 seconds.
Without knowing what your shooter is I can't really tell you if it is correct or not.