Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Equation for joystick input to Talons (http://www.chiefdelphi.com/forums/showthread.php?t=125816)

jtrv 04-02-2014 15:39

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 :)

Ether 04-02-2014 15:46

Re: Equation for joystick input to Talons
 

Something like this?

Here's how to do it.



apalrd 04-02-2014 15:46

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.

jtrv 04-02-2014 15:49

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.

Ether 04-02-2014 15:53

Re: Equation for joystick input to Talons
 
Quote:

Originally Posted by jtrv (Post 1337603)
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.



jtrv 04-02-2014 15:56

Re: Equation for joystick input to Talons
 
Quote:

Originally Posted by Ether (Post 1337606)
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.

apalrd 04-02-2014 15:59

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.

jtrv 04-02-2014 16:01

Re: Equation for joystick input to Talons
 
Quote:

Originally Posted by apalrd (Post 1337613)
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.

Ether 04-02-2014 16:02

Re: Equation for joystick input to Talons
 
Quote:

Originally Posted by jtrv (Post 1337610)
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.



connor.worley 04-02-2014 16:05

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

jtrv 04-02-2014 16:13

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.

apalrd 04-02-2014 16:17

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.

jtrv 04-02-2014 16:31

Re: Equation for joystick input to Talons
 
Yep, I've got that accounted for.

ekapalka 05-02-2014 01:20

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 :)

Ether 05-02-2014 08:43

Re: Equation for joystick input to Talons
 
Quote:

Originally Posted by ekapalka (Post 1337852)
I would really like to know if there's an alternative to doing it this way, though :)

Cubic splines




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

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi