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.4 2009-04-24 19:30:41 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>
44 #include "../common/i2c_commands.h"
48 #define COBROLLER_SPEED 1200
49 //#define COBROLLER_SPEED 600
50 //#define COBROLLER_SPEED 400
52 #define SERVO_DOOR_OPEN 300
53 #define SERVO_DOOR_CLOSED 530
54 #define SERVO_DOOR_BLOCK 530
56 #define SERVO_CARRY_L_OPEN 295
57 #define SERVO_CARRY_L_CLOSED 440//400 // 510
59 #define SERVO_CARRY_R_OPEN 455
60 #define SERVO_CARRY_R_CLOSED 310//350 // 250
62 void actuator_init(void);
64 void servo_carry_open(void)
66 pwm_ng_set(SERVO_CARRY_L_PWM, SERVO_CARRY_L_OPEN);
67 pwm_ng_set(SERVO_CARRY_R_PWM, SERVO_CARRY_R_OPEN);
70 void servo_carry_close(void)
72 pwm_ng_set(SERVO_CARRY_L_PWM, SERVO_CARRY_L_CLOSED);
73 pwm_ng_set(SERVO_CARRY_R_PWM, SERVO_CARRY_R_CLOSED);
76 void servo_door_open(void)
78 pwm_ng_set(SERVO_DOOR_PWM, SERVO_DOOR_OPEN);
81 void servo_door_close(void)
83 pwm_ng_set(SERVO_DOOR_PWM, SERVO_DOOR_CLOSED);
86 void servo_door_block(void)
88 pwm_ng_set(SERVO_DOOR_PWM, SERVO_DOOR_BLOCK);
91 void cobroller_on(uint8_t side)
93 if (side == I2C_LEFT_SIDE)
94 cobboard.left_cobroller_speed = COBROLLER_SPEED;
96 cobboard.right_cobroller_speed = -COBROLLER_SPEED;
99 void cobroller_off(uint8_t side)
101 if (side == I2C_LEFT_SIDE)
102 cobboard.left_cobroller_speed = 0;
104 cobboard.right_cobroller_speed = 0;
107 void cobroller_reverse(uint8_t side)
109 if (side == I2C_LEFT_SIDE)
110 cobboard.left_cobroller_speed = -COBROLLER_SPEED;
112 cobboard.right_cobroller_speed = COBROLLER_SPEED;
115 void actuator_init(void)