Go to Post The discussion and helpfulness that goes on within this website is a great example of gracious professionalism. - andy.vangessel [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 30-09-2003, 22:27
wayne 05 wayne 05 is offline
Registered User
#0515
 
Join Date: Sep 2003
Location: gm tech center
Posts: 17
wayne 05 is an unknown quantity at this point
switch speed control

How can i program a joystick trigger to scale down the speed of a motor

Last edited by wayne 05 : 01-10-2003 at 07:42.
  #2   Spotlight this post!  
Unread 30-09-2003, 22:28
djcapelis's Avatar
djcapelis djcapelis is offline
Fried Manic Custard
None #0675 (Geeks with Power Tools)
Team Role: Programmer
 
Join Date: May 2003
Rookie Year: 2001
Location: Rohnert Park, CA
Posts: 129
djcapelis will become famous soon enoughdjcapelis will become famous soon enough
Send a message via ICQ to djcapelis Send a message via AIM to djcapelis Send a message via Yahoo to djcapelis
That would be difficult, it's either on or off... so you could turn the motor on or off...

unless you want to try funky pattern timing...
__________________
"I have more friends than enemies, I'm working to resolve the issue."
  #3   Spotlight this post!  
Unread 30-09-2003, 22:30
Cory's Avatar
Cory Cory is offline
Registered User
AKA: Cory McBride
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: May 2002
Rookie Year: 2001
Location: Redwood City, CA
Posts: 6,825
Cory has a reputation beyond reputeCory has a reputation beyond reputeCory has a reputation beyond reputeCory has a reputation beyond reputeCory has a reputation beyond reputeCory has a reputation beyond reputeCory has a reputation beyond reputeCory has a reputation beyond reputeCory has a reputation beyond reputeCory has a reputation beyond reputeCory has a reputation beyond repute
Send a message via AIM to Cory
perhaps he meant scale the speed.

Ex: if you have a really fast robot, maybe you want to scale the speed down to 3/4 of full speed for more control. I think he is talking about using the trigger to do something like this. I know we did this for some odd reason at Cal Games, but I dont know jack about programming, so I cant help you.

Cory
__________________
2001-2004: Team 100
2006-Present: Team 254
  #4   Spotlight this post!  
Unread 30-09-2003, 22:51
EricS-Team180's Avatar
EricS-Team180 EricS-Team180 is offline
SPAM, the lunchmeat of superheroes!
AKA: Eric Schreffler
FRC #0180 (SPAM)
Team Role: Engineer
 
Join Date: Apr 2002
Rookie Year: 2001
Location: Stuart, Florida
Posts: 561
EricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond repute
You could key off of the trigger to indicate the addition or subtraction of a fixed value (1,5,10) to a pwm output.

Initialize to a pwm output of neutral (127). Then, you'll need a direction bit (fwd/rev) so you know whether to add or subtract, and a trigger latch bit so you don't loop through the code a bunch of times, changing the pwm, before you let go of the trigger. You'll also want to min and max (1, 254) so you don't roll over.
__________________

Don't PANIC!
S. P. A. M.
  #5   Spotlight this post!  
Unread 30-09-2003, 23:37
djcapelis's Avatar
djcapelis djcapelis is offline
Fried Manic Custard
None #0675 (Geeks with Power Tools)
Team Role: Programmer
 
Join Date: May 2003
Rookie Year: 2001
Location: Rohnert Park, CA
Posts: 129
djcapelis will become famous soon enoughdjcapelis will become famous soon enough
Send a message via ICQ to djcapelis Send a message via AIM to djcapelis Send a message via Yahoo to djcapelis
Or set a static entry if you just want to tone it down to 3/4 or total or whatnot... Then just hit trigger and get 3/4 speed ahead, interesting actually... hmmm.
__________________
"I have more friends than enemies, I'm working to resolve the issue."
  #6   Spotlight this post!  
Unread 01-10-2003, 00:53
Jnadke Jnadke is offline
Go Badgers!
#0093
Team Role: Alumni
 
Join Date: Jan 2002
Location: Appleton, WI
Posts: 775
Jnadke is on a distinguished road
Send a message via ICQ to Jnadke Send a message via AIM to Jnadke Send a message via Yahoo to Jnadke
Yeah, you could have it that every x amount of loops it adds 5 to the PWM input. About 30-40 program loops is a second.

Just use PWM = PWM + 5 MAX 250 so you don't wrap around.

The other option is to have it turn on or off. This is more limited, but easier to deal with.
__________________
The best moments of our lives fall in two categories: those that did happen and those that did not.
  #7   Spotlight this post!  
Unread 01-10-2003, 09:35
Neal Turett Neal Turett is offline
Registered User
#0201
 
Join Date: Nov 2002
Location: Rochester Hills
Posts: 34
Neal Turett is on a distinguished road
I'm interperting your request as if you have a joystick, and you want to be able to press a button on it to slow down the robot, in order to make it more controllable.

If this is what you're looking for insert this write after the code block where you tie the p1_y and p1_x (or whatever vars you use) to the pwms:

if (p1_top = 1) then
if pwm1 > 127 then pwm1 = (pwm1-127) / 2 + 127
if pwm1 < 127 then pwm1 = (127 - (127-pwm1) / 2)
endif

Do the same for pwm2. This will reduce the speed of the robot by a factor of 2 when p1_top is pressed.
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
Power, speed, and torque... AGH Gui Cavalcanti Technical Discussion 5 10-11-2002 19:02
more control options smokescreen Technical Discussion 17 05-03-2002 15:41
Need help with 255 Variable Joseph F Programming 18 26-02-2002 14:49
Prgm4 2 joystics control 1 speed cntrl??? punarhero Programming 7 21-02-2002 09:57
speed control punarhero Technical Discussion 11 24-01-2002 18:03


All times are GMT -5. The time now is 02: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