Go to Post I don't fully buy into the 'we're all winners' concept. That is a broad statement that doesn't really say much. How did we become all winners? What did we do to become winners? Pay an expensive registration fee and participate in a robotic competition? - JaneYoung [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 02-02-2013, 02:48 PM
Gmercer Gmercer is offline
Registered User
None #1631
 
Join Date: Jan 2013
Location: Las Vegas
Posts: 15
Gmercer is an unknown quantity at this point
Programming an arcade drive for joysicks

I'm having a lot of trouble coming up with an algorithm on programming an arcade drive on a single joysick. We're using one joystick for our shooter, so our other one must drive the entire robot, here is what i know:

For both(joysticks):

Y values:
Up is -1
Down is 1

X values:
Left is -1
Right is 1

i know there is something to do with triangles, but i'm not quite sure. Any help / links are really appreciated, thanks!
Reply With Quote
  #2   Spotlight this post!  
Unread 02-02-2013, 02:55 PM
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 7,997
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Programming an arcade drive for joysicks

Quote:
Originally Posted by Gmercer View Post
I'm having a lot of trouble coming up with an algorithm on programming an arcade drive on a single joysick. We're using one joystick for our shooter, so our other one must drive the entire robot, here is what i know:

For both(joysticks):

Y values:
Up is -1
Down is 1

X values:
Left is -1
Right is 1

i know there is something to do with triangles, but i'm not quite sure. Any help / links are really appreciated, thanks!

You don't need to invent your own algorithm (unless you want to).

The Java WPILib already has a ready-made Arcade Drive object.

It's in the file "RobotDrive.java"

Reply With Quote
  #3   Spotlight this post!  
Unread 02-02-2013, 03:07 PM
Gmercer Gmercer is offline
Registered User
None #1631
 
Join Date: Jan 2013
Location: Las Vegas
Posts: 15
Gmercer is an unknown quantity at this point
Re: Programming an arcade drive for joysicks

Thank you very much! do you know where i can find an example of this class in action? i seems a bit confusing to me, i'm not sure where to place the robotDrive code(in a move function or when initialized?).
Reply With Quote
  #4   Spotlight this post!  
Unread 02-02-2013, 03:30 PM
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 7,997
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Programming an arcade drive for joysicks

Quote:
Originally Posted by Gmercer View Post
Thank you very much! do you know where i can find an example of this class in action? i seems a bit confusing to me, i'm not sure where to place the robotDrive code(in a move function or when initialized?).
Doesn't your FRC Java installation come with a complete example project, complete with drive code, which shows where everything goes?


Reply With Quote
  #5   Spotlight this post!  
Unread 02-02-2013, 03:36 PM
Gmercer Gmercer is offline
Registered User
None #1631
 
Join Date: Jan 2013
Location: Las Vegas
Posts: 15
Gmercer is an unknown quantity at this point
Re: Programming an arcade drive for joysicks

It includes a sample project on how to pick up reflective tape and aim, but nothing on the arcadeDrive object


EDIT: got it working! thanks for the help, though i came across another problem when i got the arcade drive working....
I had to remove my calls to the jaguars to initialize the arcade drive object, so i need to also modify my shoot function. it WAS like this:

Code:
if(gShoot.getAngle < finalAngle) {
    //slowly turns motors until angle is reached
    jag1.set(.15);
    jag2.set(.15);
    jag3.set(.15);
    jag4.set(.15);
}
i tried using arcadeDrive(0.0, .15) but the robot just stood still, should i use the drive functin instead?
//function goes on...

Last edited by Gmercer : 02-02-2013 at 04:12 PM.
Reply With Quote
  #6   Spotlight this post!  
Unread 02-02-2013, 05:46 PM
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: Programming an arcade drive for joysicks

Quote:
Originally Posted by Gmercer View Post
It includes a sample project on how to pick up reflective tape and aim, but nothing on the arcadeDrive object


EDIT: got it working! thanks for the help, though i came across another problem when i got the arcade drive working....
I had to remove my calls to the jaguars to initialize the arcade drive object, so i need to also modify my shoot function. it WAS like this:

Code:
if(gShoot.getAngle < finalAngle) {
    //slowly turns motors until angle is reached
    jag1.set(.15);
    jag2.set(.15);
    jag3.set(.15);
    jag4.set(.15);
}
i tried using arcadeDrive(0.0, .15) but the robot just stood still, should i use the drive functin instead?
//function goes on...
use

arcadeDrive(0,0.15)

though 0.15 is hardly ANYTHING, i cant get my robot to move (due to jaguars not putting enough force) without a 0.25 move
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 07:47 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