Go to Post Lawyers find loopholes. Engineers find solutions. For which would you rather be known? - dlavery [more]
Home
Go Back   Chief Delphi > ChiefDelphi.com Website > Extra Discussion
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #18   Spotlight this post!  
Unread 03-04-2014, 22:14
The Doctor's Avatar
The Doctor The Doctor is online now
Robotics is life
AKA: Hackson
FRC #3216 (MR. T)
Team Role: Programmer
 
Join Date: Mar 2014
Rookie Year: 2013
Location: United States
Posts: 141
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
 


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 12:08.

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