Go to Post What language does your programming mentor have the most experience with? That's the language you should use. - Rosiebotboss [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 15-02-2002, 19:12
punarhero's Avatar
punarhero punarhero is offline
Registered User
#0696 (Clark Magnet Robotics)
Team Role: Programmer
 
Join Date: Jan 2002
Location: la crescenta
Posts: 67
punarhero is an unknown quantity at this point
Send a message via AIM to punarhero Send a message via Yahoo to punarhero
Question Prgm4 2 joystics control 1 speed cntrl???

Can someone tell me how to program 2 of the joystick ports to operate 1 pwm output????
  #2   Spotlight this post!  
Unread 15-02-2002, 22:37
Ameya's Avatar
Ameya Ameya is offline
Freelance Goon
FRC #0293 (SPIKE Robotics)
Team Role: Alumni
 
Join Date: May 2001
Rookie Year: 2000
Location: Pennington, NJ
Posts: 67
Ameya is on a distinguished road
Send a message via ICQ to Ameya Send a message via AIM to Ameya
Why would you want to have two joysticks control the same PWM output? Seems redundantly redundant to me.
__________________
Ameya Agaskar
Team 293 alumnus
  #3   Spotlight this post!  
Unread 15-02-2002, 23:08
Ian W. Ian W. is offline
College? What?
no team (Gompei and the Herd)
Team Role: College Student
 
Join Date: Jan 2002
Rookie Year: 2002
Location: Worcester, MA | Smithtown, NY
Posts: 1,464
Ian W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to all
Send a message via AIM to Ian W.
Do you mean two pwm's on one joystick, because i don't think it's even possible to control one pwm with two joysticks. I mean, you could, but it would be rather pointless.

To control two pwm's with one joystick is easy:

serout [255,255,pwm1,relay1,pwm2,relay2,pwm3,pwm4...pwm16]

just replace which ever pwm with the variable of the joystick...

serout [255,255,p1_y,relay1,p1_y, relay2,pwm3,pwm4...pwm16]

if this makes no sense, sorry, but i'm typing this on like, no sleep, and well, it makes sense to me.
  #4   Spotlight this post!  
Unread 16-02-2002, 12:44
punarhero's Avatar
punarhero punarhero is offline
Registered User
#0696 (Clark Magnet Robotics)
Team Role: Programmer
 
Join Date: Jan 2002
Location: la crescenta
Posts: 67
punarhero is an unknown quantity at this point
Send a message via AIM to punarhero Send a message via Yahoo to punarhero
Cool

Thanks for replying. What I want is for forward on two joystics to work the same PWM output. Call me crazy but there's a long story of why I need it.
  #5   Spotlight this post!  
Unread 16-02-2002, 18:24
Joseph F Joseph F is offline
Registered User
#0506 (Steel Friars)
 
Join Date: Jan 2002
Location: New York
Posts: 59
Joseph F is an unknown quantity at this point
Send a message via AIM to Joseph F
this is just off the top of my head... but i think it may go something like this...

If p1_y > p2_y then use1
pwm1 = p2_y
goto end

use1
pwm1=p1_y
end:


basically it takes whichever joystick is greater and uses that as the output to pwm1

you would have to edit the serout command so that it would read

[255,255,pwm1,relayA,p2_y,relayB,p3_y,p4_y,p1_x,p2_ x,p3_x,p4_x,p1_wheel,p2_wheel,p3_wheel,p4_wheel,12 7,127,127,127]

just remember if you did this you couldnt use pwm2 because p2_y would still control it as well as pwm1 if you went forward.
__________________
One Team, One Bot, One Fleet of Ambulances!
  #6   Spotlight this post!  
Unread 19-02-2002, 18:03
Ameya's Avatar
Ameya Ameya is offline
Freelance Goon
FRC #0293 (SPIKE Robotics)
Team Role: Alumni
 
Join Date: May 2001
Rookie Year: 2000
Location: Pennington, NJ
Posts: 67
Ameya is on a distinguished road
Send a message via ICQ to Ameya Send a message via AIM to Ameya
problem with previous response:

Quote:
Originally posted by Joseph F


basically it takes whichever joystick is greater and uses that as the output to pwm1
The problem with that solution is that you won't be able to go in reverse (since joystick centered is 127 and joystick reverse is less than 127).
__________________
Ameya Agaskar
Team 293 alumnus
  #7   Spotlight this post!  
Unread 19-02-2002, 19:42
Joseph F Joseph F is offline
Registered User
#0506 (Steel Friars)
 
Join Date: Jan 2002
Location: New York
Posts: 59
Joseph F is an unknown quantity at this point
Send a message via AIM to Joseph F
then edit it to read:


If p1_y | p2_y < 115 then rev
if p1_y | p2_y > 135 then fwd
pwm1 = 127
goto end
fwd:
If p1_y > p2_y then use1
pwm1 = p2_y
goto end

use1
pwm1=p1_y
goto end

rev:
if p1_y < p2_y then use2
pwm1 = p2_y
goto end

use2:
pwm1 = p1_y
end:
__________________
One Team, One Bot, One Fleet of Ambulances!
  #8   Spotlight this post!  
Unread 21-02-2002, 09:57
ttedrow's Avatar
ttedrow ttedrow is offline
Herding electrons
AKA: Tim Tedrow
FRC #0281 (EnTech)
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2000
Location: Greenville, SC
Posts: 165
ttedrow will become famous soon enoughttedrow will become famous soon enough
Try this

pwm1 = (p1_y + p2_y) / 2
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
switch speed control wayne 05 Programming 6 01-10-2003 09:35
speed control punarhero Technical Discussion 11 24-01-2002 18:03


All times are GMT -5. The time now is 12:59.

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