Go to Post how can anyone Not Notice An entierly Pink Team? - Tytus Gerrish [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rating: Thread Rating: 53 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 17-11-2011, 12:50
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,569
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Autonomous: Mixing Drive Distance PID's with Turn Angle PID's.

Quote:
Originally Posted by Ether View Post
What is the point of creating two separate polynomials and then adding them together?
Here's some data you can play with. http://forums.usfirst.org/showthread...ghlight=jaguar.

When I looked at it years ago, I wasn't happy with a 5th order polynomial approximation. We used the following lookup table below with the IFI system (input range 0-254, output range 0-254). It wasn't perfect, but greatly improved over nothing.

Code:
0	10	10	10	10	10	10	10	10	10	10	10	10	10	10	11	11	11	11	11	11	11	11	11	12	12	12	12	12	13	13	13	13	13	13	13	13	13	14	14	14	14	14	14	14	14	14	14	15	15	15	15	15	15	15	16	16	17	17	17	17	17	18	18	18	18	18	18	19	19	19	19	19	19	20	20	20	20	20	20	20	21	21	22	22	23	23	23	23	24	24	24	25	26	26	27	27	28	29	29	30	30	31	32	33	33	34	35	36	37	38	39	41	43	45	47	48	51	52	55	59	66	68	73	79	84	92	127	127	143	144	144	144	144	144	145	145	145	145	145	145	145	145	145	145	146	146	146	146	146	146	146	146	146	146	146	146	147	147	147	147	147	147	147	148	148	148	148	149	149	149	149	149	149	149	149	150	150	150	150	150	150	150	150	151	151	151	151	151	151	151	151	152	152	152	152	154	154	154	154	155	155	155	156	156	155	157	157	157	157	157	157	157	159	159	159	159	160	160	160	161	162	163	163	164	164	164	165	166	167	168	169	169	170	171	172	173	174	175	176	177	178	179	182	183	188	191	192	193	196	203	207	211	220	229	254

Last edited by Joe Ross : 17-11-2011 at 17:10.
Reply With Quote
  #2   Spotlight this post!  
Unread 17-11-2011, 17:05
Tom Line's Avatar
Tom Line Tom Line is offline
Raptors can't turn doorknobs.
FRC #1718 (The Fighting Pi)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 1999
Location: Armada, Michigan
Posts: 2,522
Tom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond repute
Re: Autonomous: Mixing Drive Distance PID's with Turn Angle PID's.

Thanks guys.

In the end, I kind of expected some derivation-based way of doing this as opposed to brute force best-fit-line equations, but this makes it easier for me.

By removing the 'tail' of the victor response down at the intermediate pulse widths that generally fall within the deadband of robot motion due to friction, I was able to get a very nice fit on a couple of 6th order polynomials. I'll poke through the rest of it tonight.

I WISH I trusted the jaguars enough to use them on our drivetrain. Perhaps I'm being paranoid, but I still worry about them burning out on fast full-reverse to full-forward transitions. The voltage mode and their linearity looks wonderful!
Reply With Quote
  #3   Spotlight this post!  
Unread 17-11-2011, 17:09
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,078
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Autonomous: Mixing Drive Distance PID's with Turn Angle PID's.

Quote:
Originally Posted by Tom Line View Post
I WISH I trusted the jaguars enough to use them on our drivetrain. Perhaps I'm being paranoid, but I still worry about them burning out on fast full-reverse to full-forward transitions. The voltage mode and their linearity looks wonderful!
You and me both. The 2011 hardware beta test teams have been experimenting with a new version of the Jaguar firmware that implements an "output ramp" function in both PWM and CAN modes to help deal with this case, so hopefully that will help.
Reply With Quote
  #4   Spotlight this post!  
Unread 17-11-2011, 17:40
Tom Line's Avatar
Tom Line Tom Line is offline
Raptors can't turn doorknobs.
FRC #1718 (The Fighting Pi)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 1999
Location: Armada, Michigan
Posts: 2,522
Tom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond repute
Re: Autonomous: Mixing Drive Distance PID's with Turn Angle PID's.

Quote:
Originally Posted by Jared341 View Post
You and me both. The 2011 hardware beta test teams have been experimenting with a new version of the Jaguar firmware that implements an "output ramp" function in both PWM and CAN modes to help deal with this case, so hopefully that will help.
Yeah, we've been playing with it, but the practical side of me screams that I don't want that tiny delay between full back and full forward. The delay is infintesimal and practically we wouldn't ever see it..... it's just the engineer in me crying out to fix the problem and not the symptom.
Reply With Quote
  #5   Spotlight this post!  
Unread 17-11-2011, 17:55
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,083
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: Autonomous: Mixing Drive Distance PID's with Turn Angle PID's.

Quote:
Originally Posted by Joe Ross View Post
Here's some data you can play with. http://forums.usfirst.org/showthread...ghlight=jaguar.

When I looked at it years ago, I wasn't happy with a 5th order polynomial approximation.

I got a pretty nice fit using just 2 cubics by splitting the curve into 2 sections.

See attached screenshot.

Cells A2-A21 and C2-C21 are pulse and volts data from the link you provided. I normalized that data to the range +/-1 for command and output in cells B2-B21 and D2-D21.

I copied the positive half of the curve to cells A27-B38, reversing the cmd & out to get the inverse function, and divided it into 2 sections: cells E27-F33 and E35-F41.

Then I fit a cubic to each section. The equations are in the two graphs at the bottom.

I spliced the 2 cubics together and you can see the net result at the top. It's a pretty nice fit, and for not much math.

To use it, test your desired (positive) command. If it's less than 0.842 use the first cubic, otherwise use the second. If it's zero, use zero.

You could use the same cubics for the negative half of the curve, or create new curves for that half.




Attached Thumbnails
Click image for larger version

Name:	Vic 2poly.png
Views:	218
Size:	32.0 KB
ID:	11092  

Last edited by Ether : 17-11-2011 at 18:00. Reason: typo
Reply With Quote
  #6   Spotlight this post!  
Unread 17-11-2011, 19:23
Tom Line's Avatar
Tom Line Tom Line is offline
Raptors can't turn doorknobs.
FRC #1718 (The Fighting Pi)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 1999
Location: Armada, Michigan
Posts: 2,522
Tom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond repute
Re: Autonomous: Mixing Drive Distance PID's with Turn Angle PID's.

Thanks guys. It's been a long time since I've had one of those AH HA! moments.....

I guess I never realized how far from linear the Victors can be. We've used joystick input modification VI's in the past to make the bots easier to drive, but I never put 2 and 2 together and realized a huge portion of that issue is caused by the Victor's response.

We noticed last year that the logitech dual action game pad (at least one of them) had a hokey joystick that wasn't even close to linear. We threw that one away, but after modeling the cim response like this, I'm almost tempted to do the same to the game pad joysticks so I can linearize them too.

Here's my final result using a single 6th order polynomial.

Darn do I love learning.

(Note: The numbers between .08 and -.08 are not representative in this graph - those are our dead band and will be modified to zero output).
Attached Thumbnails
Click image for larger version

Name:	linearized cim speed output.JPG
Views:	63
Size:	29.5 KB
ID:	11093  

Last edited by Tom Line : 17-11-2011 at 19:25.
Reply With Quote
  #7   Spotlight this post!  
Unread 17-11-2011, 22:58
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,078
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Autonomous: Mixing Drive Distance PID's with Turn Angle PID's.

Pertinent response RE: 5th and 7th order polynomials here: http://www.chiefdelphi.com/forums/sh...t=98267&page=2
Reply With Quote
  #8   Spotlight this post!  
Unread 19-11-2011, 01:19
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,083
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: Autonomous: Mixing Drive Distance PID's with Turn Angle PID's.



The Victor data from the link Joe provided:
Code:
pulse		volts
1.04		-12
1.07		-11.99
1.12		-11.7
1.27		-11.27
1.36		-10.12
1.41		-8.52
1.46		-3.8
1.48		-0.8
1.49		0
1.55		0
1.56		0.8
1.58		2.8
1.6		5.4
1.65		8.9
1.7		10.1
1.75		10.87
1.8		11.25
1.85		11.55
1.9		11.8
2		12
...normalized to +/-1:
Code:
cmd		out
-1		-1
-0.9375		-0.999166667
-0.833333333	-0.975
-0.520833333	-0.939166667
-0.333333333	-0.843333333
-0.229166667	-0.71
-0.125		-0.316666667
-0.083333333	-0.066666667
-0.0625		0
0.0625		0
0.083333333	0.066666667
0.125		0.233333333
0.166666667	0.45
0.270833333	0.741666667
0.375		0.841666667
0.479166667	0.905833333
0.583333333	0.9375
0.6875		0.9625
0.791666667	0.983333333
1		1
Swap the command and the output
(to get inverse function for linearization)
and select only the positive commands:
Code:
out		cmd
0		0.0625
0.066666667	0.083333333
0.233333333	0.125
0.45		0.166666667
0.741666667	0.270833333
0.841666667	0.375
0.905833333	0.479166667
0.9375		0.583333333
0.9625		0.6875
0.983333333	0.791666667
1		1

Fit a rational function model to the data:
Code:
(p1*x^4+p2*x^3+p3*x^2+p4*x+p5) / (x^2+p6*x+p7)
Here are the p1..p7 model parameters:
Code:
-0.43231217703332, 1.136975493080563, -1.043577770662604, 0.26894582879701, 0.069994693624, -2.151432791900253,  1.151458861241842
Attached graph shows the actual data (blue), the model (red), and the error (green). The error is multiplied by 10 to make it visible. The maximum error is 0.01 (1% of full scale).



Attached Thumbnails
Click image for larger version

Name:	rational plot.png
Views:	71
Size:	13.9 KB
ID:	11100  
Reply With Quote
  #9   Spotlight this post!  
Unread 21-11-2011, 09:49
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,078
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Autonomous: Mixing Drive Distance PID's with Turn Angle PID's.

Here is an interesting post from the old IFI Robotics forum that describes what is going on "under the hood" of a Victor.

http://www.ifirobotics.com/forum/viewtopic.php?t=317

Note that there are only 94 discrete output states in each direction. This would make a look-up table a pretty attractive solution. Also, "Be aware that it may take 3 or 4 input steps before the Victor changes its Output."

EDIT: Although this post seems to contradict the last bit about latency: http://www.ifirobotics.com/forum/viewtopic.php?t=375

Last edited by Jared Russell : 21-11-2011 at 10:04.
Reply With Quote
  #10   Spotlight this post!  
Unread 21-11-2011, 19:14
Tom Line's Avatar
Tom Line Tom Line is offline
Raptors can't turn doorknobs.
FRC #1718 (The Fighting Pi)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 1999
Location: Armada, Michigan
Posts: 2,522
Tom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond repute
Re: Autonomous: Mixing Drive Distance PID's with Turn Angle PID's.

Quote:
Originally Posted by Ether View Post


The Victor data from the link Joe provided:
Code:
pulse		volts
1.04		-12
1.07		-11.99
1.12		-11.7
1.27		-11.27
1.36		-10.12
1.41		-8.52
1.46		-3.8
1.48		-0.8
1.49		0
1.55		0
1.56		0.8
1.58		2.8
1.6		5.4
1.65		8.9
1.7		10.1
1.75		10.87
1.8		11.25
1.85		11.55
1.9		11.8
2		12
...normalized to +/-1:
Code:
cmd		out
-1		-1
-0.9375		-0.999166667
-0.833333333	-0.975
-0.520833333	-0.939166667
-0.333333333	-0.843333333
-0.229166667	-0.71
-0.125		-0.316666667
-0.083333333	-0.066666667
-0.0625		0
0.0625		0
0.083333333	0.066666667
0.125		0.233333333
0.166666667	0.45
0.270833333	0.741666667
0.375		0.841666667
0.479166667	0.905833333
0.583333333	0.9375
0.6875		0.9625
0.791666667	0.983333333
1		1
Swap the command and the output
(to get inverse function for linearization)
and select only the positive commands:
Code:
out		cmd
0		0.0625
0.066666667	0.083333333
0.233333333	0.125
0.45		0.166666667
0.741666667	0.270833333
0.841666667	0.375
0.905833333	0.479166667
0.9375		0.583333333
0.9625		0.6875
0.983333333	0.791666667
1		1

Fit a rational function model to the data:
Code:
(p1*x^4+p2*x^3+p3*x^2+p4*x+p5) / (x^2+p6*x+p7)
Here are the p1..p7 model parameters:
Code:
-0.43231217703332, 1.136975493080563, -1.043577770662604, 0.26894582879701, 0.069994693624, -2.151432791900253,  1.151458861241842
Attached graph shows the actual data (blue), the model (red), and the error (green). The error is multiplied by 10 to make it visible. The maximum error is 0.01 (1% of full scale).
That's almost exactly what we did ether. Nice to know I was on the right track.
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 00:51.

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