View Single Post
  #1   Spotlight this post!  
Unread 31-01-2013, 10:35
Nathan Lahn Nathan Lahn is offline
Registered User
FRC #3361
 
Join Date: Jan 2013
Location: Fishersville, VA
Posts: 4
Nathan Lahn is an unknown quantity at this point
Joystick Axis Input Not Working

Our team has encountered a peculiar problem with our Attack 3 joysticks. The driver station isn't recognizing any input from them EXCEPT all the buttons. Every time we press any of the buttons on the joystick the green circle under the diagnostics tab turns blue, but we can move the joystick all we want and the input light doesn't change.

We just had this working a few days ago--registering input from the joystick and running a motor with it. Soon after we hooked up a second motor and joystick though, neither joystick would recognize any input except buttons.

I don't think it's a joystick problem since it's unlikely that both joysticks would go kaput simultaneously. Also we tried a gamepad and the same thing happened.

Would it be a programming problem or a driver station problem? Here's the code:

Code:
package edu.wpi.first.wpilibj.templates;

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 {
    /**
     * This function is called once each time the robot enters autonomous mode.
     */
    private RobotDrive drivetrain;
    private Joystick leftStick;
    private Joystick rightStick;

    public RobotTemplate()
    {
        drivetrain.setSafetyEnabled(false);
        drivetrain=new RobotDrive(1,2);
        leftStick=new Joystick(1);
        rightStick=new Joystick(2);
    }
    public void autonomous() 
    {
        for(int i=0;i<4;i++)
        {
            drivetrain.drive(0.5,0.0);
            Timer.delay(2.0);
            drivetrain.drive(0.0,0.75);
        }
        drivetrain.drive(0.0,0.0);
    }

    /**
     * This function is called once each time the robot enters operator control.
     */////////
    public void operatorControl() {
        while(true&&isOperatorControl()&&isEnabled())
        {
            drivetrain.tankDrive(leftStick, rightStick);
            System.out.println(leftStick.getX()+" "+leftStick.getY());
            System.out.println(rightStick.getX()+" "+rightStick.getY());
            Timer.delay(.005);
        }
    }

   
    
    /**
     * This function is called once each time the robot enters test mode.
     */
    public void test() {
    
    }
}
Any ideas would be appreciated. I'm new to all this.
Reply With Quote