2 * Copyright Droids Corporation, Microb Technology, Eirbot (2005)
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 * Revision : $Id: main.c,v 1.4.6.3 2007-12-05 18:08:40 zer0 Exp $
26 int32_t tab[] = { 0, 1, 2, 5, 6, 0, 0, 1, 0, 0, -10, -8, -5, -1 };
35 pid_set_gains(&p, 1000, 30, 5000);
36 pid_set_maximums(&p, 0, 50000, 4095);
37 pid_set_out_shift(&p, 10);
38 pid_set_derivate_filter(&p, 4);
40 for (i=0; i < (sizeof(tab)/sizeof(int32_t)); i++) {
41 val = pid_do_filter(&p, tab[i]);
42 printf("in = %" PRId32 "\n", tab[i]);
43 printf("out = %" PRId32 "\n", val);
44 printf("I = %" PRId32 "\n", p.integral);
45 printf("D = %" PRId32 "\n\n", p.prev_D);