Go to Post "PWMed" - Sam N. [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 Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 14-03-2013, 15:03
Mr.Roboto3335's Avatar
Mr.Roboto3335 Mr.Roboto3335 is offline
Wait, What?
AKA: Jimmy
FRC #3335 (Cy-Borgs)
Team Role: Programmer
 
Join Date: Nov 2011
Rookie Year: 2011
Location: Texas
Posts: 47
Mr.Roboto3335 is an unknown quantity at this point
Controlling motor speed with joystick scroll

I just wanted to know how to program the motors to where the speed changes depending on the value of the scroll on the Logitech Attack 3 Joystick.
__________________
Wait, what?
Reply With Quote
  #2   Spotlight this post!  
Unread 14-03-2013, 15:09
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,102
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: Controlling motor speed with joystick scroll

Quote:
Originally Posted by Mr.Roboto3335 View Post
I just wanted to know how to program the motors to where the speed changes depending on the value of the scroll on the Logitech Attack 3 Joystick.
Are you talking about drivetrain motors or something else?


Reply With Quote
  #3   Spotlight this post!  
Unread 14-03-2013, 16:04
engunneer's Avatar
engunneer engunneer is offline
Alumni turned Mentor
AKA: Branden Gunn
FRC #4761
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 1996
Location: Reading, MA
Posts: 869
engunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond repute
Re: Controlling motor speed with joystick scroll

- read the value of that axis (Axis 3 I think)
- convert it to a number between 0 and 1 (y=mx+b, yay algebra)
- Multiply your other joystick inputs by this number (or your motor outputs)

It may not be useful to have the bottom of the throttle act as 0. Maybe make it 20% (0.2 to 1 is now the output of y=mx+b)

let's look at how this works. At full throttle, and max joystick input, the motor will get (joystick * throttle) = (1 * 1) = 1
If you bring the throttle back to 50% (0.5), then the motor gets (1 * 0.5) = 0.5, which is half speed.
__________________
Student FRC23 (1996-1999), Mentor FRC246 (2000), Mentor FRC1318 (2007-2009), Mentor FRC93 (2011), Mentor FRC2151 (2012), Mentor FRC23 (2013), Mentor FRC4761 (2014-2017)
1998 - National Chairman's Award and Woodie Flowers Award (FRC23, Mike Bastoni ) | 2007 - PNW SF (488, 1595) | 2008 - Oregon RCA - Seattle #2 Seed, SF (488, 1696) | 2009 - Oregon #1 Seed, Winners (1983, 2635) - Seattle SF (945, 2865) - Galileo #2 Seed, SF (973, 25) | 2012 Midwest F (111, 71) | 2014 RIDE Winners (78, 125), Inspector - NEU #24, QF (3479, 3958) - NECMP #35 | 2015 Reading #11, SF (1058, 190), Inspector - RIDE #17, QF(4055, 5494), Inspector - NECMP #57 | 2016 Reading #4, SF (133, 4474), DCA, Inspector - Ride #22, SF (1735, 2067), Creativity, Inspector - NECMP #48, RCA - Archimedes
Reply With Quote
  #4   Spotlight this post!  
Unread 14-03-2013, 17:01
Mr.Roboto3335's Avatar
Mr.Roboto3335 Mr.Roboto3335 is offline
Wait, What?
AKA: Jimmy
FRC #3335 (Cy-Borgs)
Team Role: Programmer
 
Join Date: Nov 2011
Rookie Year: 2011
Location: Texas
Posts: 47
Mr.Roboto3335 is an unknown quantity at this point
Re: Controlling motor speed with joystick scroll

Quote:
Originally Posted by Ether View Post
Are you talking about drivetrain motors or something else?


2 Shooter motors.
__________________
Wait, what?
Reply With Quote
  #5   Spotlight this post!  
Unread 14-03-2013, 18:15
z_beeblebrox's Avatar
z_beeblebrox z_beeblebrox is offline
Custom User Title
AKA: Cal
FRC #4183 (Bit Buckets)
Team Role: Alumni
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Cambridge MA
Posts: 811
z_beeblebrox has a reputation beyond reputez_beeblebrox has a reputation beyond reputez_beeblebrox has a reputation beyond reputez_beeblebrox has a reputation beyond reputez_beeblebrox has a reputation beyond reputez_beeblebrox has a reputation beyond reputez_beeblebrox has a reputation beyond reputez_beeblebrox has a reputation beyond reputez_beeblebrox has a reputation beyond reputez_beeblebrox has a reputation beyond reputez_beeblebrox has a reputation beyond repute
Re: Controlling motor speed with joystick scroll

I reccomend against doing something like that. 4183 tried it for our first regional last year and learned that it was nearly impossible to get fine control of our shooter speed due to the slop in the throttle. Before our second competition, we programmed the joysticks to control rate of change in speed rather than speed.

It's pretty simple code to write:
Code:
If speed-up button is pressed, shooter speed = shooter speed + constant

If speed-down button is pressed, shooter speed = shooter speed - constant
Other buttons can be used to stop the shooter or run it at preset speeds.

However, if your shooter works consistently at a range of speeds, the throttle might work fine.
__________________
2012 Utah Regional Rookie All-Star
2013 Phoenix Regional Judge's Award for "design process and prototyping"
2014 Hub City Regional Quality Award, Arizona Regional Excellence in Engineering Award
2015 Arizona East Regional Creativity Award, Winner
2016 Arizona North Regional Finalist, Arizona West Excellence in Engineering Award, Finalist
Reply With Quote
  #6   Spotlight this post!  
Unread 14-03-2013, 19:28
AlexBrinister AlexBrinister is offline
Registered User
AKA: Alex Brinister
FRC #1768 (RoboChiefs)
Team Role: Alumni
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Bolton, MA
Posts: 93
AlexBrinister will become famous soon enough
Re: Controlling motor speed with joystick scroll

If you really want to do that, you don't need to do algebra because WPI does it for us already. All the axes read from 1 to -1. So you should be able to just give the motors the axis and they should behave accordingly.

Alex Brinister
Reply With Quote
  #7   Spotlight this post!  
Unread 14-03-2013, 20:19
z_beeblebrox's Avatar
z_beeblebrox z_beeblebrox is offline
Custom User Title
AKA: Cal
FRC #4183 (Bit Buckets)
Team Role: Alumni
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Cambridge MA
Posts: 811
z_beeblebrox has a reputation beyond reputez_beeblebrox has a reputation beyond reputez_beeblebrox has a reputation beyond reputez_beeblebrox has a reputation beyond reputez_beeblebrox has a reputation beyond reputez_beeblebrox has a reputation beyond reputez_beeblebrox has a reputation beyond reputez_beeblebrox has a reputation beyond reputez_beeblebrox has a reputation beyond reputez_beeblebrox has a reputation beyond reputez_beeblebrox has a reputation beyond repute
Re: Controlling motor speed with joystick scroll

Quote:
Originally Posted by AlexBrinister View Post
If you really want to do that, you don't need to do algebra because WPI does it for us already. All the axes read from 1 to -1. So you should be able to just give the motors the axis and they should behave accordingly.

Alex Brinister
You don't want to run your shooter in reverse and you want to be able to get maximum resolution by using the throttle's full range of travel.
__________________
2012 Utah Regional Rookie All-Star
2013 Phoenix Regional Judge's Award for "design process and prototyping"
2014 Hub City Regional Quality Award, Arizona Regional Excellence in Engineering Award
2015 Arizona East Regional Creativity Award, Winner
2016 Arizona North Regional Finalist, Arizona West Excellence in Engineering Award, Finalist
Reply With Quote
  #8   Spotlight this post!  
Unread 14-03-2013, 21:30
AlexBrinister AlexBrinister is offline
Registered User
AKA: Alex Brinister
FRC #1768 (RoboChiefs)
Team Role: Alumni
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Bolton, MA
Posts: 93
AlexBrinister will become famous soon enough
Re: Controlling motor speed with joystick scroll

Touché .

Alex Brinister
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 12:47.

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