Commit from zer0 on branch b_zer0 (2008-02-14 21:32 CET) =================================
use avrdude delay xwhen programming fuse aversive config/prog_fuses.sh 1.3.4.3 ============================= aversive/config/prog_fuses.sh (1.3.4.2 -> 1.3.4.3) ============================= @@ -134,7 +134,7 @@ do rm -f $f 2> /dev/null echo 0x00 > ${f}_new - ${AVRDUDE} -p ${MCU} -P `echo ${AVRDUDE_PORT} | sed 's,",,g'` -c ${AVRDUDE_PROGRAMMER} -U ${f}:r:${f}:i + ${AVRDUDE} -p ${MCU} -P `echo ${AVRDUDE_PORT} | sed 's,",,g'` -c ${AVRDUDE_PROGRAMMER} -U ${f}:r:${f}:i -i $(AVRDUDE_DELAY) if [ ! -f $f ]; then CANNOT_READ=1 fi @@ -238,7 +238,7 @@ y|Y) for f in ${FUSE_LIST}; do hex2intel ${f}_new - ${AVRDUDE} -p ${MCU} -P `echo ${AVRDUDE_PORT} | sed 's,",,g'` -c ${AVRDUDE_PROGRAMMER} -U ${f}:w:${f}_new:i + ${AVRDUDE} -p ${MCU} -P `echo ${AVRDUDE_PORT} | sed 's,",,g'` -c ${AVRDUDE_PROGRAMMER} -U ${f}:w:${f}_new:i -i $(AVRDUDE_DELAY) done exit 0 ;; Commit from zer0 (2008-02-14 21:34 CET) ================ first beacon program + aversive_projects microb2008/beacons/error_config.h 1.1 + aversive_projects microb2008/beacons/main.c 1.1 + aversive_projects microb2008/beacons/main.h 1.1 + aversive_projects microb2008/beacons/uart_config.h 1.1 =================================================== aversive_projects/microb2008/beacons/error_config.h (1.1) =================================================== @@ -0,0 +1,31 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * 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 + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: error_config.h,v 1.1 2008-02-14 20:34:11 zer0 Exp $ + * + */ + +#ifndef _ERROR_CONFIG_ +#define _ERROR_CONFIG_ + +/** enable the dump of the comment */ +#define ERROR_DUMP_TEXTLOG + +/** enable the dump of filename and line number */ +#define ERROR_DUMP_FILE_LINE + +#endif =========================================== aversive_projects/microb2008/beacons/main.c (1.1) =========================================== @@ -0,0 +1,180 @@ +/* + * Copyright Droids Corporation (2007) + * + * 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 + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: main.c,v 1.1 2008-02-14 20:34:11 zer0 Exp $ + * + */ + +#include <stdio.h> +#include <string.h> + +#include <aversive.h> + +#include <aversive/error.h> +#include <aversive/wait.h> +#include <aversive/list.h> + +#include <uart.h> + +#include "main.h" + +#define PWM_MOTOR 20000 + + +struct beacon beacon; + +static uint16_t motor_period = 0; +static uint16_t prev_tcnt1=0; + +static volatile uint16_t nb_enc = 0; +static volatile uint8_t use_max_period = 2; + +/* this variable is set to 1 at each beacon round, when the data are + * ready to be used */ +static volatile uint8_t ready=0; + +/* timer 1 overflow */ +SIGNAL(SIG_OVERFLOW1) +{ + static uint16_t prev_nb_enc = 0; + + /* if there were no encoder signal during a full timer period, + * it means we are too slow: set period variable to MAX during + * 2 timer periods */ + if (nb_enc == prev_nb_enc) { + use_max_period = 2; + cbi(LASER_OUT_PORT, LASER_OUT_BIT); + } + else { + if (use_max_period) + use_max_period --; + else + sbi(LASER_OUT_PORT, LASER_OUT_BIT); + } + + /* set motor PWM */ + sbi(MOTOR_PORT, MOTOR_BIT); + + sei(); + prev_nb_enc = nb_enc; +} + +/* timer 1 output compare */ +SIGNAL(SIG_OUTPUT_COMPARE1A) +{ + /* only reset pwm signal */ + cbi(MOTOR_PORT, MOTOR_BIT); +} + +/* motor speed (top tour) */ +SIGNAL(BEACON_ENC_SIG) +{ + uint16_t cur; + + cur = TCNT1; + nb_enc++; + motor_period = cur - prev_tcnt1; + prev_tcnt1 = cur; + + /* we suppose^W hope that we won't have any BEACON interrupt + * during at least 10 ms */ + sei(); + + /* if ready==0, the main program requested the data */ + if (ready == 0) { + ready = 1; + } + +} + +/* photodiode signal */ +SIGNAL(SENSOR_SIG) +{ + +} + +static inline int32_t motor_get_speed(void) +{ + if (use_max_period) + return 0; + return (0xFFFFFFFF) / (uint32_t)motor_period; +} + +static inline int16_t motor_get_period(void) +{ + if (use_max_period) + return 0xFFFF; + return motor_period; +} + +void my_pwm_set(int32_t val) +{ + OCR1A = (uint16_t)val; +} + +/* PWM command through uart */ +void my_uart_recv_char(char c) +{ + if (c=='+') + my_pwm_set(50000); + if (c=='-') + my_pwm_set(0); + printf("%u\n", motor_get_period()); +} + +int main(void) +{ + /* ddr */ + DDRA = (1<<LED1BIT) | (1<<LED2BIT) | (1<<LED3BIT); + sbi(DDR(LASER_OUT_PORT), LASER_OUT_BIT); + sbi(DDR(MOTOR_PORT), MOTOR_BIT); + + /* external interrupts */ + MCUCR = (1<<ISC11) | (1<<ISC10); /* INT 1 on rising edge (motor enc) */ + MCUCSR = (1<<ISC2); /* INT 2 on rising edge (photodiode) */ + GICR = (1<<INT1);// | (1<<INT2); /* enable INT1 and INT2 */ + + /* timer 1 overflow enable */ + TIMSK |= (1<<TOIE1) | (1<<OCIE1A); + TCCR1B = (1<<CS11); /* div=8 */ + + /* uart */ + uart_init(); + fdevopen(uart0_dev_send, NULL); + uart0_register_rx_event(my_uart_recv_char); + + sei(); + + + while(1) { + if (SENSOR_PIN & (1<<SENSOR_BIT)) + LED2_ON(); + else + LED2_OFF(); +#if 0 + /* request data to interruption */ + ready=0; + while(ready==0); + wait_ms(1000); + LED1_ON(); + wait_ms(1000); + LED1_OFF(); +#endif + } + return (0); +} + =========================================== aversive_projects/microb2008/beacons/main.h (1.1) =========================================== @@ -0,0 +1,66 @@ +/* + * Copyright Droids Corporation (2008) + * + * 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 + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: main.h,v 1.1 2008-02-14 20:34:11 zer0 Exp $ + * + */ + +struct beacon { +}; + +extern struct beacon beacon; + +/* Used to get the speed of the motor */ +#define BEACON_ENC_SIG SIG_INTERRUPT1 +#define BEACON_ENC_PIN PIND +#define BEACON_ENC_BIT 3 + +/* switch on/off the laser */ +#define LASER_OUT_PWM ((void *)PWM1B_NUM) +#define LASER_OUT_PORT PORTD +#define LASER_OUT_BIT 4 + +/* motor command */ +#define MOTOR_PWM ((void *)PWM1A_NUM) +#define MOTOR_PORT PORTD +#define MOTOR_BIT 5 + +/* photodiode : we got this signal on 2 pins, first on PB2 */ +#define SENSOR_SIG SIG_INTERRUPT2 +#define SENSOR_PIN PINB +#define SENSOR_BIT 2 +/* photodiode is also on ICP */ +/* #define SENSOR_PIN PIND */ +/* #define SENSOR_BIT 6 */ + +/* Zigbee control : PC0->PC3 */ + +/* Leds */ +#define LED1BIT 0 +#define LED2BIT 1 +#define LED3BIT 2 + +#define LED1_ON() sbi(PORTA, LED1BIT) +#define LED1_OFF() cbi(PORTA, LED1BIT) + +#define LED2_ON() sbi(PORTA, LED2BIT) +#define LED2_OFF() cbi(PORTA, LED2BIT) + +#define LED3_ON() sbi(PORTA, LED3BIT) +#define LED3_OFF() cbi(PORTA, LED3BIT) + +#define CS_PRIO 100 ================================================== aversive_projects/microb2008/beacons/uart_config.h (1.1) ================================================== @@ -0,0 +1,72 @@ +/* + * Copyright Droids Corporation, Microb Technology, Eirbot (2005) + * + * 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 + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Revision : $Id: uart_config.h,v 1.1 2008-02-14 20:34:11 zer0 Exp $ + * + */ + +/* Droids-corp 2004 - Zer0 + * config for uart module + */ + +#ifndef UART_CONFIG_H +#define UART_CONFIG_H + +/* + * UART0 definitions + */ + +/* compile uart0 fonctions, undefine it to pass compilation */ +#define UART0_COMPILE + +/* enable uart0 if == 1, disable if == 0 */ +#define UART0_ENABLED 1 + +/* enable uart0 interrupts if == 1, disable if == 0 */ +#define UART0_INTERRUPT_ENABLED 1 + +#define UART0_BAUDRATE 57600 + +/* + * if you enable this, the maximum baudrate you can reach is + * higher, but the precision is lower. + */ +#define UART0_USE_DOUBLE_SPEED 0 +//#define UART0_USE_DOUBLE_SPEED 1 + +#define UART0_RX_FIFO_SIZE 4 +#define UART0_TX_FIFO_SIZE 4 +//#define UART0_NBITS 5 +//#define UART0_NBITS 6 +//#define UART0_NBITS 7 +#define UART0_NBITS 8 +//#define UART0_NBITS 9 + +#define UART0_PARITY UART_PARTITY_NONE +//#define UART0_PARITY UART_PARTITY_ODD +//#define UART0_PARITY UART_PARTITY_EVEN + +#define UART0_STOP_BIT UART_STOP_BITS_1 +//#define UART0_STOP_BIT UART_STOP_BITS_2 + + + + +/* .... same for uart 1, 2, 3 ... */ + +#endif + Commit from zer0 on branch b_zer0 (2008-02-14 21:43 CET) ================================= oops I was a bit fast with delay aversive config/prog_fuses.sh 1.3.4.4 ============================= aversive/config/prog_fuses.sh (1.3.4.3 -> 1.3.4.4) ============================= @@ -128,13 +128,19 @@ echo "Reading current fuse state" +if [ ! -z "${AVRDUDE_DELAY}" ]; then + DELAY="-i ${AVRDUDE_DELAY}" +else + DELAY="" +fi + CANNOT_READ=0 for f in ${FUSE_LIST} do rm -f $f 2> /dev/null echo 0x00 > ${f}_new - ${AVRDUDE} -p ${MCU} -P `echo ${AVRDUDE_PORT} | sed 's,",,g'` -c ${AVRDUDE_PROGRAMMER} -U ${f}:r:${f}:i -i $(AVRDUDE_DELAY) + ${AVRDUDE} -p ${MCU} -P `echo ${AVRDUDE_PORT} | sed 's,",,g'` -c ${AVRDUDE_PROGRAMMER} -U ${f}:r:${f}:i ${DELAY} if [ ! -f $f ]; then CANNOT_READ=1 fi @@ -238,7 +244,7 @@ y|Y) for f in ${FUSE_LIST}; do hex2intel ${f}_new - ${AVRDUDE} -p ${MCU} -P `echo ${AVRDUDE_PORT} | sed 's,",,g'` -c ${AVRDUDE_PROGRAMMER} -U ${f}:w:${f}_new:i -i $(AVRDUDE_DELAY) + ${AVRDUDE} -p ${MCU} -P `echo ${AVRDUDE_PORT} | sed 's,",,g'` -c ${AVRDUDE_PROGRAMMER} -U ${f}:w:${f}_new:i ${DELAY} done exit 0 ;; Commit from zer0 (2008-02-14 22:53 CET) ================ use a catapult, not a roller aversive_projects microb2008/common/i2c_commands.h 1.6 aversive_projects microb2008/extension/i2c_protocol.c 1.8 aversive_projects microb2008/extension/main.c 1.10 aversive_projects microb2008/extension/main.h 1.3 aversive_projects microb2008/extension/pwm_config.h 1.3 aversive_projects microb2008/main/commands.c 1.11 aversive_projects microb2008/main/i2c_protocol.c 1.10 aversive_projects microb2008/main/i2c_protocol.h 1.6 aversive_projects microb2008/main/main.c 1.17 ================================================== aversive_projects/microb2008/common/i2c_commands.h (1.5 -> 1.6) ================================================== @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * Revision : $Id: i2c_commands.h,v 1.5 2008-01-09 22:24:45 zer0 Exp $ + * Revision : $Id: i2c_commands.h,v 1.6 2008-02-14 21:53:38 zer0 Exp $ * */ @@ -55,23 +55,21 @@ #define I2C_EXTENSION_COMMAND_PREPARE_WHITE 2 /* prepare a white ball drop and set roller */ #define I2C_EXTENSION_COMMAND_PREPARE_COLORED 3 /* prepare a colored ball drop and set roller */ #define I2C_EXTENSION_COMMAND_DROP 4 /* drop ball */ -#define I2C_EXTENSION_COMMAND_ROLLER_SPEED 5 /* set roller_speed only */ -#define I2C_EXTENSION_COMMAND_ROLLER_ANGLE 6 /* set roller_angle only */ -#define I2C_EXTENSION_COMMAND_ROLLER_CS_ON 7 /* enable roller cs */ -#define I2C_EXTENSION_COMMAND_ROLLER_CS_OFF 8 /* disable roller cs */ +#define I2C_EXTENSION_COMMAND_CATAPULT_POS 5 /* set catapult position only */ +#define I2C_EXTENSION_COMMAND_CATAPULT_SPEED 6 /* set catapult speed only */ +#define I2C_EXTENSION_COMMAND_CATAPULT_CS_ON 7 /* enable catapult cs */ +#define I2C_EXTENSION_COMMAND_CATAPULT_CS_OFF 8 /* disable catapult cs */ #define I2C_EXTENSION_COMMAND_BARREL_POS 9 /* set barrel position */ -#define I2C_EXTENSION_COMMAND_BARREL_CS_ON 10 /* enable barrel cs */ -#define I2C_EXTENSION_COMMAND_BARREL_CS_OFF 11 /* disable barrel cs */ +#define I2C_EXTENSION_COMMAND_BARREL_SPEED 10 /* set barrel speed */ +#define I2C_EXTENSION_COMMAND_BARREL_CS_ON 11 /* enable barrel cs */ +#define I2C_EXTENSION_COMMAND_BARREL_CS_OFF 12 /* disable barrel cs */ struct i2c_cmd_extension { struct i2c_cmd_hdr hdr; uint8_t cmd; union { - struct { - int16_t roller_speed; - uint8_t roller_angle; - } s; - int32_t barrel_pos; + int32_t pos; + uint32_t speed; } u; }; @@ -87,6 +85,31 @@ /****/ + +#define I2C_CMD_EXTENSION_SET_GAIN 0x03 + +struct i2c_cmd_extension_gain { + struct i2c_cmd_hdr hdr; + uint8_t num; + uint16_t p; + uint16_t i; + uint16_t d; +}; + + +/****/ + +#define I2C_CMD_EXTENSION_SET_COLOR 0x04 + +#define I2C_EXTENSION_COLOR_RED 0 +#define I2C_EXTENSION_COLOR_BLUE 1 +struct i2c_cmd_extension_color { + struct i2c_cmd_hdr hdr; + uint8_t color; +}; + + +/****/ /* requests and their answers */ /****/ @@ -125,7 +148,6 @@ uint8_t state; uint8_t white_ball_count; uint8_t colored_ball_count; - int16_t roller_speed; }; ===================================================== aversive_projects/microb2008/extension/i2c_protocol.c (1.7 -> 1.8) ===================================================== @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * Revision : $Id: i2c_protocol.c,v 1.7 2008-01-11 22:58:18 zer0 Exp $ + * Revision : $Id: i2c_protocol.c,v 1.8 2008-02-14 21:53:38 zer0 Exp $ * */ @@ -74,21 +74,24 @@ break; case I2C_EXTENSION_COMMAND_DROP: break; - case I2C_EXTENSION_COMMAND_ROLLER_SPEED: - cs_set_consign(&ext.cs_r, cmd->u.s.roller_speed); + case I2C_EXTENSION_COMMAND_CATAPULT_POS: + cs_set_consign(&ext.cs_c, cmd->u.pos); break; - case I2C_EXTENSION_COMMAND_ROLLER_ANGLE: - /* multiservo something */ + case I2C_EXTENSION_COMMAND_CATAPULT_SPEED: + ramp_set_vars(&ext.r_c, cmd->u.speed, cmd->u.speed); break; - case I2C_EXTENSION_COMMAND_ROLLER_CS_ON: - ext.flags |= ROLLER_CS_ON; + case I2C_EXTENSION_COMMAND_CATAPULT_CS_ON: + ext.flags |= CATAPULT_CS_ON; break; - case I2C_EXTENSION_COMMAND_ROLLER_CS_OFF: - ext.flags &= (~ROLLER_CS_ON); - pwm_set(ROLLER_PWM, 0); + case I2C_EXTENSION_COMMAND_CATAPULT_CS_OFF: + ext.flags &= (~CATAPULT_CS_ON); + pwm_set(CATAPULT_PWM, 0); break; case I2C_EXTENSION_COMMAND_BARREL_POS: - cs_set_consign(&ext.cs_b, cmd->u.barrel_pos); + cs_set_consign(&ext.cs_b, cmd->u.pos); + break; + case I2C_EXTENSION_COMMAND_BARREL_SPEED: + ramp_set_vars(&ext.r_b, cmd->u.speed, cmd->u.speed); break; case I2C_EXTENSION_COMMAND_BARREL_CS_ON: ext.flags |= BARREL_CS_ON; @@ -142,7 +145,6 @@ ans.state = ext.state; ans.white_ball_count = ext.white_ball_count; ans.colored_ball_count = ext.colored_ball_count; - ans.roller_speed = ext.roller_speed; /* XXX check return value. To wait is stupid because we are called with irq disabled */ i2c_send(I2C_ADD_MASTER, (uint8_t *) &ans, sizeof(ans), I2C_CTRL_GENERIC); @@ -195,6 +197,27 @@ break; } + case I2C_CMD_EXTENSION_SET_GAIN: + { + struct i2c_cmd_extension_gain * cmd = (struct i2c_cmd_extension_gain *) buf; + if (size != sizeof (*cmd)) + goto error; + if (cmd->num == 0) + pid_set_gains(&ext.pid_b, cmd->p, cmd->i, cmd->d); + else + pid_set_gains(&ext.pid_c, cmd->p, cmd->i, cmd->d); + break; + } + + case I2C_CMD_EXTENSION_SET_COLOR: + { + struct i2c_cmd_extension_color * cmd = (struct i2c_cmd_extension_color *) buf; + if (size != sizeof (*cmd)) + goto error; + ext.color = cmd->color; + break; + } + /* Add other commands here ...*/ ============================================= aversive_projects/microb2008/extension/main.c (1.9 -> 1.10) ============================================= @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * Revision : $Id: main.c,v 1.9 2008-01-09 22:24:12 zer0 Exp $ + * Revision : $Id: main.c,v 1.10 2008-02-14 21:53:38 zer0 Exp $ * */ @@ -62,16 +62,9 @@ /* called every 5 ms */ void do_cs(void * dummy) { - static int32_t roller_prev_pos = 0; - int32_t roller_pos; - - /* process roller speed */ - roller_pos = encoders_microb_get_value(ROLLER_ENCODER); - ext.roller_speed = roller_prev_pos - roller_pos; /* sign inverted */ - roller_prev_pos = roller_pos; - - if (ext.flags & ROLLER_CS_ON) - cs_manage(&ext.cs_r); + if (ext.flags & CATAPULT_CS_ON) + cs_manage(&ext.cs_c); + /* bd_manage ? */ if (ext.flags & BARREL_CS_ON) cs_manage(&ext.cs_b); @@ -98,18 +91,12 @@ scheduler_interrupt(); } -int32_t roller_get_speed(void * dummy) -{ - /* invert sign */ - return -ext.roller_speed; -} - int main(void) { /* i/o */ DDRB = (1<<LED5BIT) | (1<<LED6BIT) | (1<<LED7BIT) ; memset(&ext, 0, sizeof(struct ext)); - ext.flags = ROLLER_CS_ON | BARREL_CS_ON; + ext.flags = CATAPULT_CS_ON | BARREL_CS_ON; /* i2c */ i2c_protocol_init(); @@ -132,24 +119,28 @@ scheduler_add_periodical_event_priority(do_cs, NULL, 5000L / SCHEDULER_UNIT, CS_PRIO); + /* multiservo */ // multiservo_init(); /* XXX which timer ? */ - /* CS Roller (speed) */ - pid_init(&ext.pid_r); - pid_set_gains(&ext.pid_r, 500, 5, 0); - pid_set_maximums(&ext.pid_r, 0, 5000, 4095); - pid_set_out_shift(&ext.pid_r, 4); - - cs_init(&ext.cs_r); - cs_set_correct_filter(&ext.cs_r, pid_do_filter, &ext.pid_r); - cs_set_process_in(&ext.cs_r, pwm_set, ROLLER_PWM); - cs_set_process_out(&ext.cs_r, roller_get_speed, NULL); - cs_set_consign(&ext.cs_r, 0); + /* CS Catapult (speed) */ + pid_init(&ext.pid_c); + pid_set_gains(&ext.pid_c, 2000, 0, 0); + pid_set_maximums(&ext.pid_c, 0, 100000, 4095); + pid_set_out_shift(&ext.pid_c, 4); + + ramp_init(&ext.r_c); + ramp_set_vars(&ext.r_c, 2000, 2000); /* set speed */ + + cs_init(&ext.cs_c); + cs_set_correct_filter(&ext.cs_c, pid_do_filter, &ext.pid_c); + cs_set_process_in(&ext.cs_c, pwm_set, CATAPULT_PWM); + cs_set_process_out(&ext.cs_c, encoders_microb_get_value, CATAPULT_ENCODER); + cs_set_consign(&ext.cs_c, 0); /* CS barrel (position) */ pid_init(&ext.pid_b); - pid_set_gains(&ext.pid_b, 2000, 0, 0); + pid_set_gains(&ext.pid_b, 200, 0, 0); pid_set_maximums(&ext.pid_b, 0, 100000, 4095); pid_set_out_shift(&ext.pid_b, 10); pid_set_derivate_filter(&ext.pid_b, 4); ============================================= aversive_projects/microb2008/extension/main.h (1.2 -> 1.3) ============================================= @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * Revision : $Id: main.h,v 1.2 2008-01-09 22:24:12 zer0 Exp $ + * Revision : $Id: main.h,v 1.3 2008-02-14 21:53:38 zer0 Exp $ * */ @@ -28,9 +28,10 @@ #include <ramp.h> struct ext { - /* roller */ - struct cs cs_r; - struct pid_filter pid_r; + /* catapult */ + struct cs cs_c; + struct ramp_filter r_c; + struct pid_filter pid_c; /* barrel */ struct cs cs_b; @@ -42,8 +43,7 @@ uint8_t flags; uint8_t white_ball_count; uint8_t colored_ball_count; - int16_t roller_speed; - + uint8_t color; /* out color */ }; extern struct ext ext; @@ -51,14 +51,14 @@ #define BARREL_PWM ((void *)PWM1B_NUM) #define BARREL_ENCODER ((void *) 0) -#define ROLLER_PWM ((void *)PWM1A_NUM) -#define ROLLER_ENCODER ((void *) 1) +#define CATAPULT_PWM ((void *)PWM1A_NUM) +#define CATAPULT_ENCODER ((void *) 1) /* event priorities (from highest to lowest) */ #define LED_PRIO 170 #define CS_PRIO 150 -#define ROLLER_CS_ON 1 +#define CATAPULT_CS_ON 1 #define BARREL_CS_ON 2 /********************** LEDS */ =================================================== aversive_projects/microb2008/extension/pwm_config.h (1.2 -> 1.3) =================================================== @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * Revision : $Id: pwm_config.h,v 1.2 2008-01-09 22:24:12 zer0 Exp $ + * Revision : $Id: pwm_config.h,v 1.3 2008-02-14 21:53:38 zer0 Exp $ * */ @@ -43,7 +43,7 @@ #define PWM_SIGNIFICANT_BITS 12 #define TIMER1_MODE TIMER_16_MODE_PWM_10 -#define TIMER1_PRESCALE TIMER1_PRESCALER_DIV_1 +#define TIMER1_PRESCALE TIMER1_PRESCALER_DIV_8 #define PWM1A_MODE (PWM_SIGNED) ============================================ aversive_projects/microb2008/main/commands.c (1.10 -> 1.11) ============================================ @@ -22,6 +22,7 @@ #include "eeprom.h" //#include "test.h" #include "sensor.h" +#include "../common/i2c_commands.h" /**********************************************************/ /* Events on/off */ @@ -1804,7 +1805,6 @@ printf_P(PSTR("state=%x white=%d colored=%d\n"), robot.extension_state, robot.white_ball_count, robot.colored_ball_count); - printf_P(PSTR("current roller speed=%d\n"), robot.roller_speed); } prog_char str_extension_arg0[] = "extension"; @@ -1825,67 +1825,67 @@ }; /**********************************************************/ -/* Roller */ +/* Catapult */ -/* this structure is filled when cmd_roller is parsed successfully */ -struct cmd_roller_result { +/* this structure is filled when cmd_catapult is parsed successfully */ +struct cmd_catapult_result { fixed_string_t arg0; fixed_string_t arg1; int16_t arg2; }; -/* function called when cmd_roller is parsed successfully */ -static void cmd_roller_parsed(void * parsed_result, void * data) +/* function called when cmd_catapult is parsed successfully */ +static void cmd_catapult_parsed(void * parsed_result, void * data) { - struct cmd_roller_result *res = (struct cmd_roller_result *) parsed_result; + struct cmd_catapult_result *res = (struct cmd_catapult_result *) parsed_result; if (!strcmp_P(res->arg1, PSTR("speed"))) { - i2c_roller_speed(res->arg2); + i2c_catapult_speed(res->arg2); } - else if (!strcmp_P(res->arg1, PSTR("angle"))) { - i2c_roller_angle(res->arg2); + else if (!strcmp_P(res->arg1, PSTR("pos"))) { + i2c_catapult_pos(res->arg2); } else if (!strcmp_P(res->arg1, PSTR("cs_on"))) { - i2c_roller_cs_on(); + i2c_catapult_cs_on(); } else if (!strcmp_P(res->arg1, PSTR("cs_off"))) { - i2c_roller_cs_off(); + i2c_catapult_cs_off(); } } -prog_char str_roller_arg0[] = "roller"; -parse_pgm_token_string_t cmd_roller_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_roller_result, arg0, str_roller_arg0); -prog_char str_roller_arg1[] = "speed#angle"; -parse_pgm_token_string_t cmd_roller_arg1 = TOKEN_STRING_INITIALIZER(struct cmd_roller_result, arg1, str_roller_arg1); -parse_pgm_token_num_t cmd_roller_arg2 = TOKEN_NUM_INITIALIZER(struct cmd_log_result, arg2, INT16); +prog_char str_catapult_arg0[] = "catapult"; +parse_pgm_token_string_t cmd_catapult_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_catapult_result, arg0, str_catapult_arg0); +prog_char str_catapult_arg1[] = "speed#pos"; +parse_pgm_token_string_t cmd_catapult_arg1 = TOKEN_STRING_INITIALIZER(struct cmd_catapult_result, arg1, str_catapult_arg1); +parse_pgm_token_num_t cmd_catapult_arg2 = TOKEN_NUM_INITIALIZER(struct cmd_log_result, arg2, UINT32); -prog_char help_roller[] = "Set roller speed"; -parse_pgm_inst_t cmd_roller = { - .f = cmd_roller_parsed, /* function to call */ +prog_char help_catapult[] = "Set catapult speed"; +parse_pgm_inst_t cmd_catapult = { + .f = cmd_catapult_parsed, /* function to call */ .data = NULL, /* 2nd arg of func */ - .help_str = help_roller, + .help_str = help_catapult, .tokens = { /* token list, NULL terminated */ - (prog_void *)&cmd_roller_arg0, - (prog_void *)&cmd_roller_arg1, - (prog_void *)&cmd_roller_arg2, + (prog_void *)&cmd_catapult_arg0, + (prog_void *)&cmd_catapult_arg1, + (prog_void *)&cmd_catapult_arg2, NULL, }, }; -prog_char str_roller_arg1_cs[] = "cs_on#cs_off"; -parse_pgm_token_string_t cmd_roller_arg1_cs = TOKEN_STRING_INITIALIZER(struct cmd_roller_result, arg1, str_roller_arg1_cs); +prog_char str_catapult_arg1_cs[] = "cs_on#cs_off"; +parse_pgm_token_string_t cmd_catapult_arg1_cs = TOKEN_STRING_INITIALIZER(struct cmd_catapult_result, arg1, str_catapult_arg1_cs); -prog_char help_roller_cs[] = "Enable/disable roller cs"; -parse_pgm_inst_t cmd_roller_cs = { - .f = cmd_roller_parsed, /* function to call */ +prog_char help_catapult_cs[] = "Enable/disable catapult cs"; +parse_pgm_inst_t cmd_catapult_cs = { + .f = cmd_catapult_parsed, /* function to call */ .data = NULL, /* 2nd arg of func */ - .help_str = help_roller_cs, + .help_str = help_catapult_cs, .tokens = { /* token list, NULL terminated */ - (prog_void *)&cmd_roller_arg0, - (prog_void *)&cmd_roller_arg1_cs, + (prog_void *)&cmd_catapult_arg0, + (prog_void *)&cmd_catapult_arg1_cs, NULL, }, }; @@ -1910,6 +1910,9 @@ if (!strcmp_P(res->arg1, PSTR("pos"))) { i2c_barrel_pos(res->arg2); } + else if (!strcmp_P(res->arg1, PSTR("speed"))) { + i2c_barrel_speed(res->arg2); + } else if (!strcmp_P(res->arg1, PSTR("cs_on"))) { i2c_barrel_cs_on(); } @@ -1920,12 +1923,12 @@ prog_char str_barrel_arg0[] = "barrel"; parse_pgm_token_string_t cmd_barrel_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_barrel_result, arg0, str_barrel_arg0); -prog_char str_barrel_arg1[] = "pos"; +prog_char str_barrel_arg1[] = "pos#speed"; parse_pgm_token_string_t cmd_barrel_arg1 = TOKEN_STRING_INITIALIZER(struct cmd_barrel_result, arg1, str_barrel_arg1); parse_pgm_token_num_t cmd_barrel_arg2 = TOKEN_NUM_INITIALIZER(struct cmd_log_result, arg2, INT32); -prog_char help_barrel[] = "Set barrel position"; +prog_char help_barrel[] = "Set barrel position/speed"; parse_pgm_inst_t cmd_barrel = { .f = cmd_barrel_parsed, /* function to call */ .data = NULL, /* 2nd arg of func */ @@ -1954,6 +1957,44 @@ }, }; +/**********************************************************/ +/* Color */ + +/* this structure is filled when cmd_color is parsed successfully */ +struct cmd_color_result { + fixed_string_t arg0; + fixed_string_t color; +}; + +/* function called when cmd_color is parsed successfully */ +static void cmd_color_parsed(void * parsed_result, void * data) +{ + struct cmd_color_result *res = (struct cmd_color_result *) parsed_result; + if (!strcmp_P(res->color, PSTR("red"))) { + i2c_set_color(I2C_EXTENSION_COLOR_RED); + } + else if (!strcmp_P(res->color, PSTR("blue"))) { + i2c_set_color(I2C_EXTENSION_COLOR_RED); + } + printf_P("Done\n"); +} + +prog_char str_color_arg0[] = "color"; +parse_pgm_token_string_t cmd_color_arg0 = TOKEN_STRING_INITIALIZER(struct cmd_color_result, arg0, str_color_arg0); +prog_char str_color_color[] = "blue#red"; +parse_pgm_token_string_t cmd_color_color = TOKEN_STRING_INITIALIZER(struct cmd_color_result, color, str_color_color); + +prog_char help_color[] = "Set our color"; +parse_pgm_inst_t cmd_color = { + .f = cmd_color_parsed, /* function to call */ + .data = NULL, /* 2nd arg of func */ + .help_str = help_color, + .tokens = { /* token list, NULL terminated */ + (prog_void *)&cmd_color_arg0, + (prog_void *)&cmd_color_color, + NULL, + }, +}; /**********************************************************/ @@ -2000,9 +2041,10 @@ (parse_pgm_inst_t *)&cmd_opponent, (parse_pgm_inst_t *)&cmd_opponent_set, (parse_pgm_inst_t *)&cmd_extension, - (parse_pgm_inst_t *)&cmd_roller, - (parse_pgm_inst_t *)&cmd_roller_cs, + (parse_pgm_inst_t *)&cmd_catapult, + (parse_pgm_inst_t *)&cmd_catapult_cs, (parse_pgm_inst_t *)&cmd_barrel, (parse_pgm_inst_t *)&cmd_barrel_cs, + (parse_pgm_inst_t *)&cmd_color, NULL, }; ================================================ aversive_projects/microb2008/main/i2c_protocol.c (1.9 -> 1.10) ================================================ @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * Revision : $Id: i2c_protocol.c,v 1.9 2008-01-11 23:26:58 zer0 Exp $ + * Revision : $Id: i2c_protocol.c,v 1.10 2008-02-14 21:53:38 zer0 Exp $ * */ @@ -191,7 +191,6 @@ robot.extension_state = ans->state; robot.white_ball_count = ans->white_ball_count; robot.colored_ball_count = ans->colored_ball_count; - robot.roller_speed = ans->roller_speed; break; } @@ -255,6 +254,18 @@ i2c_send_command((uint8_t*)&buf, sizeof(buf)); } +/* XXX todo in extension, and add in cmdline */ +void i2c_set_gains(uint8_t num, uint16_t p, uint16_t i, uint16_t d) +{ + struct i2c_cmd_extension_gain buf; + buf.hdr.cmd = I2C_CMD_EXTENSION_SET_GAIN; + buf.num = num; + buf.p = p; + buf.i = i; + buf.d = d; + i2c_send_command((uint8_t*)&buf, sizeof(buf)); +} + void i2c_harvest(void) { struct i2c_cmd_extension buf; @@ -279,57 +290,53 @@ i2c_send_command((uint8_t*)&buf, sizeof(buf)); } -void i2c_prepare_white(int16_t roller_speed, uint8_t roller_angle) +void i2c_prepare_white(void) { struct i2c_cmd_extension buf; buf.hdr.cmd = I2C_CMD_EXTENSION_CONTROL; buf.cmd = I2C_EXTENSION_COMMAND_PREPARE_WHITE; - buf.u.s.roller_speed = roller_speed; - buf.u.s.roller_angle = roller_angle; i2c_send_command((uint8_t*)&buf, sizeof(buf)); } -void i2c_prepare_colored(int16_t roller_speed, uint8_t roller_angle) +void i2c_prepare_colored(void) { struct i2c_cmd_extension buf; buf.hdr.cmd = I2C_CMD_EXTENSION_CONTROL; buf.cmd = I2C_EXTENSION_COMMAND_PREPARE_COLORED; - buf.u.s.roller_speed = roller_speed; - buf.u.s.roller_angle = roller_angle; i2c_send_command((uint8_t*)&buf, sizeof(buf)); } -void i2c_roller_speed(int16_t roller_speed) +void i2c_catapult_speed(int32_t catapult_speed) { struct i2c_cmd_extension buf; buf.hdr.cmd = I2C_CMD_EXTENSION_CONTROL; - buf.cmd = I2C_EXTENSION_COMMAND_ROLLER_SPEED; - buf.u.s.roller_speed = roller_speed; + buf.cmd = I2C_EXTENSION_COMMAND_CATAPULT_SPEED; + buf.u.speed = catapult_speed; i2c_send_command((uint8_t*)&buf, sizeof(buf)); } -void i2c_roller_angle(uint8_t roller_angle) +void i2c_catapult_pos(uint32_t catapult_pos) { struct i2c_cmd_extension buf; buf.hdr.cmd = I2C_CMD_EXTENSION_CONTROL; - buf.cmd = I2C_EXTENSION_COMMAND_ROLLER_ANGLE; - buf.u.s.roller_angle = roller_angle; + buf.cmd = I2C_EXTENSION_COMMAND_CATAPULT_POS; + buf.u.pos = catapult_pos; i2c_send_command((uint8_t*)&buf, sizeof(buf)); } -void i2c_roller_cs_on(void) +void i2c_catapult_cs_on(void) { struct i2c_cmd_extension buf; buf.hdr.cmd = I2C_CMD_EXTENSION_CONTROL; - buf.cmd = I2C_EXTENSION_COMMAND_ROLLER_CS_ON; + buf.cmd = I2C_EXTENSION_COMMAND_CATAPULT_CS_ON; i2c_send_command((uint8_t*)&buf, sizeof(buf)); } -void i2c_roller_cs_off(void) +void i2c_catapult_cs_off(void) { struct i2c_cmd_extension buf; buf.hdr.cmd = I2C_CMD_EXTENSION_CONTROL; - buf.cmd = I2C_EXTENSION_COMMAND_ROLLER_CS_OFF; + buf.cmd = I2C_EXTENSION_COMMAND_CATAPULT_CS_OFF; i2c_send_command((uint8_t*)&buf, sizeof(buf)); } @@ -338,7 +345,16 @@ struct i2c_cmd_extension buf; buf.hdr.cmd = I2C_CMD_EXTENSION_CONTROL; buf.cmd = I2C_EXTENSION_COMMAND_BARREL_POS; - buf.u.barrel_pos = barrel_pos; + buf.u.pos = barrel_pos; + i2c_send_command((uint8_t*)&buf, sizeof(buf)); +} + +void i2c_barrel_speed(int32_t barrel_speed) +{ + struct i2c_cmd_extension buf; + buf.hdr.cmd = I2C_CMD_EXTENSION_CONTROL; + buf.cmd = I2C_EXTENSION_COMMAND_BARREL_SPEED; + buf.u.speed = barrel_speed; i2c_send_command((uint8_t*)&buf, sizeof(buf)); } @@ -358,6 +374,14 @@ i2c_send_command((uint8_t*)&buf, sizeof(buf)); } +void i2c_set_color(uint8_t color) +{ + struct i2c_cmd_extension_color buf; + buf.hdr.cmd = I2C_CMD_EXTENSION_SET_COLOR; + buf.color = color; + i2c_send_command((uint8_t*)&buf, sizeof(buf)); +} + /******/ int8_t i2c_req_read_debug_buffer(void) ================================================ aversive_projects/microb2008/main/i2c_protocol.h (1.5 -> 1.6) ================================================ @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * Revision : $Id: i2c_protocol.h,v 1.5 2008-01-09 22:24:45 zer0 Exp $ + * Revision : $Id: i2c_protocol.h,v 1.6 2008-02-14 21:53:38 zer0 Exp $ * */ @@ -44,15 +44,18 @@ void i2c_harvest(void); void i2c_pickup(void); void i2c_drop(void); -void i2c_prepare_white(int16_t roller_speed, uint8_t roller_angle); -void i2c_prepare_colored(int16_t roller_speed, uint8_t roller_angle); -void i2c_roller_speed(int16_t roller_speed); -void i2c_roller_angle(uint8_t roller_angle); -void i2c_roller_cs_on(void); -void i2c_roller_cs_off(void); +void i2c_prepare_white(void); +void i2c_prepare_colored(void); +void i2c_catapult_speed(int32_t catapult_speed); +void i2c_catapult_pos(uint32_t catapult_pos); +void i2c_catapult_cs_on(void); +void i2c_catapult_cs_off(void); void i2c_barrel_pos(int32_t barrel_pos); +void i2c_barrel_speed(int32_t barrel_speed); void i2c_barrel_cs_on(void); void i2c_barrel_cs_off(void); +void i2c_set_gains(uint8_t num, uint16_t p, uint16_t i, uint16_t d); +void i2c_set_color(uint8_t color); int8_t i2c_req_extension_status(void); #endif ======================================== aversive_projects/microb2008/main/main.c (1.16 -> 1.17) ======================================== @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * Revision : $Id: main.c,v 1.16 2008-01-09 22:24:45 zer0 Exp $ + * Revision : $Id: main.c,v 1.17 2008-02-14 21:53:38 zer0 Exp $ * */ @@ -349,6 +349,16 @@ int c; const char * history; + DDRB=0x10; + + while(1) { + PORTB=0x10; + wait_ms(100); + PORTB=0x00; + wait_ms(100); + } + + /* init struct robot */ memset(&robot, 0, sizeof(struct robot)); robot.cs_events = DO_CS | DO_RS | DO_POS | DO_BD | DO_POWER; Commit from zer0 (2008-02-15 00:00 CET) ================ prepare barrel helpers aversive_projects microb2008/extension/Makefile 1.4 aversive_projects microb2008/extension/i2c_protocol.c 1.9 aversive_projects microb2008/extension/main.c 1.11 aversive_projects microb2008/extension/main.h 1.4 =============================================== aversive_projects/microb2008/extension/Makefile (1.3 -> 1.4) =============================================== @@ -5,7 +5,7 @@ CFLAGS+=-Werror # List C source files here. (C dependencies are automatically generated.) -SRC = $(TARGET).c i2c_protocol.c +SRC = $(TARGET).c i2c_protocol.c barrel.c catapult.c # List Assembler source files here. # Make them always end in a capital .S. Files ending in a lowercase .s ===================================================== aversive_projects/microb2008/extension/i2c_protocol.c (1.8 -> 1.9) ===================================================== @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * Revision : $Id: i2c_protocol.c,v 1.8 2008-02-14 21:53:38 zer0 Exp $ + * Revision : $Id: i2c_protocol.c,v 1.9 2008-02-14 23:00:04 zer0 Exp $ * */ @@ -24,12 +24,13 @@ #include <aversive.h> #include <aversive/list.h> +#include <cirbuf.h> #include <i2c.h> #include <pwm.h> #include <control_system_manager.h> -#include <cirbuf.h> #include "main.h" +#include "barrel.h" #include "../common/i2c_commands.h" /** The emission fifo of debug */ @@ -143,8 +144,8 @@ i2c_flush(); ans.hdr.cmd = I2C_ANS_EXTENSION_STATUS; ans.state = ext.state; - ans.white_ball_count = ext.white_ball_count; - ans.colored_ball_count = ext.colored_ball_count; + ans.white_ball_count = barrel_state.white_ball_count; + ans.colored_ball_count = barrel_state.colored_ball_count; /* XXX check return value. To wait is stupid because we are called with irq disabled */ i2c_send(I2C_ADD_MASTER, (uint8_t *) &ans, sizeof(ans), I2C_CTRL_GENERIC); ============================================= aversive_projects/microb2008/extension/main.c (1.10 -> 1.11) ============================================= @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * Revision : $Id: main.c,v 1.10 2008-02-14 21:53:38 zer0 Exp $ + * Revision : $Id: main.c,v 1.11 2008-02-14 23:00:04 zer0 Exp $ * */ @@ -30,14 +30,13 @@ #include <scheduler.h> #include <i2c.h> -#include <pwm.h> -#include <pid.h> -#include <ramp.h> -#include <control_system_manager.h> #include <timer.h> +#include <pwm.h> #include <encoders_microb.h> #include "main.h" +#include "barrel.h" +#include "catapult.h" #include "i2c_protocol.h" #include "../common/i2c_commands.h" @@ -123,40 +122,8 @@ /* multiservo */ // multiservo_init(); /* XXX which timer ? */ - /* CS Catapult (speed) */ - pid_init(&ext.pid_c); - pid_set_gains(&ext.pid_c, 2000, 0, 0); - pid_set_maximums(&ext.pid_c, 0, 100000, 4095); - pid_set_out_shift(&ext.pid_c, 4); - - ramp_init(&ext.r_c); - ramp_set_vars(&ext.r_c, 2000, 2000); /* set speed */ - - cs_init(&ext.cs_c); - cs_set_correct_filter(&ext.cs_c, pid_do_filter, &ext.pid_c); - cs_set_process_in(&ext.cs_c, pwm_set, CATAPULT_PWM); - cs_set_process_out(&ext.cs_c, encoders_microb_get_value, CATAPULT_ENCODER); - cs_set_consign(&ext.cs_c, 0); - - /* CS barrel (position) */ - pid_init(&ext.pid_b); - pid_set_gains(&ext.pid_b, 200, 0, 0); - pid_set_maximums(&ext.pid_b, 0, 100000, 4095); - pid_set_out_shift(&ext.pid_b, 10); - pid_set_derivate_filter(&ext.pid_b, 4); - - ramp_init(&ext.r_b); - ramp_set_vars(&ext.r_b, 200, 200); /* set speed */ - - cs_init(&ext.cs_b); - cs_set_consign_filter(&ext.cs_b, ramp_do_filter, &ext.r_b); - cs_set_correct_filter(&ext.cs_b, pid_do_filter, &ext.pid_b); - cs_set_process_in(&ext.cs_b, pwm_set, BARREL_PWM); - cs_set_process_out(&ext.cs_b, encoders_microb_get_value, BARREL_ENCODER); - cs_set_consign(&ext.cs_b, 0); - - bd_init(&ext.bd_b, &ext.cs_b); - bd_set_thresholds(&ext.bd_b, 300, 300, 20); + barrel_init(); + catapult_init(); /* debug via i2c (um zu gut zu machen) */ fdevopen(debug_send, NULL); ============================================= aversive_projects/microb2008/extension/main.h (1.3 -> 1.4) ============================================= @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * Revision : $Id: main.h,v 1.3 2008-02-14 21:53:38 zer0 Exp $ + * Revision : $Id: main.h,v 1.4 2008-02-14 23:00:04 zer0 Exp $ * */ @@ -41,8 +41,6 @@ uint8_t state; uint8_t flags; - uint8_t white_ball_count; - uint8_t colored_ball_count; uint8_t color; /* out color */ }; _______________________________________________ Avr-list mailing list Avr-list@droids-corp.org CVSWEB : http://cvsweb.droids-corp.org/cgi-bin/viewcvs.cgi/aversive WIKI : http://wiki.droids-corp.org/index.php/Aversive DOXYGEN : http://zer0.droids-corp.org/doxygen_aversive/html/ BUGZILLA : http://bugzilla.droids-corp.org COMMIT LOGS : http://zer0.droids-corp.org/aversive_commitlog