Go to Post HEY! a robot that occupies 4 dimensional space is against the rules! - KenWittlief [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #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
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 08:29.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi