View Single Post
  #10   Spotlight this post!  
Unread 23-03-2011, 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: pic: Sparto the Waldo

If I were to program it, I would probably:

1. Take the inputs from the Cypress board (in Teleop.vi) and scale them to some sane units (degrees, radians, etc.), probably by taking the volts in, subtracting a known centerpoint (0 would probably be straight out or vertical, you pick but be consistent), and then multiplying the volts from center by a constant.

2. Send the scaled numbers off to another thread to be processed

3. Said other thread would take the units, and lookup the appropriate scaling on this robot (meaning, the competition or practice robot), and take the analog sensors on the robot and scale the inputs to the same units (with the same 0-point)

4. A P-controller would run in said thread, taking numbers of sane units from 1 and sensors of same sane units from 3 and determining the motor output for each joint. I have actually never used anything but P, because I have not yet found the need for any other terms.

If you do a lot of trig processing (maybe for gain scheduling or elsewhere), storing the value in radians makes everything cleaner. If you want to use stored positions (say, for autonomous), you can store them in radians, so if the sensor calibration changes, it doesn't affect any other code.
__________________
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
Reply With Quote