From: Olivier Matz Date: Sat, 20 Feb 2010 17:34:52 +0000 (+0100) Subject: addremove X-Git-Url: http://git.droids-corp.org/?p=aversive.git;a=commitdiff_plain;h=aeae9ffbe911b68824da692179a990e8e358a994 addremove --- diff --git a/modules/base/math/geometry/polygon.c b/modules/base/math/geometry/polygon.c index 9eef11e..53db064 100755 --- a/modules/base/math/geometry/polygon.c +++ b/modules/base/math/geometry/polygon.c @@ -314,8 +314,8 @@ calc_rays(poly_t *polys, uint8_t npolys, uint8_t *rays) * possiblity path: If we have 3 checpoint aligned in a path (say A, * B, C) the algorithm will prefer (A, C) instead of (A, B, C) */ void -calc_rays_weight(poly_t *polys, uint8_t npolys, uint8_t *rays, - uint8_t ray_n, uint16_t *weight) +calc_rays_weight(poly_t *polys, __attribute__((unused)) uint8_t npolys, + uint8_t *rays, uint8_t ray_n, uint16_t *weight) { uint8_t i; vect_t v; diff --git a/modules/base/math/geometry/vect_base.c b/modules/base/math/geometry/vect_base.c index 9ea271d..b8b0d31 100755 --- a/modules/base/math/geometry/vect_base.c +++ b/modules/base/math/geometry/vect_base.c @@ -59,12 +59,12 @@ vect_pvect_sign(vect_t *v, vect_t *w) return z>0?1:-1; } -/* float norm(float x1, float y1, float x2, float y2) */ -/* { */ -/* float x = x2 - x1; */ -/* float y = y2 - y1; */ -/* return sqrt(x*x + y*y); */ -/* } */ +float xy_norm(float x1, float y1, float x2, float y2) +{ + float x = x2 - x1; + float y = y2 - y1; + return sqrt(x*x + y*y); +} float pt_norm(point_t *p1, point_t *p2) { diff --git a/modules/base/math/geometry/vect_base.h b/modules/base/math/geometry/vect_base.h index e46c840..de3a2c2 100755 --- a/modules/base/math/geometry/vect_base.h +++ b/modules/base/math/geometry/vect_base.h @@ -49,7 +49,7 @@ int8_t vect_pvect_sign(vect_t *v, vect_t *w); /* norm of a vector */ -//float norm(float x1, float y1, float x2, float y2); +float xy_norm(float x1, float y1, float x2, float y2); float pt_norm(point_t *p1, point_t *p2); float vect_norm(vect_t *v); void vect_rot_trigo(vect_t *v); diff --git a/projects/microb2010/tests/beacon_tsop/.config b/projects/microb2010/tests/beacon_tsop/.config index 94eb57b..53256cb 100644 --- a/projects/microb2010/tests/beacon_tsop/.config +++ b/projects/microb2010/tests/beacon_tsop/.config @@ -65,8 +65,8 @@ CONFIG_MATH_LIB=y # CONFIG_FDEVOPEN_COMPAT is not set # CONFIG_NO_PRINTF is not set # CONFIG_MINIMAL_PRINTF is not set -CONFIG_STANDARD_PRINTF=y -# CONFIG_ADVANCED_PRINTF is not set +# CONFIG_STANDARD_PRINTF is not set +CONFIG_ADVANCED_PRINTF=y # CONFIG_FORMAT_IHEX is not set # CONFIG_FORMAT_SREC is not set CONFIG_FORMAT_BINARY=y diff --git a/projects/microb2010/tests/beacon_tsop/Makefile b/projects/microb2010/tests/beacon_tsop/Makefile index 6d98f23..8b3940d 100755 --- a/projects/microb2010/tests/beacon_tsop/Makefile +++ b/projects/microb2010/tests/beacon_tsop/Makefile @@ -16,7 +16,7 @@ ASRC = AVRDUDE_DELAY=30 -CFLAGS += -W +CFLAGS += -W -Wall -Werror ######################################## diff --git a/projects/microb2010/tests/beacon_tsop/commands.c b/projects/microb2010/tests/beacon_tsop/commands.c index 8a98f49..253c886 100644 --- a/projects/microb2010/tests/beacon_tsop/commands.c +++ b/projects/microb2010/tests/beacon_tsop/commands.c @@ -32,7 +32,11 @@ #include #include #include +#include +#include +#include +#include "trigo.h" #include "main.h" /**********************************************************/ @@ -158,7 +162,24 @@ struct cmd_test_result { static void cmd_test_parsed(__attribute__((unused)) void *parsed_result, __attribute__((unused)) void *data) { + point_t pos; + double a01 = 1.65; + double a12 = 2.12; + double a20 = 2.53; + uint16_t time1, time2; + cli(); + time1 = TCNT3; + sei(); + + if (angles_to_posxy(&pos, a01, a12, a20) < 0) + printf_P(PSTR("error\n")); + + cli(); + time2 = TCNT3; + sei(); + + printf_P(PSTR("%2.2f %2.2f (t=%d)\n"), pos.x, pos.y, time2-time1); } prog_char str_test_arg0[] = "test"; diff --git a/projects/microb2010/tests/beacon_tsop/trigo.c b/projects/microb2010/tests/beacon_tsop/trigo.c index 932bb42..391043c 100644 --- a/projects/microb2010/tests/beacon_tsop/trigo.c +++ b/projects/microb2010/tests/beacon_tsop/trigo.c @@ -102,14 +102,14 @@ int8_t angle_to_circles(circle_t *c1, circle_t *c2, if (c1) { c1->x = O.x + v.x; c1->y = O.y + v.y; - c1->r = norm(b1->x, b1->y, c1->x, c1->y); + c1->r = xy_norm(b1->x, b1->y, c1->x, c1->y); } /* get the circle c2 */ if (c2) { c2->x = O.x - v.x; c2->y = O.y - v.y; - c2->r = norm(b1->x, b1->y, c1->x, c1->y); + c2->r = xy_norm(b1->x, b1->y, c1->x, c1->y); } return 0; @@ -148,9 +148,9 @@ int8_t angles_to_posxy(point_t *pos, double a01, double a12, double a20) dprintf("p2: x=%2.2f y=%2.2f\n", p2.x, p2.y); dprintf("p3: x=%2.2f y=%2.2f\n", p3.x, p3.y); - /* if (norm(p1.x, p1.y, p2.x, p2.y) > POS_ACCURACY || */ - /* norm(p2.x, p2.y, p3.x, p3.y) > POS_ACCURACY || */ - /* norm(p3.x, p3.y, p1.x, p1.y) > POS_ACCURACY) */ + /* if (xy_norm(p1.x, p1.y, p2.x, p2.y) > POS_ACCURACY || */ + /* xy_norm(p2.x, p2.y, p3.x, p3.y) > POS_ACCURACY || */ + /* xy_norm(p3.x, p3.y, p1.x, p1.y) > POS_ACCURACY) */ /* return -1; */ pos->x = (p1.x + p2.x + p3.x) / 3.0; diff --git a/projects/microb2010/tests/static_beacon/.config.old b/projects/microb2010/tests/static_beacon/.config.old deleted file mode 100644 index b0dbf0d..0000000 --- a/projects/microb2010/tests/static_beacon/.config.old +++ /dev/null @@ -1,251 +0,0 @@ -# -# Automatically generated by make menuconfig: don't edit -# - -# -# Hardware -# -# CONFIG_MCU_AT90S2313 is not set -# CONFIG_MCU_AT90S2323 is not set -# CONFIG_MCU_AT90S3333 is not set -# CONFIG_MCU_AT90S2343 is not set -# CONFIG_MCU_ATTINY22 is not set -# CONFIG_MCU_ATTINY26 is not set -# CONFIG_MCU_AT90S4414 is not set -# CONFIG_MCU_AT90S4433 is not set -# CONFIG_MCU_AT90S4434 is not set -# CONFIG_MCU_AT90S8515 is not set -# CONFIG_MCU_AT90S8534 is not set -# CONFIG_MCU_AT90S8535 is not set -# CONFIG_MCU_AT86RF401 is not set -# CONFIG_MCU_ATMEGA103 is not set -# CONFIG_MCU_ATMEGA603 is not set -# CONFIG_MCU_AT43USB320 is not set -# CONFIG_MCU_AT43USB355 is not set -# CONFIG_MCU_AT76C711 is not set -CONFIG_MCU_ATMEGA8=y -# CONFIG_MCU_ATMEGA48 is not set -# CONFIG_MCU_ATMEGA88 is not set -# CONFIG_MCU_ATMEGA8515 is not set -# CONFIG_MCU_ATMEGA8535 is not set -# CONFIG_MCU_ATTINY13 is not set -# CONFIG_MCU_ATTINY2313 is not set -# CONFIG_MCU_ATMEGA16 is not set -# CONFIG_MCU_ATMEGA161 is not set -# CONFIG_MCU_ATMEGA162 is not set -# CONFIG_MCU_ATMEGA163 is not set -# CONFIG_MCU_ATMEGA165 is not set -# CONFIG_MCU_ATMEGA168 is not set -# CONFIG_MCU_ATMEGA169 is not set -# CONFIG_MCU_ATMEGA32 is not set -# CONFIG_MCU_ATMEGA323 is not set -# CONFIG_MCU_ATMEGA325 is not set -# CONFIG_MCU_ATMEGA3250 is not set -# CONFIG_MCU_ATMEGA64 is not set -# CONFIG_MCU_ATMEGA645 is not set -# CONFIG_MCU_ATMEGA6450 is not set -# CONFIG_MCU_ATMEGA128 is not set -# CONFIG_MCU_ATMEGA1281 is not set -# CONFIG_MCU_AT90CAN128 is not set -# CONFIG_MCU_AT94K is not set -# CONFIG_MCU_AT90S1200 is not set -# CONFIG_MCU_ATMEGA2560 is not set -# CONFIG_MCU_ATMEGA256 is not set -CONFIG_QUARTZ=16000000 - -# -# Generation options -# -# CONFIG_OPTM_0 is not set -# CONFIG_OPTM_1 is not set -# CONFIG_OPTM_2 is not set -# CONFIG_OPTM_3 is not set -CONFIG_OPTM_S=y -# CONFIG_MATH_LIB is not set -# CONFIG_FDEVOPEN_COMPAT is not set -# CONFIG_NO_PRINTF is not set -# CONFIG_MINIMAL_PRINTF is not set -CONFIG_STANDARD_PRINTF=y -# CONFIG_FORMAT_IHEX is not set -# CONFIG_FORMAT_SREC is not set -CONFIG_FORMAT_BINARY=y - -# -# Base modules -# -CONFIG_MODULE_CIRBUF=y -# CONFIG_MODULE_CIRBUF_LARGE is not set -# CONFIG_MODULE_FIXED_POINT is not set -# CONFIG_MODULE_VECT2 is not set -# CONFIG_MODULE_GEOMETRY is not set -# CONFIG_MODULE_SCHEDULER is not set -# CONFIG_MODULE_SCHEDULER_STATS is not set -# CONFIG_MODULE_SCHEDULER_CREATE_CONFIG is not set -# CONFIG_MODULE_SCHEDULER_USE_TIMERS is not set -CONFIG_MODULE_SCHEDULER_TIMER0=y -# CONFIG_MODULE_SCHEDULER_MANUAL is not set -# CONFIG_MODULE_TIME is not set -# CONFIG_MODULE_TIME_CREATE_CONFIG is not set -# CONFIG_MODULE_TIME_EXT is not set -# CONFIG_MODULE_TIME_EXT_CREATE_CONFIG is not set - -# -# Communication modules -# -CONFIG_MODULE_UART=y -# CONFIG_MODULE_UART_9BITS is not set -CONFIG_MODULE_UART_CREATE_CONFIG=y -# CONFIG_MODULE_SPI is not set -# CONFIG_MODULE_SPI_CREATE_CONFIG is not set -# CONFIG_MODULE_I2C is not set -# CONFIG_MODULE_I2C_MASTER is not set -# CONFIG_MODULE_I2C_MULTIMASTER is not set -# CONFIG_MODULE_I2C_CREATE_CONFIG is not set -# CONFIG_MODULE_MF2_CLIENT is not set -# CONFIG_MODULE_MF2_CLIENT_USE_SCHEDULER is not set -# CONFIG_MODULE_MF2_CLIENT_CREATE_CONFIG is not set -# CONFIG_MODULE_MF2_SERVER is not set -# CONFIG_MODULE_MF2_SERVER_CREATE_CONFIG is not set - -# -# Hardware modules -# -# CONFIG_MODULE_TIMER is not set -# CONFIG_MODULE_TIMER_CREATE_CONFIG is not set -# CONFIG_MODULE_TIMER_DYNAMIC is not set -# CONFIG_MODULE_PWM is not set -# CONFIG_MODULE_PWM_CREATE_CONFIG is not set -# CONFIG_MODULE_PWM_NG is not set -# CONFIG_MODULE_ADC is not set -# CONFIG_MODULE_ADC_CREATE_CONFIG is not set - -# -# IHM modules -# -# CONFIG_MODULE_MENU is not set -# CONFIG_MODULE_VT100 is not set -# CONFIG_MODULE_RDLINE is not set -# CONFIG_MODULE_RDLINE_CREATE_CONFIG is not set -# CONFIG_MODULE_RDLINE_KILL_BUF is not set -# CONFIG_MODULE_RDLINE_HISTORY is not set -# CONFIG_MODULE_PARSE is not set -# CONFIG_MODULE_PARSE_NO_FLOAT is not set - -# -# External devices modules -# -# CONFIG_MODULE_LCD is not set -# CONFIG_MODULE_LCD_CREATE_CONFIG is not set -# CONFIG_MODULE_MULTISERVO is not set -# CONFIG_MODULE_MULTISERVO_CREATE_CONFIG is not set -# CONFIG_MODULE_AX12 is not set -# CONFIG_MODULE_AX12_CREATE_CONFIG is not set - -# -# Brushless motor drivers (you should enable pwm modules to see all) -# -# CONFIG_MODULE_BRUSHLESS_3PHASE_DIGITAL_HALL is not set -# CONFIG_MODULE_BRUSHLESS_3PHASE_DIGITAL_HALL_CREATE_CONFIG is not set -# CONFIG_MODULE_BRUSHLESS_3PHASE_DIGITAL_HALL_DOUBLE is not set -# CONFIG_MODULE_BRUSHLESS_3PHASE_DIGITAL_HALL_DOUBLE_CREATE_CONFIG is not set - -# -# Encoders (you need comm/spi for encoders_spi) -# -# CONFIG_MODULE_ENCODERS_MICROB is not set -# CONFIG_MODULE_ENCODERS_MICROB_CREATE_CONFIG is not set -# CONFIG_MODULE_ENCODERS_EIRBOT is not set -# CONFIG_MODULE_ENCODERS_EIRBOT_CREATE_CONFIG is not set -# CONFIG_MODULE_ENCODERS_SPI is not set -# CONFIG_MODULE_ENCODERS_SPI_CREATE_CONFIG is not set - -# -# Robot specific modules -# -# CONFIG_MODULE_ROBOT_SYSTEM is not set -# CONFIG_MODULE_ROBOT_SYSTEM_MOT_AND_EXT is not set -# CONFIG_MODULE_POSITION_MANAGER is not set -# CONFIG_MODULE_COMPENSATE_CENTRIFUGAL_FORCE is not set -# CONFIG_MODULE_TRAJECTORY_MANAGER is not set -# CONFIG_MODULE_BLOCKING_DETECTION_MANAGER is not set -# CONFIG_MODULE_OBSTACLE_AVOIDANCE is not set -# CONFIG_MODULE_OBSTACLE_AVOIDANCE_CREATE_CONFIG is not set - -# -# Control system modules -# -# CONFIG_MODULE_CONTROL_SYSTEM_MANAGER is not set -# CONFIG_MODULE_PID is not set -# CONFIG_MODULE_PID_CREATE_CONFIG is not set -# CONFIG_MODULE_RAMP is not set -# CONFIG_MODULE_QUADRAMP is not set -# CONFIG_MODULE_QUADRAMP_DERIVATE is not set -# CONFIG_MODULE_BIQUAD is not set - -# -# Radio devices -# -# CONFIG_MODULE_CC2420 is not set -# CONFIG_MODULE_CC2420_CREATE_CONFIG is not set - -# -# Crypto modules -# -# CONFIG_MODULE_AES is not set -# CONFIG_MODULE_AES_CTR is not set -# CONFIG_MODULE_MD5 is not set -# CONFIG_MODULE_MD5_HMAC is not set -# CONFIG_MODULE_RC4 is not set - -# -# Encodings modules -# -# CONFIG_MODULE_BASE64 is not set -# CONFIG_MODULE_HAMMING is not set - -# -# Debug modules -# -# CONFIG_MODULE_DIAGNOSTIC is not set -# CONFIG_MODULE_DIAGNOSTIC_CREATE_CONFIG is not set -# CONFIG_MODULE_ERROR is not set -# CONFIG_MODULE_ERROR_CREATE_CONFIG is not set - -# -# Programmer options -# -CONFIG_AVRDUDE=y -# CONFIG_AVARICE is not set - -# -# Avrdude -# -# CONFIG_AVRDUDE_PROG_FUTURELEC is not set -# CONFIG_AVRDUDE_PROG_ABCMINI is not set -# CONFIG_AVRDUDE_PROG_PICOWEB is not set -# CONFIG_AVRDUDE_PROG_SP12 is not set -# CONFIG_AVRDUDE_PROG_ALF is not set -# CONFIG_AVRDUDE_PROG_BASCOM is not set -# CONFIG_AVRDUDE_PROG_DT006 is not set -# CONFIG_AVRDUDE_PROG_PONY_STK200 is not set -CONFIG_AVRDUDE_PROG_STK200=y -# CONFIG_AVRDUDE_PROG_PAVR is not set -# CONFIG_AVRDUDE_PROG_BUTTERFLY is not set -# CONFIG_AVRDUDE_PROG_AVR910 is not set -# CONFIG_AVRDUDE_PROG_STK500 is not set -# CONFIG_AVRDUDE_PROG_AVRISP is not set -# CONFIG_AVRDUDE_PROG_BSD is not set -# CONFIG_AVRDUDE_PROG_DAPA is not set -# CONFIG_AVRDUDE_PROG_JTAG1 is not set -# CONFIG_AVRDUDE_PROG_AVR109 is not set -CONFIG_AVRDUDE_PORT="/dev/parport0" -CONFIG_AVRDUDE_BAUDRATE=19200 - -# -# Avarice -# -CONFIG_AVARICE_PORT="/dev/ttyS0" -CONFIG_AVARICE_DEBUG_PORT=1234 -CONFIG_AVARICE_PROG_MKI=y -# CONFIG_AVARICE_PROG_MKII is not set -# CONFIG_AVRDUDE_CHECK_SIGNATURE is not set diff --git a/projects/microb2010/tests/static_beacon/uart_config.h b/projects/microb2010/tests/static_beacon/uart_config.h new file mode 100644 index 0000000..67cb785 --- /dev/null +++ b/projects/microb2010/tests/static_beacon/uart_config.h @@ -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.3.10.1 2006-11-26 21:06:02 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 38400 + +/* + * 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 +