Go to Post It truly is a Merry Vexmas! - Ginger Power [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 26-01-2015, 19:43
TheLegion TheLegion is offline
Registered User
FRC #2353
 
Join Date: Jan 2015
Location: Kansas
Posts: 6
TheLegion is an unknown quantity at this point
Getting Rotation to work with XBOX 360 controller

Hello all

So our team is programming in java and we are having trouble getting the robot to turn/rotate. We are using a XBOX Controller and using the left stick to go forward and strafe and the right stick for turning/rotation. The left stick functions perfectly but the right stick has issues. When the right stick is moved around, the robot starts to rotate but then will stop. It never completes a rotation fully. We are using mecanum. Here is our code so far:

Code:
while (isOperatorControl()&&isEnabled()) {
      double leftXAxis=xboxController.getRawAxis(1);
      double leftYAxis=xboxController.getRawAxis(2);

      chassis.mecanumDrive_Cartesian(leftXAxis, leftYAxis, xboxController.getRawAxis(4),0);
Basically my question is how to get rotation to work with the right stick.

Thanks

Last edited by TheLegion : 26-01-2015 at 23:22.
Reply With Quote
  #2   Spotlight this post!  
Unread 26-01-2015, 23:42
NWChen's Avatar
NWChen NWChen is offline
Alum
no team
 
Join Date: Oct 2012
Rookie Year: 2012
Location: New York City
Posts: 205
NWChen is a splendid one to beholdNWChen is a splendid one to beholdNWChen is a splendid one to beholdNWChen is a splendid one to beholdNWChen is a splendid one to beholdNWChen is a splendid one to beholdNWChen is a splendid one to behold
Re: Getting Rotation to work with XBOX 360 controller

Quote:
Originally Posted by TheLegion View Post
When the right stick is moved around, the robot starts to rotate but then will stop.
How are you moving the right stick around? If moving only in the right joystick x-axis, then the mapping to axis 4 is correct.

What output is produced when you print
Code:
joystick.getRawAxis(4);
? Does it correspond to how you move the joystick (e.g. numbers in a range from -1.0 to 1.0)?
__________________
2012 - 2015 • Team 2601

Reply With Quote
  #3   Spotlight this post!  
Unread 28-01-2015, 21:05
TheLegion TheLegion is offline
Registered User
FRC #2353
 
Join Date: Jan 2015
Location: Kansas
Posts: 6
TheLegion is an unknown quantity at this point
Re: Getting Rotation to work with XBOX 360 controller

Yeah, the output does correspond to the range of -1 to 1. When we move the right analog stick, some of the wheels don't move in the right direction, but when we strafe or go forwards and backwards, the wheels work perfectly fine.
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:37.

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