Go to Post Just because something has never been done, doesn't mean it's impossible. See: everything ever. - Taylor [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-2016, 14:34
VrewDaive VrewDaive is offline
Registered User
FRC #4284
 
Join Date: Sep 2015
Location: Cincinnati
Posts: 21
VrewDaive is an unknown quantity at this point
Xbox Controller with mecanum drive

Hello, I'm a first year FRC programmer and was curious on how to use the Xbox 360 controller as both joysticks for the
Code:
myDrive.mecanumDrive_Polar(moveStick.getY(),moveStick.getX() , rotateStick.getTwist());
I don't know how to designate the certain sticks of the controller to either moveStick or Rotate stick and also am confused on how to assign them in the declaration
Code:
myDrive =  new RobotDrive(0,1,2,3);
    	moveStick = new Joystick(1);
    	rotateStick = new Joystick(2);
Any help appreciated; Ive already looked over the other chief delphi post over this subject but am still lost. Thanks!!
Reply With Quote
  #2   Spotlight this post!  
Unread 26-01-2016, 18:45
Arhowk's Avatar
Arhowk Arhowk is offline
FiM CSA
AKA: Jake Niman
FRC #1684 (The Chimeras) (5460 Mentor)
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Lapeer
Posts: 542
Arhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to behold
Re: Xbox Controller with mecanum drive

getY() and getX() are intended for flightstick not xbox controllers

i think the code you want is

Code:
robotDrive.mecanumDrive_Cartesian(joystick.getRawAxis(whateverYourXAxisIs), joystick.getRawAxis(whateverYourYAxisIs), joystick.getRawAxis(whateverYourRotateAxisIs), whateverYourGyroValueIs)
__________________
FRC Team 1684 - Head Programmer (2013-2016)
FRC Team 5460 - Programming Mentor (2015-2016)

FIRST in Michigan - Technical Crew (2015-continuing)
Reply With Quote
  #3   Spotlight this post!  
Unread 26-01-2016, 22:45
TimTheGreat's Avatar
TimTheGreat TimTheGreat is offline
ArchdukeTim
FRC #1418 (Vae Victis)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2011
Location: Falls Church
Posts: 234
TimTheGreat has a spectacular aura aboutTimTheGreat has a spectacular aura aboutTimTheGreat has a spectacular aura about
Re: Xbox Controller with mecanum drive

The buttons on the controller follow this mapping

1: A
2: B
3: X
4: Y
5: Left Bumper
6: Right Bumper
7: Back
8: Start
9: Left Joystick
10: Right Joystick

The axis on the controller follow this mapping
(all output is between -1 and 1)

1: Left Stick X Axis
-Left:Negative ; Right: Positive
2: Left Stick Y Axis
-Up: Negative ; Down: Positive
3: Triggers
-Left: Positive ; Right: Negative
4: Right Stick X Axis
-Left: Negative ; Right: Positive
5: Right Stick Y Axis
-Up: Negative ; Down: Positive
6: Directional Pad (Not recommended, buggy)

taken from http://www.chiefdelphi.com/forums/sh...45&postcount=8
__________________
There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.



2012 - Gracious Professionalism - Greater DC
2014 - Regional Finalist - Virginia | Industrial Design - Virginia | Regional Finalist - Greater DC
2015 - Innovation in Control - Greater DC
2016 - District Event Winner - VAHAY | Innovation in Control - VAHAY | District Event Winner - MDBET | Industrial Design - MDBET | District Champion - CHCMP | Innovation in Control - CHCMP
Reply With Quote
  #4   Spotlight this post!  
Unread 27-01-2016, 14:02
VrewDaive VrewDaive is offline
Registered User
FRC #4284
 
Join Date: Sep 2015
Location: Cincinnati
Posts: 21
VrewDaive is an unknown quantity at this point
Re: Xbox Controller with mecanum drive

so would something like this work as expected?
Code:
     */  RobotDrive myDrive;
    	Joystick moveStick;
    	Gyro gyro;
    	
    
    public void robotInit() {
    	Talon TalLF = new Talon(0);
    	Talon TalLR = new Talon(1);
    	Talon TalRF = new Talon(2);
    	Talon TalRR = new Talon(3);
    	myDrive =  new RobotDrive(TalLF,TalLR,TalRF,TalRR);
    	moveStick = new Joystick(1);
    	
    }

    /**
     * This function is called periodically during autonomous
     */
    public void autonomousPeriodic() {

    }

    /**
     * This function is called periodically during operator control
     */
    public void teleopPeriodic() {
    	
    	//while(!isAutonomous() && isEnabled())
    	//{
    		//myDrive.mecanumDrive_Polar(moveStick.getRawAxis(1),moveStick.getRawAxis(2) , moveStick.getRawAxis(4));
    		myDrive.mecanumDrive_Cartesian(moveStick.getRawAxis(1), moveStick.getRawAxis(2), moveStick.getRawAxis(5), gyro.getAngle());
    		Timer.delay(0.01);
    	//}
        
    }
Reply With Quote
  #5   Spotlight this post!  
Unread 27-01-2016, 19:00
TimTheGreat's Avatar
TimTheGreat TimTheGreat is offline
ArchdukeTim
FRC #1418 (Vae Victis)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2011
Location: Falls Church
Posts: 234
TimTheGreat has a spectacular aura aboutTimTheGreat has a spectacular aura aboutTimTheGreat has a spectacular aura about
Re: Xbox Controller with mecanum drive

Quote:
Originally Posted by VrewDaive View Post
so would something like this work as expected?
Code:
    
    		myDrive.mecanumDrive_Cartesian(moveStick.getRawAxis(1), moveStick.getRawAxis(2), moveStick.getRawAxis(5), gyro.getAngle());
    	//}
        
    }
Yeah that should work.

Also, are you meaning to do field-oriented drive (pushing up on the left joystick makes the robot move away from you, no matter which way it's pointing)?
__________________
There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.



2012 - Gracious Professionalism - Greater DC
2014 - Regional Finalist - Virginia | Industrial Design - Virginia | Regional Finalist - Greater DC
2015 - Innovation in Control - Greater DC
2016 - District Event Winner - VAHAY | Innovation in Control - VAHAY | District Event Winner - MDBET | Industrial Design - MDBET | District Champion - CHCMP | Innovation in Control - CHCMP
Reply With Quote
  #6   Spotlight this post!  
Unread 28-01-2016, 09:46
CjDace CjDace is offline
Registered User
FRC #4284
 
Join Date: Jan 2016
Location: Cincinnati, Ohio
Posts: 10
CjDace is an unknown quantity at this point
Re: Xbox Controller with mecanum drive

honestly at this point no. I just want the drive to work correctly, Do we have the gyro assigned correctly?
Code:
  RobotDrive myDrive, catcherDrive;
	    	Joystick moveStick;
	    	Gyro gyro; 
myDrive.mecanumDrive_Cartesian(moveStick.getRawAxis(1), moveStick.getRawAxis(1), moveStick.getRawAxis(1), gyro.getAngle());
Reply With Quote
  #7   Spotlight this post!  
Unread 28-01-2016, 09:48
VrewDaive VrewDaive is offline
Registered User
FRC #4284
 
Join Date: Sep 2015
Location: Cincinnati
Posts: 21
VrewDaive is an unknown quantity at this point
Re: Xbox Controller with mecanum drive

that was me.... on a different account
Reply With Quote
  #8   Spotlight this post!  
Unread 28-01-2016, 17:09
TimTheGreat's Avatar
TimTheGreat TimTheGreat is offline
ArchdukeTim
FRC #1418 (Vae Victis)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2011
Location: Falls Church
Posts: 234
TimTheGreat has a spectacular aura aboutTimTheGreat has a spectacular aura aboutTimTheGreat has a spectacular aura about
Re: Xbox Controller with mecanum drive

Quote:
Originally Posted by CjDace View Post
honestly at this point no. I just want the drive to work correctly, Do we have the gyro assigned correctly?
Code:
  RobotDrive myDrive, catcherDrive;
	    	Joystick moveStick;
	    	Gyro gyro; 
myDrive.mecanumDrive_Cartesian(moveStick.getRawAxis(1), moveStick.getRawAxis(1), moveStick.getRawAxis(1), gyro.getAngle());
Well you don't create it, at least in the code you show here. If you don't want field-oriented get rid of the gyro.getAngle() in the mecanumDrive constructor and replace with 0.
__________________
There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.



2012 - Gracious Professionalism - Greater DC
2014 - Regional Finalist - Virginia | Industrial Design - Virginia | Regional Finalist - Greater DC
2015 - Innovation in Control - Greater DC
2016 - District Event Winner - VAHAY | Innovation in Control - VAHAY | District Event Winner - MDBET | Industrial Design - MDBET | District Champion - CHCMP | Innovation in Control - CHCMP

Last edited by TimTheGreat : 28-01-2016 at 17:16.
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:50.

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