![]() |
PIDController + Latency - related issues
I tried to correct the name of this post as well as clarify, but I noticed it was removed from more than one place so I have just deleted and made a new post in hopes that I can make more sense this time otherwise I'm not going to bother with this theory I'll just simulate what I'm thinking then post the simulation link here later. On to my thoughts:
PID uses a relative setpoint and uses a graph similar to sin(X) after reaching the setpoint + someOffset. After that the equation becomes +/- offset and appears similar to the graph of sin(X) where the height is equivalent to the offset + setpoint. Theoretically, there are no issues with this AT ALL. Upon seeing tests between teams and competition matches where teams have had issues with shooting into the high goal. Here's the programming side: Everything has a delay, hopefully in milliseconds, but that's typically known as "latency" and happens to be the reason why gamers tend to use keyboard + mouse over an Xbox controller. Latency baselines: Xbox 360 Controller: 66ms Xbox One Controller: 33ms RoboRIO: update period -> 20ms Network latency: <5ms (it varies) Driver Station software latency: depends on CPU, anything made after 2013 has at least a baseline of <15ms to capture the Xbox Controller and send it back via network tables to the roborio. Celeron/Pentium CPUs: <15ms, i3 (3rd gen or later) or AMD equivalent: <11ms, i5 (4th gen or later) or AMD equivalent: <10ms, i7 (4th gen or later) or AMD equivalent: <9ms. Making all of this into a calculation, Xbox Controller + RoboRIO + network latency + DS (+ encoder latency, which we will say it manages to acquire the data instanuously) = overallLatency In this case we'll be measuring with an Xbox 360 controller: 66 + 20 + 5 + 15 = 106ms = 0.106 seconds. On with the Xbox One Controller: 33 + 20 + 5 + 15 = 73ms = 0.073 seconds Despite the Xbox One controller being noticeably faster (during calculation), the latency on the Xbox 360 Controller is roughly 212ms to receive as well as send a packet to/from the controller where the Xbox one controller is 146ms. Let's look at this latency as part of the PID; start by giving a setpoint of 4600/6000 (rpm) = ~76.7% motor speed. Here's what the PIDController looks like while attached to a motor: http://www.globalspec.com/ImageRepos...8d67cc 19.png The next step in this process is to find out the length of time it takes for this given data. I don't really have a lot of access to this type of information right this second, but I certainly can update the post when I figure out how to handle the data correctly in a simulation or I can get feedback from team(s). Either way, the latency plus the speed of the motor are highly likely to cause issues while shooting unless you compensate on the roborio for that. Using a PID-based system where the shooter uses PID to control the mechanism that applies the most acceleration could cause issues with the speed of the ball being shot is actually under powered if designed 'properly'. For reference, I found his link from awhile ago to assist my point that PID never seems very consistent: http://www.chiefdelphi.com/forums/sh...d.php?t=114366 While I'm certainly noting that it shouldn't be "more word versus yours and therefore it weighs more", teams should be aware of this consistency issue which was introduce back in 2013. Bang-bang is certainly an overly simplistic matter of a PID, but there also hasn't been a lot of talk on the subject since. Consider this post a "let's get to theorizing" thread. At the very least, we might help some teams who are falling behind right now due to missed shots or latency extensions. CERTAINLY SHOULD BE NOTED: the PIDController and latency are two separate things ENTIRELY, but they are related depending on your control system setup. If anybody has a way to simulate the PID system. TL;DR: Objective: Determine if using a PIDController as a major source for velocity on your shooter is reliable. Theory: Utilizing a PIDController as a major souce for velocity on a team's shooter is fairly unreliable due to unpredictable inconsistencies within latency during the teleoperation period. |
Re: PIDController + Latency - related issues
I'm very confused on what an xbox controller and network latency has to do with any of this. Usually the only thing people do with the controllers is enable the PID loop. The PIDController class runs entirely on the RoboRIO every 20 milliseconds in its own thread, however the encoders read much faster then that from the FPGA. Network latency has nothing to do with this, unless you are running the PID calculations on the DS laptop, which is HIGHLY unlikely, and definitely wouldn't work.
|
Re: PIDController + Latency - related issues
You could probably handle the calculations on the DriverStation, agreeably you shouldn't really attempt that. I have a feeling that the latency between when the PID gets to the setpoint and the 'notifier' goes off for your team either the roborio handles that and shoots or there is a person that has to shoot. If there is a person who has to give interaction for the shooter to 'shoot' then it could cause issues, correct?
|
Re: PIDController + Latency - related issues
Quote:
|
Re: PIDController + Latency - related issues
Agreeably, but some teams still tend to leave out the shootable range. Ideally, that would be the way to go - forcing the shooter to be +/- some lee-way (in this case) upon shooting. It just seems weird that some teams are still having issues with shooting if they're using a PID and seemingly it could be setup 'correctly'. Wouldn't a bang-bang still be more reliable?
|
Re: PIDController + Latency - related issues
You seem to be operating under the assumption that a stable, 0 deviation from setpoint velocity is the only component to a consistent shot. This is far from the case. There are many mechanical factors that go into shot consistency that are unrelated to wheel velocity.
Quote:
|
Re: PIDController + Latency - related issues
Quote:
I already gave you my comments about latency in the other thread. |
Re: PIDController + Latency - related issues
I am fairly aware of your point that you made in the other thread Alan, however, the team that I was on saw no error correction prior to the Integral calculation. I don't know if that means that it was clearly tuned wrong or what, but that does certainly force an issue upon accuracy. Applying that specific PID to the shooter, which never corrects to get onto the set point, adding in a human-dependent interaction could create a larger issue. However, as Thad had mentioned yesterday, there could be a check that may prevent the issue.
|
Re: PIDController + Latency - related issues
If you are trying to analyze a system where you are controlling the velocity of a shooter wheel, you need to make sure that the process variable and set point are describing the same thing as the controller's output.
You can't just use RPM as the input and motor speed as the output. If you do that, then when the speed reaches the set point, the motor output will be zero. You either have to post-integrate the controller's output, or you have to reinterpret the PID as DPX. Among other things, that means the I constant in a velocity controller will have the same effect as the P constant in a position controller. That is the reason your team found that you need Integral in order to get a shooter wheel to work. It has nothing at all to do with latency, or with the type of control device used by the driver, or with the graph of sin(x). Again, I urge to you to abandon this line of reasoning, because it is based on assumptions which do not match reality. |
Re: PIDController + Latency - related issues
Quote:
To add feedforward (kF): remove all other constants, set the setpoint to a specific speed (I've heard 3/4 of max speed is usually pretty good). Then increase the kF until the actual speed matches the setpoint. From there, you can start to play with small values of P and I to get your controller more accurate. |
Re: PIDController + Latency - related issues
Quote:
You can "roll your own" and make a PID controller using a more conventional form, including feedforward. It's not hard. Tuning a conventional PID is probably easier (unless you bring in a lot of math and analysis to compute the appropriate academic parameters based on the system's step response). Feedforward only works well if the system is reasonably linear. Your system might always use a range of wheel speeds where that assumption holds, and it would be fine in that case. You should still be aware that you are relying on that assumption. |
Re: PIDController + Latency - related issues
Quote:
|
Re: PIDController + Latency - related issues
Alan, I agree with your point completely. But The reason I added in latency was because the system is flawed by never receding back onto the 'setpoint' as well as the system requires that user input is given to launch the ball. I don't really care how the system is setup nor do I care to look too closely at how the code is formatted. I'm fully aware that this certainly creates issues upon 'defending my point' but the system does not appear to be consistent. I can say that the robot uses one motor for the shooter which is controlled by a PIDController. There is an encoder used on the shaft connecting to separate belts to drive the two axles with wheels attached. I can do a rough sketch of the design if needed, but the actual system should still remain with the receding pattern given by the pdf however the activation only happens for roughly eight seconds, maximum prior to shooting so Integral never has a chance to increase large enough to reduce the error correction (if I'm not mistaken, they're using something like 0.07 for the 'I' value).
Currently, their code is written in Java but I'm almost certain that the language wouldn't matter as both Java and C++ should have the same PIDController formatting. Defending the point of latency is that there is no extra check, as far as I'm aware, that the system ever waits for the current speed to be around the setpoint forced into the PIDController prior to launching the ball. The launch of the ball is forced by the manipulator and they only receive controller vibration to notify them that they are 'at' the setpoint. Certainly, there wouldn't be an issue of latency if the system was setup correctly. |
Re: PIDController + Latency - related issues
Quote:
Also, I am going to ask that in the future you try to do a better job explaining what the problem is. You made a lot of assumptions about how most people consider a PID to behave. A normal PID controller in FRC does not behave at all like what this team is experiencing; most will stabilize to the point where they are either not oscillating at all or are the oscillation isn't noticeable. Taking the TL;DR from your original post: Quote:
|
Re: PIDController + Latency - related issues
Quote:
Quote:
|
| All times are GMT -5. The time now is 21:46. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi