View Single Post
  #18   Spotlight this post!  
Unread 03-04-2014, 22:14
The Doctor's Avatar
The Doctor The Doctor is offline
Robotics is life
AKA: Hackson
FRC #3216 (MRT)
Team Role: Programmer
 
Join Date: Mar 2014
Rookie Year: 2013
Location: United States
Posts: 153
The Doctor is on a distinguished road
Re: paper: Take-Back-Half Shooter Wheel Speed Control

I have found this to be an acceptable take-back-half algorithm:

Code:
cval -= (cval - goodval) / 2;
Where cval is the current value of [whatever] and goodval is the ideal point (what you want it to be at)

Code:
cval += constrain(-(cval - goodval) / 2,-max,max);
This also works, but is constrains the value to within a maximum speed, the variable max. Function constrain below:

Code:
float constrain(val,min,max) {
          return val>max?max:val<min?min:val;
}
This seems a lot simpler than the previously posted code, and I was wondering if they are equivalent?
Reply With Quote