summaryrefslogtreecommitdiff
path: root/digital/avr/modules/motor/pos_control/pos_control.txt
blob: d1c1d03f3ab6e79ff94d31f2611fb8d363cda0fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
==========================
 motor/pos_control module
==========================
:Author: Nicolas Schodet

Introduction
============

This module provides position control, usually for a DC motor.  Given a
position consign, it will adjust output power so that the measured position
matches the consign.  There is no speed control, this is handled by another
module.

Usage
=====

The `pos_control_t` structure contains both current control state and control
parameters.  The `kp`, `kd` and `ki` parameters are the PID coefficients,
using a fixed point representation. The `e_sat`, `i_sat` and `d_sat` are the
maximum values for error, integral and differential values.  They must be
adapted so that PID computation does not overflow.  See the
`pos_control_compute_pid` function comments for guidelines to choose those
values.

The `cur` field is updated by this module with the current position.  The
`cons` field must be written by user to set the position consign.  This module
will try to make the current position matches the consign position.

API
===

.. include:: pos_control.exd