Go to Post Remember, GP doesnt just need to apply to FIRST; if we all apply in our lives as a whole, the world will be a better place. - Dillon Compton [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 18-01-2011, 15:44
robotic321's Avatar
robotic321 robotic321 is offline
Registered User
FRC #1793
 
Join Date: Jan 2010
Location: Norfolk, VA
Posts: 24
robotic321 is an unknown quantity at this point
Logitech Dual Action Setup for 2 Axis help please?

Hey, im kinda new to FRC java and i need assitance in making a basic drive program that will work 2 joysticks on 1 controller. How would i set it up correctly?
__________________
=-=-=-=-=-=-=-=-=-=-=-=-=-=


1793 FTW
=-=-=-=-=-=-=-=-=-=-=-=-=-=
Reply With Quote
  #2   Spotlight this post!  
Unread 18-01-2011, 16:34
Robby Unruh's Avatar
Robby Unruh Robby Unruh is offline
*insert random dial-up tone here*
FRC #3266 (Robots R Us)
Team Role: Coach
 
Join Date: Feb 2010
Rookie Year: 2010
Location: Eaton, OH
Posts: 338
Robby Unruh will become famous soon enough
Re: Logitech Dual Action Setup for 2 Axis help please?

You mean like tank drive on an Xbox or PS3 controller, right? I'd assume you'd use it like any joystick. Define it on whatever USB port and you should be set.

There's also a pretty good post about something like this here. (and VIA link from that thread here, too)
__________________
[Robots R Us #3266]
2015: Georgia Southern Classic (Winners / Thanks 1319 & 1648!), Queen City
2014: Crossroads, Queen City
2013: Buckeye, Queen City, Crossroads
2012: Buckeye, Queen City

2011: Buckeye
2010: Buckeye
Reply With Quote
  #3   Spotlight this post!  
Unread 18-01-2011, 22:16
JewishDan18's Avatar
JewishDan18 JewishDan18 is offline
Registered User
FRC #1700
Team Role: Engineer
 
Join Date: Feb 2009
Rookie Year: 2007
Location: Sunnyvale, CA
Posts: 185
JewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to behold
Re: Logitech Dual Action Setup for 2 Axis help please?

You just declare it like any ordinary joystick, and read each axis from each joystick independantly. One stick will be axis 1 and 2, the other will be 3 and 4 (Unless there are other analog inputs). Also, make sure the DS has the proper drivers!
Reply With Quote
  #4   Spotlight this post!  
Unread 19-01-2011, 12:58
robotic321's Avatar
robotic321 robotic321 is offline
Registered User
FRC #1793
 
Join Date: Jan 2010
Location: Norfolk, VA
Posts: 24
robotic321 is an unknown quantity at this point
Re: Logitech Dual Action Setup for 2 Axis help please?

alright, but how would i declare it? This is the way i thought it could work itself :


Joystick joy1 = new Joystick(1);


But, how would i refer to the axis number that i desire and not have it get a heart attack (stay away literal types (_v)
__________________
=-=-=-=-=-=-=-=-=-=-=-=-=-=


1793 FTW
=-=-=-=-=-=-=-=-=-=-=-=-=-=
Reply With Quote
  #5   Spotlight this post!  
Unread 19-01-2011, 18:34
Robby Unruh's Avatar
Robby Unruh Robby Unruh is offline
*insert random dial-up tone here*
FRC #3266 (Robots R Us)
Team Role: Coach
 
Join Date: Feb 2010
Rookie Year: 2010
Location: Eaton, OH
Posts: 338
Robby Unruh will become famous soon enough
Re: Logitech Dual Action Setup for 2 Axis help please?

Quote:
Originally Posted by Jared341 View Post
Quote:
Axis indexes:
1 - LeftX
2 - LeftY
3 - Triggers (Each trigger = 0 to 1, axis value = right - left)
4 - RightX
5 - RightY
6 - DPad Left/Right

Button mapping matches Windows Control Panel>Game Pads display
To read an axis (like the left stick Y axis), simply do:

Code:
double axisValue = mXboxController.getRawAxis(2); // Where "2" is the index of the Y axis on the left stick (see above)
sums it up quite nicely.
__________________
[Robots R Us #3266]
2015: Georgia Southern Classic (Winners / Thanks 1319 & 1648!), Queen City
2014: Crossroads, Queen City
2013: Buckeye, Queen City, Crossroads
2012: Buckeye, Queen City

2011: Buckeye
2010: Buckeye
Reply With Quote
  #6   Spotlight this post!  
Unread 20-01-2011, 22:07
JewishDan18's Avatar
JewishDan18 JewishDan18 is offline
Registered User
FRC #1700
Team Role: Engineer
 
Join Date: Feb 2009
Rookie Year: 2007
Location: Sunnyvale, CA
Posts: 185
JewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to beholdJewishDan18 is a splendid one to behold
Re: Logitech Dual Action Setup for 2 Axis help please?

Quote:
Originally Posted by robotic321 View Post
alright, but how would i declare it? This is the way i thought it could work itself :


Joystick joy1 = new Joystick(1);


But, how would i refer to the axis number that i desire and not have it get a heart attack (stay away literal types (_v)
Yes, thats exactly how to do it. As Robby Unruh said, you would them call

Code:
joy1.getRawAxis(1)
to get the value of the first axis, and you would use the proper index from the list that Robby Unruh posted. For a two sided drive system, I believe you would want 2 and 5.
Reply With Quote
  #7   Spotlight this post!  
Unread 23-01-2011, 16:15
wjbrauck wjbrauck is offline
Team Mentor
FRC #0768 (Techno Warriors)
Team Role: Mentor
 
Join Date: Mar 2007
Rookie Year: 2005
Location: Baltimore, Md
Posts: 4
wjbrauck is an unknown quantity at this point
Re: Logitech Dual Action Setup for 2 Axis help please?

We just modified last years code yesterday to get this working. We found axis mapping to be
Axis indexes:
1 - Left joystick X
2 - Left joystick Y
3 - Right joystick X
4 - Right joystick Y
5 - DPad x
6 - DPad y

to stay with tank drive and use both joysticks from one game pad plugged into USB port 1, the code looked like

in the constructor
m_driveStick = new Joystick(1);

in the teleop section
m_robotDrive.tankDrive(m_driveStick, 4, m_driveStick, 2);

where 4 and 2 are the axis numbers assigned to the left and right joystick arguments.

wjb
Reply With Quote
  #8   Spotlight this post!  
Unread 24-01-2011, 08:07
inkspell4's Avatar
inkspell4 inkspell4 is offline
Registered User
FRC #3650 (Robo Raptors)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Maryland
Posts: 326
inkspell4 will become famous soon enough
Re: Logitech Dual Action Setup for 2 Axis help please?

in these examples what would have to be imported in order for these to be used?
__________________
Chesapeake Regional : 2013, 2012, 2011
Rookie Year: 2011
2013 RoboRaptors Team 3650 Programming Team Captain
Team Website : http://www.roboraptorsfrcteam3650.com/index.html
_____________________________________________
Reply With Quote
  #9   Spotlight this post!  
Unread 24-01-2011, 19:08
Robby Unruh's Avatar
Robby Unruh Robby Unruh is offline
*insert random dial-up tone here*
FRC #3266 (Robots R Us)
Team Role: Coach
 
Join Date: Feb 2010
Rookie Year: 2010
Location: Eaton, OH
Posts: 338
Robby Unruh will become famous soon enough
Re: Logitech Dual Action Setup for 2 Axis help please?

Quote:
Originally Posted by inkspell4 View Post
in these examples what would have to be imported in order for these to be used?
In my code I usually just use:

Code:
import edu.wpi.first.wpilibj.*;
so it imports everything. But for Joystick's it's just:

Code:
 import edu.wpi.first.wpilibj.Joystick;
__________________
[Robots R Us #3266]
2015: Georgia Southern Classic (Winners / Thanks 1319 & 1648!), Queen City
2014: Crossroads, Queen City
2013: Buckeye, Queen City, Crossroads
2012: Buckeye, Queen City

2011: Buckeye
2010: Buckeye
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 10:39.

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