Team 4939
16-09-2014, 17:24
We are currently setting up for a display that we are having tomorrow at our school, and we are having some issues with our robot.
It seems that the intake motor is not working.
We turned our robot on after the summer break and when we turned it on, the robots intake motors kept spinning when the button was clicked on the joystick, when before they stopped after the button was let go of. So what I did was that I uploaded the code that we had on right before the school year ended. I put this code on and it seems that no matter which button I clicked on the joystick (either the input or output) the intake just kept spinning without stopping for some reason.
Then I tried a different code that I think was closer to the competition time than the one we tried before.
This time the intake did not keep spinning but they only do one function. We tried many different variation of wiring and programming but not matter what both the intake and outtake buttons did only one thing (either intake or outtake depending on the variation) or sometimes it seemed the motors went opposite ways and nothing happened.
We concluded that it was a programming issue(isn't it always), so here is the code without any variation to it:
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.Jaguar;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.Timer;
public class RobotTemplate extends SimpleRobot {
RobotDrive chassis = new RobotDrive(1,2);
Joystick mainStick = new Joystick(1);
Jaguar jaguar = new Jaguar(3);
Jaguar jag = new Jaguar(4);
public void autonomous(){
chassis.setSafetyEnabled(false);
chassis.drive (-0.5, 0.08);
Timer.delay(2.0);
chassis.drive (0, 0.0);
}
public void operatorControl() {
chassis.setSafetyEnabled(true);
while (isOperatorControl() && isEnabled()) {
double speed;
double rot;
speed = mainStick.getY();
rot = -mainStick.getX();
chassis.arcadeDrive (speed, rot);
if (mainStick.getRawButton(3)){
jag.set(1);
jaguar.set(-1);
}
else if (mainStick.getRawButton(4)){
jaguar.set(-1);
jag.set(1);
}
else{
jaguar.set(0);
jag.set(0);
}
}
}
public void test() {
}
}
If someone could please look into the code and let me know that the issue before tomorrow, this would be very helpful.
It seems that the intake motor is not working.
We turned our robot on after the summer break and when we turned it on, the robots intake motors kept spinning when the button was clicked on the joystick, when before they stopped after the button was let go of. So what I did was that I uploaded the code that we had on right before the school year ended. I put this code on and it seems that no matter which button I clicked on the joystick (either the input or output) the intake just kept spinning without stopping for some reason.
Then I tried a different code that I think was closer to the competition time than the one we tried before.
This time the intake did not keep spinning but they only do one function. We tried many different variation of wiring and programming but not matter what both the intake and outtake buttons did only one thing (either intake or outtake depending on the variation) or sometimes it seemed the motors went opposite ways and nothing happened.
We concluded that it was a programming issue(isn't it always), so here is the code without any variation to it:
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.Jaguar;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.Timer;
public class RobotTemplate extends SimpleRobot {
RobotDrive chassis = new RobotDrive(1,2);
Joystick mainStick = new Joystick(1);
Jaguar jaguar = new Jaguar(3);
Jaguar jag = new Jaguar(4);
public void autonomous(){
chassis.setSafetyEnabled(false);
chassis.drive (-0.5, 0.08);
Timer.delay(2.0);
chassis.drive (0, 0.0);
}
public void operatorControl() {
chassis.setSafetyEnabled(true);
while (isOperatorControl() && isEnabled()) {
double speed;
double rot;
speed = mainStick.getY();
rot = -mainStick.getX();
chassis.arcadeDrive (speed, rot);
if (mainStick.getRawButton(3)){
jag.set(1);
jaguar.set(-1);
}
else if (mainStick.getRawButton(4)){
jaguar.set(-1);
jag.set(1);
}
else{
jaguar.set(0);
jag.set(0);
}
}
}
public void test() {
}
}
If someone could please look into the code and let me know that the issue before tomorrow, this would be very helpful.