Understanding PIDs

I’m currently writing software for a robot that I’ve designed, and PID tuning seems to be an endless battle such that I’m now starting to suspect that I’m missing some key to the puzzle. It’s a differential-drive robot and, for the sake of simplification, let’s leave out the problem of linear motion forward and backward and assume that all I want to do is make the robot rotate to point in a specific direction. You can also assume that I am able to calculate the current orientation of the robot with relatively high accuracy, which I’ve tested and verified to be true. So given the current orientation, a target orientation, and a target time to reach the target orientation, what’s the typically “correct” method to setup a PID model to give me the power I should apply to each of the two motors to get me there?

My software is currently written to use a single “angular velocity PID” which I’ve configured such that the set-point is always zero (which would mean that the robot needs to turn neither left nor right), and the input to the PID is the angular velocity required to reach the target orientation in the desired time. This is definitely not working out well no matter how much I try and tweak the Kp, Ki, and Kd values.

The complications that I’ve run into include the following…

  1. There is a “dead zone” for each of the motors, such that they will not move until a certain amount of power is applied to them, and this dead zone varies depending on the amount of power left in the battery, which I currently have no way of measuring. I currently “pad” the PID output with an estimated dead zone value in the positive and negative directions. If I don’t account for this dead zone in the PID output, the PID will significantly overshoot because it thinks the robot is not doing what it wants. Is this typical PID usage?
  2. I can’t figure out the ratio of the power that should be output to the motor compared to target angular velocity. The PID appears to output a linear power curve, but the motors appear to respond to power output on more of a quadratic curve which I haven’t figured out the parameter for quite yet.

So I’m wondering, am I doing this wrong? Should I build a PID model that applies power separately for each wheel? Should I forget about velocity and just calculate the PID inputs based on current target orientation? Do I need some sort of 2-stage PID setup that accommodates both angular velocity and current orientation? Is there something else I’m not understanding? I would greatly appreciate comments from any experienced roboticists who can chime in here.

tl;dr: Are the Ki and Kd values for a PID always supposed to be between 0 and 1, and the Kp is intended to be some sort of ratio of the input to the output?

submitted by /u/solinvictus21
[link] [comments]