View Single Post
  #33   Spotlight this post!  
Unread 12-12-2011, 12:51
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,082
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: Team 254 2011 FRC Code

Quote:
Originally Posted by Ether View Post

Would this work?

- Apply joystick commands -127 to 0 to 127 and measure the Vic's output voltage1 for each one.

- Normalize those measured voltages to the (floating-point) range -127.0 to 0 to +127.0

- From this data, for each desired whole number output (in the range -127 to +127), determine (by simply looking at the measured data)2 the integer value required to come nearest to the desired output. Put these integers into an array (-127 to +127).

- The index of the array is the output you want (-127 to +127), and the value stored at that index is the value you should command. No lookup search or interpolation required.



1 stalled? or free? probably makes a difference. not sure whether you want average or rms voltage.

2 or just let a spreadsheet do it for you


The only downside I see to this approach would be a "loss of precision". Say PWM duty cycle 150 produces a speed of 74, PWM 151 has a speed of 74.5, PWM 152 has a speed of 75. If you wanted to command a speed of "74.5", there is an exact PWM value for that speed. But by quantizing the available speeds into whole number outputs, you would end up never using PWM 151.

If that isn't splitting hairs, though, I don't know what is.