|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#31
|
||||
|
||||
|
Re: Drivetrain PID tuning
Quote:
|
|
#32
|
||||
|
||||
|
Re: Drivetrain PID tuning
Quote:
We've gone almost exclusively to a PI controller for yaw rate for stabilization, since in teleop we're generally commanding yaw rate anyway. In autonomous we just program rate*time for heading changes, the integrator in the controller almost always gets us close enough. We've done heading control with feed forward for more bandwidth, but it was overkill for the particular application we tried it with. One of the first things we do in our gyro service function is to calculate (if necessary) and provide robot heading, and heading rate so that we don't need to derive it in a controller. BTW, we generally run at 50 Hz, and target around 10 rad/sec for rate bandwith (a little less that 2 Hz). Our recent setups have been giving us around 30 millicesonds of delay between command and robot response, and 10 rad/s is about the point where we have to start to get more creative with a controller. We may try 100 Hz this year, depending on what we need to do. Cheers, Steve. |
|
#33
|
||||
|
||||
|
Re: Drivetrain PID tuning
Quote:
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 : 12-31-2016 at 12:08 PM. Reason: added hyperlinks |
|
#34
|
|||
|
|||
|
Re: Drivetrain PID tuning
Quote:
This is almost a whole new thread, but it's actually hard to write code that is hard real-time on the roboRIO. Hard real-time means that 100% of the time, your code will finish in X us. That means all your algorithms need to run in constant bounded time, and they can't use any system calls which don't run in constant bounded time either. This means you need to avoid - Allocating memory (new, malloc, etc). - file IO. (It can take an unbounded amount of time for your write system call to complete). - algorithms which don't take constant execution time. - Any other operations which aren't constant time. https://rt.wiki.kernel.org/index.php/RT_PREEMPT_HOWTO has some good info on what real-time means. If you are interested in debugging real-time issues, I'm happy to post some more detailed information. I should really do a CD post some time on one of the ones I've found. For us for logging, this means that we don't log data from our controls thread. We queue it up with a real-time bounded length queue, and write it to a USB stick mounted on the roboRIO from another process. This is a pain, but well worth it. Another hack I'll use for debugging is to monitor the execution time of the syscalls I care about, (for example, the control loop execution time including logging), and re-run the test if there was a timing violation. This won't be real-time for running during a match where you can't replay if there was a timing violation, but lets you debug something quickly and know when you've affected your test results. |
|
#35
|
||||
|
||||
|
Re: Drivetrain PID tuning
Quote:
Quote:
Quote:
![]() |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|