Go to Post Taking some parts from an old robot isn't cheap, it's like adding a piece with more experience to the new robot. - Marcel [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 Rating: Thread Rating: 3 votes, 4.67 average. Display Modes
  #1   Spotlight this post!  
Unread 29-01-2011, 20:58
Patrick Chiang Patrick Chiang is offline
Programming
FRC #3070 (Team Pronto)
Team Role: Mentor
 
Join Date: Feb 2009
Rookie Year: 2009
Location: Seattle
Posts: 162
Patrick Chiang is a name known to allPatrick Chiang is a name known to allPatrick Chiang is a name known to allPatrick Chiang is a name known to allPatrick Chiang is a name known to allPatrick Chiang is a name known to all
Re: Single Joystick Tank Drive

Use the arcade drive method in Joystick. It will do EXACTLY what you want it to do.
Reply With Quote
  #2   Spotlight this post!  
Unread 30-01-2011, 20:00
Shantali Shantali is offline
Registered User
FRC #3609
 
Join Date: Jan 2011
Location: Maine, US
Posts: 9
Shantali is an unknown quantity at this point
Re: Single Joystick Tank Drive

Thanks for the responses!

I got it working with
Code:
m_robotDrive.arcadeDrive(m_driveStick.getY(), m_driveStick.getX());
It does everything as intended, but there's something i'd like to change.

Right now it goes forward, back, turns on the spot and strafes forward perfectly.

But if trying to pull the joystick back-left, the left motor is working 100% backwards, which essentially moves the robot's back to the right. If pulling back-right, the right motor is working 100% backwards, which moves the robot back to the left. Intuitively when trying to do that, you'd expect it to work like a car would, turning left would make the back go left..

I would like to change that so drivers could have it more intuitively.

I will post when/if I figure it out. Again, thanks everyone for taking the time.

J
Reply With Quote
  #3   Spotlight this post!  
Unread 30-01-2011, 20:05
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,043
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: Single Joystick Tank Drive

Quote:
Originally Posted by Shantali View Post
But if trying to pull the joystick back-left, the left motor is working 100% backwards, which essentially moves the robot's back to the right. If pulling back-right, the right motor is working 100% backwards, which moves the robot back to the left. Intuitively when trying to do that, you'd expect it to work like a car would, turning left would make the back go left..

I would like to change that so drivers could have it more intuitively.
That's what this is supposed to do. Try it.


Reply With Quote
  #4   Spotlight this post!  
Unread 02-02-2011, 00:18
Shantali Shantali is offline
Registered User
FRC #3609
 
Join Date: Jan 2011
Location: Maine, US
Posts: 9
Shantali is an unknown quantity at this point
Re: Single Joystick Tank Drive

I was trying to work around that using
Code:
double m_y = m_driveStick.getY();
double m_x = m_driveStick.getX();
if (m_y >= 0) //the Y axis is inverted, so going forward is negative number
    m_x = 0-m_x; //inverting X value
m_robotDrive.arcadeDrive(m_y, m_x);
The problem I faced with that was that the joystick wasn't giving me a perfect 0.. I added a simple println statement to get the y values, and it ranged anywhere from -0.3 to 0.3...

Ether, it looks like your solution
Quote:
if(Yj<=0){L=-Yj+Xj; R=-Yj-Xj;}
would have the same problem.

I tried something like if m_y >= -0.3, but it results in motors rapidly switching directions if starting slowly..

Another possible solution would be treating anything within .2 or so from the axis as 0.. but it doesn't seem like the best way of doing it either.

Thanks in advance,
j.
Reply With Quote
  #5   Spotlight this post!  
Unread 03-02-2011, 11:51
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,043
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: Single Joystick Tank Drive

Quote:
Originally Posted by Shantali View Post
The problem I faced with that was that the joystick wasn't giving me a perfect 0.. I added a simple println statement to get the y values, and it ranged anywhere from -0.3 to 0.3...
Are you saying you got readings in the range -0.3 to 0.3 for Y when the joystick was in the null position?


Reply With Quote
  #6   Spotlight this post!  
Unread 03-02-2011, 13:44
Shantali Shantali is offline
Registered User
FRC #3609
 
Join Date: Jan 2011
Location: Maine, US
Posts: 9
Shantali is an unknown quantity at this point
Re: Single Joystick Tank Drive

Yup
Reply With Quote
  #7   Spotlight this post!  
Unread 03-02-2011, 13:48
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,043
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: Single Joystick Tank Drive

Try a different joystick.


Reply With Quote
  #8   Spotlight this post!  
Unread 03-02-2011, 15:12
rsisk's Avatar
rsisk rsisk is offline
The GURU Channel
AKA: Richard Sisk
FRC #2493 (Robokong)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2007
Location: Riverside, CA
Posts: 2,748
rsisk has a reputation beyond reputersisk has a reputation beyond reputersisk has a reputation beyond reputersisk has a reputation beyond reputersisk has a reputation beyond reputersisk has a reputation beyond reputersisk has a reputation beyond reputersisk has a reputation beyond reputersisk has a reputation beyond reputersisk has a reputation beyond reputersisk has a reputation beyond repute
Send a message via MSN to rsisk
Re: Single Joystick Tank Drive

I believe you can also go into the windows control panel, find the Game Controllers adapter and use it to center the joystick (ie, the joystick reads 0,0 when centered).
__________________
Quote:
The views expressed are mine and should not be construed to represent the views of anyone else.
Reply With Quote
  #9   Spotlight this post!  
Unread 03-02-2011, 15:55
Shantali Shantali is offline
Registered User
FRC #3609
 
Join Date: Jan 2011
Location: Maine, US
Posts: 9
Shantali is an unknown quantity at this point
Re: Single Joystick Tank Drive

It does say 0.0 at the beginning, but after driving it for a bit then letting go, it doesn't always center perfectly.

Both of our joysticks do that :\
Reply With Quote
  #10   Spotlight this post!  
Unread 03-02-2011, 16:00
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,043
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: Single Joystick Tank Drive

Quote:
Originally Posted by Shantali View Post
It does say 0.0 at the beginning, but after driving it for a bit then letting go, it doesn't always center perfectly.

Both of our joysticks do that :\
Clean the Mountain Dew out of them.


Reply With Quote
  #11   Spotlight this post!  
Unread 03-02-2011, 17:19
Shantali Shantali is offline
Registered User
FRC #3609
 
Join Date: Jan 2011
Location: Maine, US
Posts: 9
Shantali is an unknown quantity at this point
Re: Single Joystick Tank Drive

They're clean outta the box ones... :'(
Reply With Quote
  #12   Spotlight this post!  
Unread 03-02-2011, 17:30
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,043
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: Single Joystick Tank Drive

Quote:
Originally Posted by Shantali View Post
They're clean outta the box ones... :'(
Maybe there's an error in your software?

Try loading the default code that came with the LabVIEW installation and run it and see if it does the same thing.



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 11:21.

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