X-Git-Url: http://git.droids-corp.org/?p=aversive.git;a=blobdiff_plain;f=projects%2Fmicrob2010%2Fcobboard%2Factuator.c;h=6811854a3e97a2c9cea034b6e58c191db7133335;hp=67598ea2f499df78eee673cafd63bd4e5c274b0e;hb=fa8546ea39c7442ad3bf5a822a72a2b50a41045d;hpb=8d6a47e9e21a9a31f4bc12d32fb3d11091a4b305 diff --git a/projects/microb2010/cobboard/actuator.c b/projects/microb2010/cobboard/actuator.c index 67598ea..6811854 100644 --- a/projects/microb2010/cobboard/actuator.c +++ b/projects/microb2010/cobboard/actuator.c @@ -1,6 +1,6 @@ -/* +/* * Copyright Droids Corporation (2009) - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -40,25 +40,67 @@ #include +#include "sensor.h" #include "../common/i2c_commands.h" -#include "actuator.h" -#include "ax12_user.h" #include "main.h" +#include "actuator.h" + +#define COBROLLER_SPEED 800 +//#define COBROLLER_SPEED 400 + +#define SERVO_DOOR_OPEN 260 +#define SERVO_DOOR_CLOSED 510 +#define SERVO_DOOR_BLOCK 510 + +#define SERVO_CARRY_L_OPEN 295 +#define SERVO_CARRY_L_CLOSED 400 // 510 + +#define SERVO_CARRY_R_OPEN 455 +#define SERVO_CARRY_R_CLOSED 350 // 250 + +void actuator_init(void); void servo_carry_open(void) { + pwm_ng_set(SERVO_CARRY_L_PWM, SERVO_CARRY_L_OPEN); + pwm_ng_set(SERVO_CARRY_R_PWM, SERVO_CARRY_R_OPEN); } void servo_carry_close(void) { + pwm_ng_set(SERVO_CARRY_L_PWM, SERVO_CARRY_L_CLOSED); + pwm_ng_set(SERVO_CARRY_R_PWM, SERVO_CARRY_R_CLOSED); } void servo_door_open(void) { + pwm_ng_set(SERVO_DOOR_PWM, SERVO_DOOR_OPEN); } void servo_door_close(void) { + pwm_ng_set(SERVO_DOOR_PWM, SERVO_DOOR_CLOSED); +} + +void servo_door_block(void) +{ + pwm_ng_set(SERVO_DOOR_PWM, SERVO_DOOR_BLOCK); +} + +void cobroller_on(uint8_t side) +{ + if (side == I2C_LEFT_SIDE) + cobboard.left_cobroller_speed = COBROLLER_SPEED; + else + cobboard.right_cobroller_speed = -COBROLLER_SPEED; +} + +void cobroller_off(uint8_t side) +{ + if (side == I2C_LEFT_SIDE) + cobboard.left_cobroller_speed = 0; + else + cobboard.right_cobroller_speed = 0; } void actuator_init(void)