View Single Post
  Spotlight this post!  
Unread 04-02-2015, 15:57
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,044
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: Mecanum wheels spinning too fast!

Quote:
Originally Posted by Bpk9p4 View Post
sorry no both ways work just as well. Just was putting out another option. We have just had good luck with this method. here is an example of how we use it http://i.imgur.com/Bq7QMuE.png
You mentioned you were using a Lookup Table for that.

Just for fun, when you have a symmetric piecewise linear curve like that with so few pieces, you can create a very simple tunable piecewise linear function.

I labeled the points (a,0), (a,b), and (c,d) on your diagram (attached).

C code for the piecewise linear code for that is quite simple:

Code:

// do the following once at initialization,
// or any time you change a ,b, c, or d on-the-fly:

m1=(d-b)/(c-a);  m2=(1-d)/(1-c);
Code:

// Let J be the abscissa and K be the ordinate on your graph.
// Here's the piecewise linear code to convert J to K:

x=fabs(J);
if (x<a) K=0;
else if (x<c) K=b+m1*(x-a);
else K=d+m2*(x-c);
if (J<0) K=-K;

Attached Thumbnails
Click image for larger version

Name:	piecewise_linear.png
Views:	53
Size:	201.0 KB
ID:	18144  
Reply With Quote