Go to Post "Drink Mountain Dew. Eat Pizza. Make Robot. This is life." - onecoolc [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #21   Spotlight this post!  
Unread 31-12-2016, 11:39
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 7,986
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: Drivetrain PID tuning

Quote:
Originally Posted by Jaci View Post
Code:
float gyro_heading = ... your gyro code ...
float desired_heading = get_heading(time, profile);
float delta_angle = desired_heading - gyro_heading; // This is our error in alignment
float turn_power = 0.8 * (-1/80) * delta_angle;   // Change these coefficients as required...
It might be helpful to slightly modify one line of code:

float delta_angle = desired_heading - gyro_heading; // This is our error in alignment

float delta_angle = MATH.IEEEremainder(desired_heading - gyro_heading,360); // This is our error in alignment


https://www.chiefdelphi.com/forums/s...3&postcount=36
https://msdn.microsoft.com/en-us/lib...vs.110%29.aspx
http://en.cppreference.com/w/cpp/numeric/math/remainder



Last edited by Ether : 31-12-2016 at 12:08. Reason: added hyperlinks
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 06:49.

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