Go to Post We do not pursue awards, we pursue greatness and the awards follow. - Sunshine [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 08-02-2006, 09:31
scottmso scottmso is offline
Registered User
FRC #1561 (RoboDucks)
Team Role: Programmer
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Oklahoma City, OK
Posts: 26
scottmso is an unknown quantity at this point
Send a message via AIM to scottmso
Where is tank drive in 2005 code?

I am still trying to understand the 2005 default code (my programming team is currently using the 2005 robot because they are currently working on the new one.) What I want to do right now is try to modify the tank drive so it is less sensitive. I can find where the 1-joystick drive is but I cannot find where the 2-joystick (tank drive) is. Is there a particular place that it is in in the code? thanks

Last edited by scottmso : 08-02-2006 at 09:38.
  #2   Spotlight this post!  
Unread 08-02-2006, 09:38
ForgottenSalad's Avatar
ForgottenSalad ForgottenSalad is offline
In search of a home...
AKA: Michael Wessler
no team
 
Join Date: Feb 2005
Rookie Year: 2005
Location: Bethlehem, NH
Posts: 136
ForgottenSalad will become famous soon enoughForgottenSalad will become famous soon enough
Send a message via AIM to ForgottenSalad
Re: Where is tank drive in 2005 code?

EDIT: Just noticed your edit - They're located in user_routines.c in the default routine.

They should look something like this.

pwm01 = p1_y;
pwm02 = p2_y;
pwm03 = p3_y;
pwm04 = p4_y;
etc....

Last edited by ForgottenSalad : 08-02-2006 at 09:43.
  #3   Spotlight this post!  
Unread 08-02-2006, 09:51
scottmso scottmso is offline
Registered User
FRC #1561 (RoboDucks)
Team Role: Programmer
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Oklahoma City, OK
Posts: 26
scottmso is an unknown quantity at this point
Send a message via AIM to scottmso
Re: Where is tank drive in 2005 code?

Quote:
Originally Posted by ForgottenSalad
EDIT: Just noticed your edit - They're located in user_routines.c in the default routine.

They should look something like this.

pwm01 = p1_y;
pwm02 = p2_y;
pwm03 = p3_y;
pwm04 = p4_y;
etc....
Now I understand, thanks.
  #4   Spotlight this post!  
Unread 08-02-2006, 10:09
Unholy Unholy is offline
electrical / makeshift programmer
AKA: Daniel
FRC #1402
Team Role: Programmer
 
Join Date: Feb 2006
Rookie Year: 2002
Location: Orlando, FL
Posts: 21
Unholy is an unknown quantity at this point
Send a message via AIM to Unholy
Re: Where is tank drive in 2005 code?

also, if you want to limit response to the joystick, you can multiply the joystick value by a decimal value less than 1. For example, one of the robot components in our robot requires small movements, but we found it complicated to just move it slightly, so we multiplied the joystick input by .20, so even when the joystick is fully deflected it will move slowly.
-Unholy
  #5   Spotlight this post!  
Unread 08-02-2006, 14:16
Matt Krass's Avatar
Matt Krass Matt Krass is offline
"Old" and Cranky. Get off my lawn!
AKA: Dark Ages
FRC #0263 (Sachem Aftershock)
Team Role: Mentor
 
Join Date: Oct 2002
Rookie Year: 2002
Location: Long Island, NY
Posts: 1,187
Matt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond repute
Send a message via AIM to Matt Krass
Re: Where is tank drive in 2005 code?

Be careful, it's very easy to accidentally make it multiply by 0, the PIC has no dedicated floating point processor and does weird things to decimals. It would make your motors constantly run full reverse. Which is also bad

I recommend multiplying up then dividing down. For example instead of

Code:
pwm01 = p1_y * 0.2; //Error Prone! BAD!
Use this

Code:
pwm01 = (unsigned int)(p1_y * 2) / 10;
Try them both on your calculator, you'll get the same result, but the PIC is more likely to work with the second method...practically guaranteed to work better than the first.

Good luck!
__________________
Matt Krass
If I suggest something to try and fix a problem, and you don't understand what I mean, please PM me!

I'm a FIRST relic of sorts, I remember when we used PBASIC and we got CH Flightsticks in the KoP. In my day we didn't have motorized carts, we pushed our robots uphill, both ways! (Houston 2003!)
  #6   Spotlight this post!  
Unread 08-02-2006, 20:56
ForgottenSalad's Avatar
ForgottenSalad ForgottenSalad is offline
In search of a home...
AKA: Michael Wessler
no team
 
Join Date: Feb 2005
Rookie Year: 2005
Location: Bethlehem, NH
Posts: 136
ForgottenSalad will become famous soon enoughForgottenSalad will become famous soon enough
Send a message via AIM to ForgottenSalad
Re: Where is tank drive in 2005 code?

Quote:
Originally Posted by Matt Krass
Be careful, it's very easy to accidentally make it multiply by 0, the PIC has no dedicated floating point processor and does weird things to decimals.
We found that out yesterday. If we went forward on the joystick, no matter how little, it'd run full forward... If we went backwards, we'd get gradually faster as you pulled back, but then at 3/4ths of the way it'd reverse and go full forward...
  #7   Spotlight this post!  
Unread 08-02-2006, 21:16
Stephen Kowski's Avatar
Stephen Kowski Stephen Kowski is offline
BSEE, MSEE, JD
AKA: employed
no team
Team Role: Alumni
 
Join Date: Jun 2001
Rookie Year: 2000
Location: Saint Petersburg, FL
Posts: 1,144
Stephen Kowski has a reputation beyond reputeStephen Kowski has a reputation beyond reputeStephen Kowski has a reputation beyond reputeStephen Kowski has a reputation beyond reputeStephen Kowski has a reputation beyond reputeStephen Kowski has a reputation beyond reputeStephen Kowski has a reputation beyond reputeStephen Kowski has a reputation beyond reputeStephen Kowski has a reputation beyond reputeStephen Kowski has a reputation beyond reputeStephen Kowski has a reputation beyond repute
Send a message via AIM to Stephen Kowski
Re: Where is tank drive in 2005 code?

Quote:
Originally Posted by ForgottenSalad
We found that out yesterday. If we went forward on the joystick, no matter how little, it'd run full forward... If we went backwards, we'd get gradually faster as you pulled back, but then at 3/4ths of the way it'd reverse and go full forward...
never heard of 3/4 of the way there, but when you max out the speed controllers sometimes it goes to 255 there is a problem with, i think, the speed controller that it can differentiate well between 255 and 0 so it goes forward or doesn't act properly....wierd thing, but that is the first place id look and just set the max PWM value possible to 254.

Last edited by Stephen Kowski : 08-02-2006 at 21:19.
  #8   Spotlight this post!  
Unread 08-02-2006, 22:03
DanDon's Avatar
DanDon DanDon is offline
ohhh MY god
AKA: Dan Hoizner
FRC #0375 (The Robotic Plague)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Staten Island, NY
Posts: 1,432
DanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond reputeDanDon has a reputation beyond repute
Send a message via ICQ to DanDon Send a message via AIM to DanDon Send a message via MSN to DanDon
Re: Where is tank drive in 2005 code?

Quote:
Originally Posted by ForgottenSalad
We found that out yesterday. If we went forward on the joystick, no matter how little, it'd run full forward... If we went backwards, we'd get gradually faster as you pulled back, but then at 3/4ths of the way it'd reverse and go full forward...
In order to stop the full forward when moving the joystick forward just a bit, you can try putting a deadband into the drive code.

You can try something like this:

Code:
 if(p1_y>117 && p1_y<137) //+-10 unit deadband around 127 neutral
	   pwm01=127;
else
	   pwm01=p1_y;
then just experiment with the deadband size to see which range feels best for you driver(s).

Hope this helps,
__________________
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
looking for 1 joystick Pbasic drive code Greg Needel Programming 8 02-09-2005 20:35
pic: Team 836 2005 Drive Plate Bcahn836 Robot Showcase 11 09-02-2005 10:13
2005 default code won't compile Robby Programming 22 04-02-2005 18:21
Sourceforge for Code Repository and other stuff SilverStar Programming 9 15-01-2005 21:16
Recovering code from the RC Orborde Programming 15 04-12-2004 20:02


All times are GMT -5. The time now is 01:36.

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