Go to Post We have a little saying on our team. "Don't worry, we'll fix it in software." - klrswift [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 04-08-2013, 09:55 PM
tuXguy15's Avatar
tuXguy15 tuXguy15 is offline
Team Mentor
AKA: Devin Kolarac
FRC #2559 (Normality Zero)
 
Join Date: Apr 2012
Rookie Year: 2012
Location: Harrisburg, PA
Posts: 127
tuXguy15 is an unknown quantity at this point
Xbox Controller Axis 3

Hello. My team has decided that we are using the xbox controller for our regional competition. I have it all done except one thing that i cant quite get to work right. The two trigger buttons at the top back of the xbox controller I believe is Axis 3. We are trying to get the left side to activate one solenoid and the right side to activate the other. Is this possible since its not like a normal button that is a boolean and if so how can I go about this? Thansk.
Reply With Quote
  #2   Spotlight this post!  
Unread 04-08-2013, 10:23 PM
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: Xbox Controller Axis 3

Code:
    solenoid.set(controller.getRawAxis(3) < -0.7)
__________________
All opinions are my own.
Reply With Quote
  #3   Spotlight this post!  
Unread 04-08-2013, 10:52 PM
ekapalka's Avatar
ekapalka ekapalka is offline
Registered User
FRC #3216
 
Join Date: Dec 2012
Location: Bermuda
Posts: 277
ekapalka has a spectacular aura aboutekapalka has a spectacular aura about
Re: Xbox Controller Axis 3

If you're not entirely sure what axis it is, go to Run and type "joy.cpl" without quotes. There should be a mapping under the Properties tab (while the controller is plugged in). The triggers together are actually one axis, with the left side being zero through negative one and the right side being zero through positive one. That way, synchronous triggers always equal 0 (both pressed, neither pressed, both half-pressed, and so on). I think you would probably be better off with the bumpers (because they're boolean, like solenoids; on or off) for your purpose. Just my thoughts

Code:
//pseudocode
if (triggeraxis > 0)//Room for error? change 0 to 0.5
{
    //solenoid 1
}
else if (triggeraxis < 0) //should be some room for error, like -0.5
{
    //solenoid 2
}
else
{
   //set solenoid 1 and 2 to off
}
Reply With Quote
  #4   Spotlight this post!  
Unread 04-08-2013, 11:06 PM
gixxy's Avatar
gixxy gixxy is offline
Programming and Arduino Mentor
AKA: Gustave Michel III
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Nov 2011
Rookie Year: 2012
Location: Ruston, LA
Posts: 207
gixxy is on a distinguished road
Re: Xbox Controller Axis 3

In my XboxController class I have it setup so that the trigger axis pretends to be buttons. You can even use them with the Button class to start commands in the CommandBased Structure:

XboxController.java
__________________
Programmer - A creature known for converting Caffeine into Code.
Studying Computer Science @ Louisiana Tech University
Associate Consultant @ Fenway Group

2012-13: 3946 - Head of Programming, Electrical and Web
2014 - 3468 - Programming Mentor
2015 - Present - Lurker
Reply With Quote
  #5   Spotlight this post!  
Unread 04-10-2013, 07:11 PM
tuXguy15's Avatar
tuXguy15 tuXguy15 is offline
Team Mentor
AKA: Devin Kolarac
FRC #2559 (Normality Zero)
 
Join Date: Apr 2012
Rookie Year: 2012
Location: Harrisburg, PA
Posts: 127
tuXguy15 is an unknown quantity at this point
Re: Xbox Controller Axis 3

nothing is working
Reply With Quote
  #6   Spotlight this post!  
Unread 04-10-2013, 07:47 PM
ekapalka's Avatar
ekapalka ekapalka is offline
Registered User
FRC #3216
 
Join Date: Dec 2012
Location: Bermuda
Posts: 277
ekapalka has a spectacular aura aboutekapalka has a spectacular aura about
Re: Xbox Controller Axis 3

joy.cpl
Is it communicating with your computer? Are the drivers installed? If joy.cpl shows it's not working, it's not the code.
Reply With Quote
  #7   Spotlight this post!  
Unread 04-10-2013, 09:05 PM
tuXguy15's Avatar
tuXguy15 tuXguy15 is offline
Team Mentor
AKA: Devin Kolarac
FRC #2559 (Normality Zero)
 
Join Date: Apr 2012
Rookie Year: 2012
Location: Harrisburg, PA
Posts: 127
tuXguy15 is an unknown quantity at this point
Re: Xbox Controller Axis 3

It is communicating.
Reply With Quote
  #8   Spotlight this post!  
Unread 04-10-2013, 10:23 PM
Johnbot's Avatar
Johnbot Johnbot is offline
Es Brokein!
AKA: John Westhoff
FRC #4791 (Pandroids)
Team Role: Mentor
 
Join Date: Feb 2012
Rookie Year: 2010
Location: Horsham, PA
Posts: 92
Johnbot is just really niceJohnbot is just really niceJohnbot is just really niceJohnbot is just really niceJohnbot is just really nice
Re: Xbox Controller Axis 3

Are you pressing both triggers at the same time? Because if so, that won't work.

What our team did to test the xbox controllers was something along the lines of this code:
Code:
for (int i = 1; i <= 6; i ++)
{
System.out.println("AXIS "+i +" READS "+joystick.getRawAxis(i);
}
If you run this in your teleop code, and monitor the NetConsole, you should see Axis 3 read a value of near 0when neither trigger is pressed, a value of near 1 when one trigger is pressed, and a value of near -1 when the other is pressed.
If you can confirm that Axis3 does behave in that manner, then joelg236's code should work with the addition of setting another solenoid when the value is > 0.7.
__________________

2011-2014 - FRC 2607 - Student
2012-2012 - FLL 2249 - Coach
2015- ???? - FRC 4791 - Mentor
Reply With Quote
  #9   Spotlight this post!  
Unread 04-10-2013, 10:56 PM
gixxy's Avatar
gixxy gixxy is offline
Programming and Arduino Mentor
AKA: Gustave Michel III
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Nov 2011
Rookie Year: 2012
Location: Ruston, LA
Posts: 207
gixxy is on a distinguished road
Re: Xbox Controller Axis 3

It would help if we could see your code.
__________________
Programmer - A creature known for converting Caffeine into Code.
Studying Computer Science @ Louisiana Tech University
Associate Consultant @ Fenway Group

2012-13: 3946 - Head of Programming, Electrical and Web
2014 - 3468 - Programming Mentor
2015 - Present - Lurker
Reply With Quote
  #10   Spotlight this post!  
Unread 04-13-2013, 08:50 PM
tuXguy15's Avatar
tuXguy15 tuXguy15 is offline
Team Mentor
AKA: Devin Kolarac
FRC #2559 (Normality Zero)
 
Join Date: Apr 2012
Rookie Year: 2012
Location: Harrisburg, PA
Posts: 127
tuXguy15 is an unknown quantity at this point
Re: Xbox Controller Axis 3

Sorry guys. The code was right, but wasn't working because the solenoid wires got crushed and needed rewired. Thanks for your help.
Reply With Quote
  #11   Spotlight this post!  
Unread 04-14-2013, 05:44 PM
gixxy's Avatar
gixxy gixxy is offline
Programming and Arduino Mentor
AKA: Gustave Michel III
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Nov 2011
Rookie Year: 2012
Location: Ruston, LA
Posts: 207
gixxy is on a distinguished road
Re: Xbox Controller Axis 3

Glad to hear your problem was resolved!
__________________
Programmer - A creature known for converting Caffeine into Code.
Studying Computer Science @ Louisiana Tech University
Associate Consultant @ Fenway Group

2012-13: 3946 - Head of Programming, Electrical and Web
2014 - 3468 - Programming Mentor
2015 - Present - Lurker
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 08:55 AM.

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