|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
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() {
}
}
|
|
#2
|
|||||
|
|||||
|
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. Last edited by Mark McLeod : 31-01-2013 at 10:45. |
|
#3
|
|||
|
|||
|
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. |
|
#4
|
|||||
|
|||||
|
Re: Joystick Axis Input Not Working
Use the Windows Game Controller utility to see if the PC recognizes the joystick axes.
|
|
#5
|
||||
|
||||
|
Re: Joystick Axis Input Not Working
Get rid of the delay. I've found it can lead to a lot of issues.
|
|
#6
|
|||
|
|||
|
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. |
|
#7
|
|||||
|
|||||
|
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. Last edited by Mark McLeod : 02-02-2013 at 12:36. |
|
#8
|
||||
|
||||
|
Re: Joystick Axis Input Not Working
You can calibrate it as well if you need to.
|
|
#9
|
|||
|
|||
|
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... |
|
#10
|
||||
|
||||
|
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() {
}
}
Last edited by 279 EMPIE : 05-02-2013 at 19:26. |
|
#11
|
||||||
|
||||||
|
Re: Joystick Axis Input Not Working
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|