2 * Copyright Droids Corporation (2009)
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: actuator.c,v 1.2 2009-04-24 19:30:42 zer0 Exp $
23 #include <aversive/pgmspace.h>
24 #include <aversive/wait.h>
25 #include <aversive/error.h>
30 #include <encoders_spi.h>
33 #include <scheduler.h>
34 #include <clock_time.h>
38 #include <control_system_manager.h>
39 #include <blocking_detection_manager.h>
46 #define ROLLER_ON -ROLLER_SPEED
48 #define ROLLER_REVERSE ROLLER_SPEED
50 #define FORKROT_DEPLOYED -55000
51 #define FORKROT_MID -33000
52 #define FORKROT_PACKED 0
56 cs_set_consign(&ballboard.roller.cs, ROLLER_ON);
61 cs_set_consign(&ballboard.roller.cs, ROLLER_OFF);
64 void roller_reverse(void)
66 cs_set_consign(&ballboard.roller.cs, ROLLER_REVERSE);
69 void fork_deploy(void)
71 cs_set_consign(&ballboard.forkrot.cs, FORKROT_DEPLOYED);
76 cs_set_consign(&ballboard.forkrot.cs, FORKROT_PACKED);
81 cs_set_consign(&ballboard.forkrot.cs, FORKROT_MID);
84 void actuator_init(void)
86 printf_P(PSTR("fork autopos..."));
87 pwm_ng_set(FORKROT_PWM, 400);
89 pwm_ng_set(FORKROT_PWM, 0);
90 encoders_spi_set_value(FORKROT_ENCODER, 0);
91 printf_P(PSTR("ok\r\n"));
92 ballboard.forkrot.on = 1;