Go to Post I had a few jokes about the illness and germs at some of the competitions, but I don't want to spread them around. - tsaksa [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 22-03-2013, 16:13
nydnh01 nydnh01 is offline
Registered User
AKA: Naresh Hing
FRC #1601 (Quantum Samurai)
Team Role: Alumni
 
Join Date: Feb 2011
Rookie Year: 2011
Location: Richmond Hill, NY
Posts: 43
nydnh01 is an unknown quantity at this point
Joystick Command not working

We have recently encountered this problem, our joystick command did not work. We tried Joystick USB1 = new Joystick(1); in our program. In our driver Station under set up it is reading the joysticks as a button press causes the joystick color tab to change in the DS. Has anyone encountered this problem if so how did you fix the problem.
Reply With Quote
  #2   Spotlight this post!  
Unread 22-03-2013, 18:56
otherguy's Avatar
otherguy otherguy is offline
sparkE
AKA: James
FRC #2168 (The Aluminum Falcons)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: CT
Posts: 434
otherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to behold
Re: Joystick Command not working

What exactly isn't working? What error(s) are you getting?
How are you linking a command to a button press? And where do these calls reside in your code (which method(s)?)

Share your code and elaborate.
As is you haven't provided enough info for anyone to troubleshoot the problem.
__________________
http://team2168.org
Reply With Quote
  #3   Spotlight this post!  
Unread 22-03-2013, 19:31
nydnh01 nydnh01 is offline
Registered User
AKA: Naresh Hing
FRC #1601 (Quantum Samurai)
Team Role: Alumni
 
Join Date: Feb 2011
Rookie Year: 2011
Location: Richmond Hill, NY
Posts: 43
nydnh01 is an unknown quantity at this point
Re: Joystick Command not working

We are using this code to do the drive on our base robot. It has worked in the past with our actual robot and connected the same way our actual robot is wired. I have uploaded the code to the basebot and it seems to not work. All of our jaguars have a solid light indicating a pwm signal and the joystick does not work on commanding the robot. When ever I connect the joystick the button the joystick color on the setup is different indicating the DS is reading the joystick. Does anyone know any solution?
[public class TankDrive extends Thread {
public void run(){
while(true){
Joystick USB1 = new Joystick(1);
RobotDrive drive = new RobotDrive(2,3,1,4);


drive.tankDrive(USB1.getRawAxis(2), USB1.getRawAxis(4));
}

}}
]
Reply With Quote
  #4   Spotlight this post!  
Unread 22-03-2013, 20:07
joelg236 joelg236 is offline
4334 Retired Mentor & Alumni
AKA: Joel Gallant
no team
Team Role: Mentor
 
Join Date: Dec 2011
Rookie Year: 2012
Location: Calgary
Posts: 733
joelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond repute
Re: Joystick Command not working

You're creating the Joystick and RobotDrive object once every loop. Construct objects outside of your loop. (in the class)
__________________
All opinions are my own.
Reply With Quote
  #5   Spotlight this post!  
Unread 22-03-2013, 20:13
otherguy's Avatar
otherguy otherguy is offline
sparkE
AKA: James
FRC #2168 (The Aluminum Falcons)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: CT
Posts: 434
otherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to behold
Re: Joystick Command not working

Quote:
Construct objects outside of your loop. (in the class)
Code:
public class TankDrive extends Thread {
  Joystick USB1 = new Joystick(1);
  RobotDrive drive = new RobotDrive(2,3,1,4);

  public void run(){
    while(true){
      drive.tankDrive(USB1.getRawAxis(2), USB1.getRawAxis(4));
    }
  }
}
Note, you shouldn't need to command the drivetrain in its own thread though...

Also, verify with your controller, but typically the y axis on the right analog stick of a joystick is on axis 5 (you are using 4 above). If you find that the right side of your drivetrain doesn't move as expected, this is likely your problem.
__________________
http://team2168.org
Reply With Quote
  #6   Spotlight this post!  
Unread 22-03-2013, 20:18
joelg236 joelg236 is offline
4334 Retired Mentor & Alumni
AKA: Joel Gallant
no team
Team Role: Mentor
 
Join Date: Dec 2011
Rookie Year: 2012
Location: Calgary
Posts: 733
joelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond repute
Re: Joystick Command not working

Quote:
Originally Posted by otherguy View Post
Code:
public class TankDrive extends Thread {
  Joystick USB1 = new Joystick(1);
  RobotDrive drive = new RobotDrive(2,3,1,4);

  public void run(){
    while(true){
      drive.tankDrive(USB1.getRawAxis(2), USB1.getRawAxis(4));
    }
  }
}
My bad. Looked different without formatting.
__________________
All opinions are my own.
Reply With Quote
  #7   Spotlight this post!  
Unread 23-03-2013, 14:14
otherguy's Avatar
otherguy otherguy is offline
sparkE
AKA: James
FRC #2168 (The Aluminum Falcons)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: CT
Posts: 434
otherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to behold
Re: Joystick Command not working

Quote:
Originally Posted by joelg236 View Post
My bad. Looked different without formatting.
No you were right, I was just showing what you suggested as a modification to their code.
__________________
http://team2168.org

Last edited by otherguy : 23-03-2013 at 14:14. Reason: typo
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