Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve steering velocity control loop integrator #385

Open
ihartwig opened this issue Mar 27, 2016 · 0 comments
Open

improve steering velocity control loop integrator #385

ihartwig opened this issue Mar 27, 2016 · 0 comments

Comments

@ihartwig
Copy link
Contributor

Low level's steering controller uses nested position/velocity PID loops to control the DC motor. The velocity PID loop generates changes in velocity that are applied to the current value (integrated). Calculating from hundredths of deg/s to us of servo pulse makes errors of < 1 when we are close to 0 error or running at a slow speed which causes them to no be added to the desired servo pulse over time.

From driving the velocity controller directly:

50 deg/s
target: 5000, current: 5400, error: -400, correction: 0, output: -40
target: 5000, current: 5500, error: -500, correction: 1, output: -39
target: 5000, current: 5100, error: -100, correction: 0, output: -39
target: 5000, current: 5100, error: -100, correction: 0, output: -39
target: 5000, current: 4700, error: 300, correction: 0, output: -39
target: 5000, current: 4400, error: 600, correction: -1, output: -40
target: 5000, current: 4400, error: 600, correction: -1, output: -41
target: 5000, current: 4500, error: 500, correction: -1, output: -42
target: 5000, current: 4800, error: 200, correction: 0, output: -42
target: 5000, current: 5400, error: -400, correction: 0, output: -42
target: 5000, current: 5500, error: -500, correction: 1, output: -41

15 deg/s
target: 1500, current: 1200, error: 300, correction: 0, output: -26
target: 1500, current: 1100, error: 400, correction: 0, output: -26
target: 1500, current: 1100, error: 400, correction: 0, output: -26
target: 1500, current: 1300, error: 200, correction: 0, output: -26
target: 1500, current: 1100, error: 400, correction: 0, output: -26
target: 1500, current: 900, error: 600, correction: -1, output: -27
target: 1500, current: 1000, error: 500, correction: -1, output: -28
target: 1500, current: 800, error: 700, correction: -1, output: -29
target: 1500, current: 800, error: 700, correction: -1, output: -30
target: 1500, current: 1200, error: 300, correction: 0, output: -30
target: 1500, current: 1500, error: 0, correction: 0, output: -30
target: 1500, current: 2000, error: -500, correction: 1, output: -29
target: 1500, current: 2100, error: -600, correction: 1, output: -28

5 deg/s
target: 500, current: 300, error: 200, correction: 0, output: -21
target: 500, current: 200, error: 300, correction: 0, output: -21
target: 500, current: 300, error: 200, correction: 0, output: -21
target: 500, current: 100, error: 400, correction: 0, output: -21
target: 500, current: 100, error: 400, correction: 0, output: -21
target: 500, current: 200, error: 300, correction: 0, output: -21
target: 500, current: 100, error: 400, correction: 0, output: -21
target: 500, current: 0, error: 500, correction: -1, output: -22
target: 500, current: 100, error: 400, correction: 0, output: -22
target: 500, current: 100, error: 400, correction: 0, output: -22
target: 500, current: 200, error: 300, correction: 0, output: -22
target: 500, current: 300, error: 200, correction: 0, output: -22

4 deg/s
target: 400, current: 0, error: 400, correction: 0, output: -17
target: 400, current: 0, error: 400, correction: 0, output: -17
target: 400, current: 0, error: 400, correction: 0, output: -17
target: 400, current: 0, error: 400, correction: 0, output: -17
target: 400, current: 0, error: 400, correction: 0, output: -17
target: 400, current: 0, error: 400, correction: 0, output: -17
target: 400, current: 0, error: 400, correction: 0, output: -17
target: 400, current: 0, error: 400, correction: 0, output: -17

Suggested resolution: we should accumulate in a higher precision unit like ns of pulse. The actual output is 2*us with our clock settings, so changing to input unit to servo_set_us() will not help us much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant