Go to Post This is ChiefDelphi. There are threads on everything! - LauraN [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 14-02-2005, 21:29
Idaman323 Idaman323 is offline
In Theory, Our Robot Would Own.
FRC #1706
Team Role: Driver
 
Join Date: Feb 2005
Rookie Year: 2005
Location: Wentzville, MO
Posts: 116
Idaman323 is an unknown quantity at this point
Tank Drive

We need help with using two joysticks with a tank drive system. I do believe the default code is only one joystick. If there is code somewhere, documentation, or even your help, it would help greatly, thank you!
  #2   Spotlight this post!  
Unread 14-02-2005, 21:46
AIBob's Avatar
AIBob AIBob is offline
AI Programmer
AKA: Bob Frank DOT org
FRC #0358 (Hauppauge Robotic Eagles)
Team Role: Alumni
 
Join Date: Jan 2005
Rookie Year: 2003
Location: Long Island, NY (in Binghamton now)
Posts: 297
AIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to behold
Send a message via ICQ to AIBob Send a message via AIM to AIBob Send a message via MSN to AIBob Send a message via Yahoo to AIBob
Re: Tank Drive

Tank drive is very simple to program, and I believe that it is included in the default code, as an option. but here is what you would use as the code:
Code:
pwm01 = p1_y;   //change 01 and 1 to appropriate joystick and pwm output
pwm02 = p2_y;   //change 02 and 2 to appropriate joystick and pwm output
Thats basically it...
You put that in the function 'User_Driver' in place of whtever code you used, and its tank drive.
__________________
- from B B frank

  #3   Spotlight this post!  
Unread 14-02-2005, 21:49
Goobergunch Goobergunch is offline
Registered User
FRC #1168 (Malvern Robotics)
Team Role: Alumni
 
Join Date: Mar 2004
Rookie Year: 2004
Location: Paoli, PA
Posts: 246
Goobergunch is a name known to allGoobergunch is a name known to allGoobergunch is a name known to allGoobergunch is a name known to allGoobergunch is a name known to allGoobergunch is a name known to all
Re: Tank Drive

In the version of the default code that we use (not sure which one it is), the above code is included under Default PWM Mappings.
  #4   Spotlight this post!  
Unread 14-02-2005, 22:04
Idaman323 Idaman323 is offline
In Theory, Our Robot Would Own.
FRC #1706
Team Role: Driver
 
Join Date: Feb 2005
Rookie Year: 2005
Location: Wentzville, MO
Posts: 116
Idaman323 is an unknown quantity at this point
Re: Tank Drive

I got the default code off of innovation first's documentation part on their website.


Where is the User_Driver function within the code?

Last edited by Idaman323 : 14-02-2005 at 22:08.
  #5   Spotlight this post!  
Unread 14-02-2005, 22:30
AIBob's Avatar
AIBob AIBob is offline
AI Programmer
AKA: Bob Frank DOT org
FRC #0358 (Hauppauge Robotic Eagles)
Team Role: Alumni
 
Join Date: Jan 2005
Rookie Year: 2003
Location: Long Island, NY (in Binghamton now)
Posts: 297
AIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to behold
Send a message via ICQ to AIBob Send a message via AIM to AIBob Send a message via MSN to AIBob Send a message via Yahoo to AIBob
Re: Tank Drive

Quote:
Originally Posted by Idaman323
Where is the User_Driver function within the code?
It is located within "user_routines.c".
__________________
- from B B frank

  #6   Spotlight this post!  
Unread 14-02-2005, 22:41
Idaman323 Idaman323 is offline
In Theory, Our Robot Would Own.
FRC #1706
Team Role: Driver
 
Join Date: Feb 2005
Rookie Year: 2005
Location: Wentzville, MO
Posts: 116
Idaman323 is an unknown quantity at this point
Re: Tank Drive

AHHH I cant find it anywhere in the thing

there isnt any function it...
  #7   Spotlight this post!  
Unread 14-02-2005, 22:46
Orborde Orborde is offline
Registered User
FRC #1747
Team Role: Mentor
 
Join Date: Apr 2004
Rookie Year: 2003
Location: Indianapolis, IN
Posts: 44
Orborde has a spectacular aura aboutOrborde has a spectacular aura about
Send a message via AIM to Orborde
Re: Tank Drive

Er...it's in Default_Routine, not User_Driver
  #8   Spotlight this post!  
Unread 14-02-2005, 22:48
AIBob's Avatar
AIBob AIBob is offline
AI Programmer
AKA: Bob Frank DOT org
FRC #0358 (Hauppauge Robotic Eagles)
Team Role: Alumni
 
Join Date: Jan 2005
Rookie Year: 2003
Location: Long Island, NY (in Binghamton now)
Posts: 297
AIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to behold
Send a message via ICQ to AIBob Send a message via AIM to AIBob Send a message via MSN to AIBob Send a message via Yahoo to AIBob
Re: Tank Drive

OK... my team renamed that too, I just do not remember what we changed from the default code from last year, sorry.
It should be 'Default_Routine()'
__________________
- from B B frank

  #9   Spotlight this post!  
Unread 14-02-2005, 22:55
russell's Avatar
russell russell is offline
Registered User
#1430 (WRONG)
Team Role: Electrical
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Anchorage AK
Posts: 402
russell is a name known to allrussell is a name known to allrussell is a name known to allrussell is a name known to allrussell is a name known to allrussell is a name known to all
Re: Tank Drive

It is part of a long list which maps the joystick inputs to pwm outputs. Its about ten lines long, they all look about the same (number=number, and its about half or 3/4 the way down user_routines.c
  #10   Spotlight this post!  
Unread 14-02-2005, 23:05
Idaman323 Idaman323 is offline
In Theory, Our Robot Would Own.
FRC #1706
Team Role: Driver
 
Join Date: Feb 2005
Rookie Year: 2005
Location: Wentzville, MO
Posts: 116
Idaman323 is an unknown quantity at this point
Re: Tank Drive

So as long as I hav ethat included it should work?
  #11   Spotlight this post!  
Unread 14-02-2005, 23:14
probizzle's Avatar
probizzle probizzle is offline
Registered User
AKA: Prabhas Pokharel
#0639 (Code Red)
Team Role: Programmer
 
Join Date: Dec 2004
Rookie Year: 2003
Location: Ithaca
Posts: 78
probizzle will become famous soon enoughprobizzle will become famous soon enough
Send a message via AIM to probizzle
Re: Tank Drive

Quote:
Originally Posted by Idaman323
So as long as I hav ethat included it should work?
Depends.

On our bot last year, the motors were placed such that we had to reverse motor output to one side.

So,
Code:
pwm01 = p1_y; //put the joystick input to motor output directly
pwm02 = 255-p2_y; //reverse this motor
worked. You might need this depending on how your gearboxes/motors are put in. I'm guessing you'll have to reverse one (try which one) of the motors.

And this is, of course, assuming you are using one motor for left drive and one motor for right drive (no more no less).
__________________
Code Red Team 639 Winners of the 2005 FingerLakes Regional with 191 and 494.
--
http://pset.deu83.com << my baby
http://www.setgame.com/set/ << it's mother
  #12   Spotlight this post!  
Unread 14-02-2005, 23:17
Goobergunch Goobergunch is offline
Registered User
FRC #1168 (Malvern Robotics)
Team Role: Alumni
 
Join Date: Mar 2004
Rookie Year: 2004
Location: Paoli, PA
Posts: 246
Goobergunch is a name known to allGoobergunch is a name known to allGoobergunch is a name known to allGoobergunch is a name known to allGoobergunch is a name known to allGoobergunch is a name known to all
Re: Tank Drive

Quote:
Originally Posted by probizzle
And this is, of course, assuming you are using one motor for left drive and one motor for right drive (no more no less).
Or if you have two motors for each drive (four total) and the two motors on each side are connected via the yellow-red-black PWM cables to one PWM Output on the RC, like we did this year.
  #13   Spotlight this post!  
Unread 15-02-2005, 06:20
Idaman323 Idaman323 is offline
In Theory, Our Robot Would Own.
FRC #1706
Team Role: Driver
 
Join Date: Feb 2005
Rookie Year: 2005
Location: Wentzville, MO
Posts: 116
Idaman323 is an unknown quantity at this point
Re: Tank Drive

Should I comment/delete (not sure what would be better) out the stuff i don't need, like p1_x and p2_x, or does that need to be there for the bot to run?


And Ive only had a little of coding experience but wouldn't making the one motor go backwards be pwm02 = p2_y-255; not pwm02 = 255-p2_y; or did he have it right before?

And one more thing, in Deafault_Routine, there is a section titled, 1 Joystick Drive, and it combines the x, y on one joystick port.. Should i take this out?

Last edited by Idaman323 : 15-02-2005 at 07:11.
  #14   Spotlight this post!  
Unread 15-02-2005, 07:27
AIBob's Avatar
AIBob AIBob is offline
AI Programmer
AKA: Bob Frank DOT org
FRC #0358 (Hauppauge Robotic Eagles)
Team Role: Alumni
 
Join Date: Jan 2005
Rookie Year: 2003
Location: Long Island, NY (in Binghamton now)
Posts: 297
AIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to beholdAIBob is a splendid one to behold
Send a message via ICQ to AIBob Send a message via AIM to AIBob Send a message via MSN to AIBob Send a message via Yahoo to AIBob
Re: Tank Drive

Quote:
Originally Posted by Idaman323

Should I comment/delete (not sure what would be better) out the stuff i don't need, like p1_x and p2_x, or does that need to be there for the bot to run?


And Ive only had a little of coding experience but wouldn't making the one motor go backwards be pwm02 = p2_y-255; not pwm02 = 255-p2_y; or did he have it right before?

And one more thing, in Deafault_Routine, there is a section titled, 1 Joystick Drive, and it combines the x, y on one joystick port.. Should i take this out?
No.... you should leave them, as long as you do not send them to the pwms
No.... if you put in 0, it would leave you with -255, which is not an unsigned char and will give you an error.
Maybe.... You should comment this section out for later use
__________________
- from B B frank

  #15   Spotlight this post!  
Unread 15-02-2005, 09:01
Idaman323 Idaman323 is offline
In Theory, Our Robot Would Own.
FRC #1706
Team Role: Driver
 
Join Date: Feb 2005
Rookie Year: 2005
Location: Wentzville, MO
Posts: 116
Idaman323 is an unknown quantity at this point
Re: Tank Drive

Okay I think I got it. Thanks for all of your help.
Closed Thread


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Drive Straight C Code using Encoders without PID? Chris_Elston Programming 17 15-02-2005 23:41
Major problems with tank tread drive Lord Nerdlinger Technical Discussion 13 23-02-2004 21:15
Swerve/crab drive and tank turning activemx Technical Discussion 9 23-02-2004 18:26
tank drive Stormhammer Programming 11 29-01-2004 23:08
"Motors and Drive train edition" of Fresh From the Forum Ken Leung CD Forum Support 6 29-01-2002 12:32


All times are GMT -5. The time now is 21:28.

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