Go to Post Actually there are several Wayne Cokeleys circulating around. We cloned him in 2001. This is his evil twin Mordechai responding.....-WC 3 - Wayne C. [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 14-02-2015, 13:36
antonyebert antonyebert is offline
Registered User
FRC #4993
 
Join Date: Jan 2015
Location: NCA - Hutchinson, MN
Posts: 9
antonyebert is an unknown quantity at this point
Exclamation Joysticks Not Working Correctly

So, I have my entire program uploaded onto GitHub here:
https://github.com/KenzieShay/FRC-2015/tree/SideBranch
The name of the robot is Molly, so that's what the file is called on GitHub.

I finally got the robot to respond to the Drive Station, but it was only reacting to one joystick instead of the two of them. The wheels would both go (although it opposite directions ) when I moved the one joystick, but nothing would happen when I moved the other. I tried switching the order of the joysticks around in the driver station usb port tab, and the same thing happened, but with the joystick that was previously useless now working (so pretty much which ever joystick is in the 0 order of the drive station works).

I tried to fix that, and now all I get are error messages from the drive station. I feel like there is most likely a simple answer, but I'm so inexperienced, I'll probably never figure it out in time.
Reply With Quote
  #2   Spotlight this post!  
Unread 14-02-2015, 22:01
cstelter cstelter is offline
Programming Mentor
AKA: Craig Stelter
FRC #3018 (Nordic Storm)
Team Role: Mentor
 
Join Date: Apr 2012
Rookie Year: 2012
Location: Mankato, MN
Posts: 77
cstelter will become famous soon enough
Re: Joysticks Not Working Correctly

One problem I see is in OI:

Code:
public class OI {
    ...	
	 public JoystickButton joystickButton1;
	    public static Joystick joystick1;
	    public JoystickButton joystickButton2;
	    public static Joystick joystick2;

	    public OI() {
	        // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS

	        Joystick joystick2 = new Joystick(1);
	        
	        Button joystickButton2 = new JoystickButton(joystick2, 1);
	        joystickButton2.whileHeld(new SetDown());
	        
	        Joystick joystick1 = new Joystick(0);
The red lines are problematic. You are declaring a local joystick only within the OI constructor that hides the static field definition that getJoystick() and your calls to OI.joystick1 will retrieve.

So I suspect that the default constructor for Joystick assigns 0 and you never get joystick2 assigned to 1.

Remove the red words and I suspect it may work better.
Reply With Quote
  #3   Spotlight this post!  
Unread 15-02-2015, 00:25
JacobD's Avatar
JacobD JacobD is offline
Registered User
AKA: Jacob
FRC #1672 (Mahwah Robo T-Birds)
Team Role: Leadership
 
Join Date: Jan 2015
Rookie Year: 2013
Location: New Jersey
Posts: 92
JacobD is an unknown quantity at this point
Re: Joysticks Not Working Correctly

Make sure that the Joystick channels you used in the code correspond to the channels on the driver station. The first joystick plugged in should be 0, and the second is 1. Also, you can change this in the third tab on the left side of the driver station. Just reorder the usb inputs.
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 13:38.

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