Go to Post Being involved with FIRST is a privilege, not a right. - Katie Reynolds [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 04-02-2014, 15:39
jtrv's Avatar
jtrv jtrv is offline
github.com/jhtervay
AKA: Justin
FRC #2791 (Shaker Robotics)
Team Role: College Student
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Latham, NY
Posts: 147
jtrv is a name known to alljtrv is a name known to alljtrv is a name known to alljtrv is a name known to alljtrv is a name known to alljtrv is a name known to all
Equation for joystick input to Talons

hello all, we currently have decided to look into tweaking the operator controls of driving the robot. we currently have the joystick to Talon equation as a linear equation: y=x. What the joysticks get is sent to the talons. Each get values between -1 and 1. I'm sure you know this. y is what the Talons receive and x is the joystick input. What we're looking for is an equation that starts out slow, but once you get x to be around .4 to .6, y should be roughly equal to the x value. Past that, the y value should rapidly increase until you reach where x is around .75 or .8, where it should become very close to 1.

Example point table:

x,y

0,0
.1,.005
.5,.5
.6,.8
1,1

I know it may not be much, but I am also wondering what you may have used. this isn't really an issue with sensitivity, we are just looking to drive a little more slowly when the joysticks are lightly touched, but once they get past .6 or .7, drive very closely to full power if not full.

I understand we can do this with simple if statements, but an equation would make it... "flow"... much better.

Thank you for your help
  #2   Spotlight this post!  
Unread 04-02-2014, 15:46
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,077
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: Equation for joystick input to Talons


Something like this?

Here's how to do it.


  #3   Spotlight this post!  
Unread 04-02-2014, 15:46
apalrd's Avatar
apalrd apalrd is offline
More Torque!
AKA: Andrew Palardy (Most people call me Palardy)
VRC #3333
Team Role: College Student
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Auburn Hills, MI
Posts: 1,347
apalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond repute
Re: Equation for joystick input to Talons

You could use an interpolation table.

Basically, you make a table like you already made, and the software linearly interpolates between the points. Super easy to write, calibrate, etc.

I wrote a LV VI to do this (it's in the BuzzLib download here). I can try to dig up my C version if anyone wants it.
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor

"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack
  #4   Spotlight this post!  
Unread 04-02-2014, 15:49
jtrv's Avatar
jtrv jtrv is offline
github.com/jhtervay
AKA: Justin
FRC #2791 (Shaker Robotics)
Team Role: College Student
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Latham, NY
Posts: 147
jtrv is a name known to alljtrv is a name known to alljtrv is a name known to alljtrv is a name known to alljtrv is a name known to alljtrv is a name known to all
Re: Equation for joystick input to Talons

Here is an sketch I drew up, I'm not entirely convinced that if I found it's equation we would use it, but it was my first idea.

http://i.imgur.com/57TuSZw.jpg (ignore the scribble )

@ the posted image:

yes, i have come across those equations in my searches. i would like something that changes concavity once it reaches roughly .5. nothing extremely fancy like my sketch, but something of the likes. my sketch doesn't reflect this paragraph, btw. i'm probably confusing you all. sorry about that.
  #5   Spotlight this post!  
Unread 04-02-2014, 15:53
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,077
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: Equation for joystick input to Talons

Quote:
Originally Posted by jtrv View Post
i would like something that changes concavity once it reaches roughly .5. nothing extremely fancy like my sketch, but something of the likes.
Post or PM me a set of (x,y) points defining your desired curve, and I will generate a function for you.

Or I can show you how to do it yourself.



Last edited by Ether : 04-02-2014 at 16:07. Reason: removed link
  #6   Spotlight this post!  
Unread 04-02-2014, 15:56
jtrv's Avatar
jtrv jtrv is offline
github.com/jhtervay
AKA: Justin
FRC #2791 (Shaker Robotics)
Team Role: College Student
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Latham, NY
Posts: 147
jtrv is a name known to alljtrv is a name known to alljtrv is a name known to alljtrv is a name known to alljtrv is a name known to alljtrv is a name known to all
Re: Equation for joystick input to Talons

Quote:
Originally Posted by Ether View Post
Post or PM me a set of (x,y) points defining your desired curve, and I will generate a function for you.

Or I can show you how to do it yourself.


I've know the basics of how to do it with f'(x) and f''(x), but the only problem I run across is changing the way the curve "bends" per se... If you could PM me how you do it that would be fantastic.
  #7   Spotlight this post!  
Unread 04-02-2014, 15:59
apalrd's Avatar
apalrd apalrd is offline
More Torque!
AKA: Andrew Palardy (Most people call me Palardy)
VRC #3333
Team Role: College Student
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Auburn Hills, MI
Posts: 1,347
apalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond repute
Re: Equation for joystick input to Talons

If you must have an equation, you could type your in->out pairs into Excel, graph them (x vs y), then add a trendline and use the equation.
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor

"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack
  #8   Spotlight this post!  
Unread 04-02-2014, 16:01
jtrv's Avatar
jtrv jtrv is offline
github.com/jhtervay
AKA: Justin
FRC #2791 (Shaker Robotics)
Team Role: College Student
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Latham, NY
Posts: 147
jtrv is a name known to alljtrv is a name known to alljtrv is a name known to alljtrv is a name known to alljtrv is a name known to alljtrv is a name known to all
Re: Equation for joystick input to Talons

Quote:
Originally Posted by apalrd View Post
If you must have an equation, you could type your in->out pairs into Excel, graph them (x vs y), then add a trendline and use the equation.
Will try that now, completely forgot about this. thank you.
  #9   Spotlight this post!  
Unread 04-02-2014, 16:02
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,077
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: Equation for joystick input to Talons

Quote:
Originally Posted by jtrv View Post
I've know the basics of how to do it with f'(x) and f''(x), but the only problem I run across is changing the way the curve "bends" per se... If you could PM me how you do it that would be fantastic.
apalrd beat me to it. see his post.



Last edited by Ether : 04-02-2014 at 16:06.
  #10   Spotlight this post!  
Unread 04-02-2014, 16:05
connor.worley's Avatar
connor.worley connor.worley is offline
Registered User
FRC #0973 (Greybots)
Team Role: Mentor
 
Join Date: Mar 2011
Rookie Year: 2010
Location: Berkeley/San Diego
Posts: 601
connor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond reputeconnor.worley has a reputation beyond repute
Re: Equation for joystick input to Talons

http://www.wolframalpha.com/input/?i...nd+%281%2C1%29

Wolfram Alpha can do some magic... try tweaking this around a bit
__________________
Team 973 (2016-???)
Team 5499 (2015-2016)
Team 254 (2014-2015)

Team 1538 (2011-2014)
2014 Driver (25W 17L 1T)
日本語でOK
  #11   Spotlight this post!  
Unread 04-02-2014, 16:13
jtrv's Avatar
jtrv jtrv is offline
github.com/jhtervay
AKA: Justin
FRC #2791 (Shaker Robotics)
Team Role: College Student
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Latham, NY
Posts: 147
jtrv is a name known to alljtrv is a name known to alljtrv is a name known to alljtrv is a name known to alljtrv is a name known to alljtrv is a name known to all
Re: Equation for joystick input to Talons

Thank you for that wolframalpha link! I didn't know you could do that. We will definitely be tweaking that. I've found an equation to use for now by means of Excel - y = 0.9703x^5 - 2.673x^4 + 0.3901x^3 + 2.0981x^2 + 0.2075x. It seems to look good and we will be testing it on the drive train soon. Thank you to all your posts! Definitely helped.
  #12   Spotlight this post!  
Unread 04-02-2014, 16:17
apalrd's Avatar
apalrd apalrd is offline
More Torque!
AKA: Andrew Palardy (Most people call me Palardy)
VRC #3333
Team Role: College Student
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Auburn Hills, MI
Posts: 1,347
apalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond repute
Re: Equation for joystick input to Talons

If you have even powers in your equation, you will have to take the abs of the input variable and multiply the output by the sign of the input, because you will lose the sign on the even terms but not the odd terms.

An equation with all odd powers would not do that.
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor

"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack
  #13   Spotlight this post!  
Unread 04-02-2014, 16:31
jtrv's Avatar
jtrv jtrv is offline
github.com/jhtervay
AKA: Justin
FRC #2791 (Shaker Robotics)
Team Role: College Student
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Latham, NY
Posts: 147
jtrv is a name known to alljtrv is a name known to alljtrv is a name known to alljtrv is a name known to alljtrv is a name known to alljtrv is a name known to all
Re: Equation for joystick input to Talons

Yep, I've got that accounted for.
  #14   Spotlight this post!  
Unread 05-02-2014, 01:20
ekapalka's Avatar
ekapalka ekapalka is offline
Registered User
FRC #3216
 
Join Date: Dec 2012
Location: Bermuda
Posts: 277
ekapalka has a spectacular aura aboutekapalka has a spectacular aura about
Re: Equation for joystick input to Talons

For a basic interpolation given a few points, this should give you an idea. Your particular data points wouldn't produce a perfect equation fitting into ±1 range, but that can be fixed with some scaling. I would really like to know if there's an alternative to doing it this way, though :)
  #15   Spotlight this post!  
Unread 05-02-2014, 08:43
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,077
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: Equation for joystick input to Talons

Quote:
Originally Posted by ekapalka View Post
I would really like to know if there's an alternative to doing it this way, though
Cubic splines


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


All times are GMT -5. The time now is 02:33.

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