Go to Post i wish ours was done so i could get some sleep - keagara [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

 
Reply
Thread Tools Rate Thread Display Modes
  #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
  #2   Spotlight this post!  
Unread 31-01-2013, 10:41
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,861
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Joystick Axis Input Not Working

Both joysticks losing their axis might also be attributed to poor USB power from a hub or due to low laptop battery condition.

Do you get this with the joysticks plugged directly into PC USB ports, with the PC power plugged in?
Are the joysticks sharing power with other devices?
Attack 3 Joysticks are pretty good low power demand devices, but other USB devices like the Cypress I/O or glow in the dark game controllers are pretty bad.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 31-01-2013 at 10:45.
Reply With Quote
  #3   Spotlight this post!  
Unread 31-01-2013, 14:16
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
Re: Joystick Axis Input Not Working

Thanks for the quick reply.

Both joysticks were plugged directly into the usb ports on the laptop. This was also the case when everything was working properly. It's a window 7 hp pavilion g7 laptop (our classmate from years ago won't turn on).

I think the laptop was plugged in while the problem occurred, however it may not have been fully charged. I'll try that at our meeting tonight.

I've tried all the different USB ports on the laptop. No other devices are plugged in, besides a wireless mouse, but I've tried the joysticks without it.
Reply With Quote
  #4   Spotlight this post!  
Unread 31-01-2013, 14:21
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,861
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Joystick Axis Input Not Working

Use the Windows Game Controller utility to see if the PC recognizes the joystick axes.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
Reply With Quote
  #5   Spotlight this post!  
Unread 31-01-2013, 17:27
Team3266Spencer's Avatar
Team3266Spencer Team3266Spencer is offline
Team Captain and Lead Programmer
AKA: Spencer Lanman
FRC #3266 (Robots-R-US)
Team Role: Programmer
 
Join Date: Oct 2011
Rookie Year: 2012
Location: Richmond, Indiana
Posts: 280
Team3266Spencer is an unknown quantity at this point
Re: Joystick Axis Input Not Working

Get rid of the delay. I've found it can lead to a lot of issues.
__________________
2012: Buckeye Regional, Queen City Regional, Human Player
2013: Queen City Regional, Buckeye Regional, Crossroads Regional
Shooter Operator
2014: Crossroads Regional, Queen City Regional
Catapult Operator
2015: Georgia Southern Classic Regional (Winner), Queen City Regional
Chainsaw Operator
Want to talk? TeamSpeak: team3266.noip.me
Reply With Quote
  #6   Spotlight this post!  
Unread 02-02-2013, 12:24
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
Re: Joystick Axis Input Not Working

I tried it with full laptop battery plugged in and also without the delay and the same issue occurred. Any body have any other ideas?

Mark, where can I find the game utility you mentioned?

I'll probably just end up trying to reinstall everything on a different computer. Maybe that'll help the problem.
Reply With Quote
  #7   Spotlight this post!  
Unread 02-02-2013, 12:33
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,861
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Joystick Axis Input Not Working

Go to Control Panel and search for Game Controller
You'll see Set up USB game controllers

You'll get a list of game controllers that are currently plugged in.
Double-click on the one you want and you'll get a test window that shows buttons and axes movement.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 02-02-2013 at 12:36.
Reply With Quote
  #8   Spotlight this post!  
Unread 02-02-2013, 17:55
cgmv123's Avatar
cgmv123 cgmv123 is offline
FRC RI/FLL Field Manager
AKA: Max Vrany
FRC #1306 (BadgerBOTS)
Team Role: College Student
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Madison, WI
Posts: 2,085
cgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond repute
Re: Joystick Axis Input Not Working

Quote:
Originally Posted by Mark McLeod View Post
Go to Control Panel and search for Game Controller
You'll see Set up USB game controllers

You'll get a list of game controllers that are currently plugged in.
Double-click on the one you want and you'll get a test window that shows buttons and axes movement.
You can calibrate it as well if you need to.
__________________
BadgerBOTS Robotics|@team1306|Facebook: BadgerBOTS
2016 FIRST Championship Tesla Division | 2016 Wisconsin Regional Engineering Inspiration Award

2015 FIRST Championship Carson Division | 2015 Wisconsin Regional Chairman's Award

2013 FIRST Championship Curie Division | 2013 Wisconsin Regional Chairman's Award

2012 FIRST Championship Archimedes Division | 2012 Wisconsin Regional Engineering Inspiration Award, Woodie Flowers Finalist Award (Lead Mentor Ben Senson)

Reply With Quote
  #9   Spotlight this post!  
Unread 04-02-2013, 17:04
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
Re: Joystick Axis Input Not Working

Alright, I tried installing driverstation on a different computer, and the same thing occurred again. Also, I tried the testing software on both computers and they both registered all inputs fine.

Also, I tried the calibration on one of the joysticks and no change.

I'm all out of ideas...
Reply With Quote
  #10   Spotlight this post!  
Unread 05-02-2013, 19:14
279 EMPIE's Avatar
279 EMPIE 279 EMPIE is offline
Head Progammer
AKA: Matthew Empie
FRC #0279 (Tech Fusion)
Team Role: Programmer
 
Join Date: Dec 2010
Rookie Year: 2011
Location: Toledo Ohio
Posts: 76
279 EMPIE is just really nice279 EMPIE is just really nice279 EMPIE is just really nice279 EMPIE is just really nice
Send a message via AIM to 279 EMPIE
Exclamation Re: Joystick Axis Input Not Working

I'm having the same problem and i cant seem to find the Solution.
I have tried old code and the Joysticks worked fine but after i copied it didnt work still. The i created a test program (Below) and that also didn't work.

SO CONFUSED

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.*;

/**
 * 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 RobotTemplate extends SimpleRobot {
    
    public Joystick    Joy     = new Joystick(1);

    public Jaguar Jag_One   = new Jaguar(1,1);
    public Jaguar Jag_Two   = new Jaguar(1,2);
    public Jaguar Jag_Three = new Jaguar(1,3);
    public Jaguar Jag_Four  = new Jaguar(1,4);
    
    public void autonomous() {
        
    }

    /**
     * This function is called once each time the robot enters operator control.
     */
    public void operatorControl() {

         Jag_One.set(Joy.getY());
         Jag_Two.set(Joy.getY());
         Jag_Three.set(Joy.getY());
         Jag_Four.set(Joy.getY());
        
    }
    
    /**
     * This function is called once each time the robot enters test mode.
     */
    public void test() {
        

    
    }
}
__________________
2011- Programmer, Electrical, and Web
Cleveland Regional

2012- Head Programmer, Web, Driver
Pittsburg Regional, Saint Louis International

2013- Head Programmer
Cinnicinatti Regional, Taraho Regional

Last edited by 279 EMPIE : 05-02-2013 at 19:26.
Reply With Quote
  #11   Spotlight this post!  
Unread 05-02-2013, 19:33
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,590
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Joystick Axis Input Not Working

Quote:
Originally Posted by 279 EMPIE View Post
I'm having the same problem and i cant seem to find the Solution.
I have tried old code and the Joysticks worked fine but after i copied it didnt work still. The i created a test program (Below) and that also didn't work.

SO CONFUSED

Code:
public class RobotTemplate extends SimpleRobot {
.
.
.    
    /**
     * This function is called once each time the robot enters operator control.
     */
    public void operatorControl() {

         Jag_One.set(Joy.getY());
         Jag_Two.set(Joy.getY());
         Jag_Three.set(Joy.getY());
         Jag_Four.set(Joy.getY());
        
    }
Your code is extending SimpleRobot, but your operatorControl method doesn't have a loop in it. It is getting called once, and never again (until you disable and re-enable it. If you want to use SimpleRobot, you need to have a loop in OperatorControl. See http://wpilib.screenstepslive.com/s/...ot-programming Or, you need to be using IterativeRobot instead of SimpleRobot.
Reply With Quote
  #12   Spotlight this post!  
Unread 05-02-2013, 22:04
279 EMPIE's Avatar
279 EMPIE 279 EMPIE is offline
Head Progammer
AKA: Matthew Empie
FRC #0279 (Tech Fusion)
Team Role: Programmer
 
Join Date: Dec 2010
Rookie Year: 2011
Location: Toledo Ohio
Posts: 76
279 EMPIE is just really nice279 EMPIE is just really nice279 EMPIE is just really nice279 EMPIE is just really nice
Send a message via AIM to 279 EMPIE
Re: Joystick Axis Input Not Working

Quote:
Originally Posted by Joe Ross View Post
Your code is extending SimpleRobot, but your operatorControl method doesn't have a loop in it. It is getting called once, and never again (until you disable and re-enable it. If you want to use SimpleRobot, you need to have a loop in OperatorControl. See http://wpilib.screenstepslive.com/s/...ot-programming Or, you need to be using IterativeRobot instead of SimpleRobot.
Thank You, Cant believe i missed that
__________________
2011- Programmer, Electrical, and Web
Cleveland Regional

2012- Head Programmer, Web, Driver
Pittsburg Regional, Saint Louis International

2013- Head Programmer
Cinnicinatti Regional, Taraho Regional
Reply With Quote
Reply


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 12:48.

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