oa 2010
authorzer0 <zer0@carbon.local>
Sat, 19 Dec 2009 18:37:15 +0000 (19:37 +0100)
committerzer0 <zer0@carbon.local>
Sat, 19 Dec 2009 18:37:15 +0000 (19:37 +0100)
projects/microb2010/tests/oa/.config [new file with mode: 0644]
projects/microb2010/tests/oa/.config.old [new file with mode: 0644]
projects/microb2010/tests/oa/.gdb_history [new file with mode: 0644]
projects/microb2010/tests/oa/Makefile [new file with mode: 0644]
projects/microb2010/tests/oa/error_config.h [new file with mode: 0644]
projects/microb2010/tests/oa/graph.py [new file with mode: 0644]
projects/microb2010/tests/oa/main.c [new file with mode: 0644]
projects/microb2010/tests/oa/obstacle_avoidance_config.h [new file with mode: 0644]

diff --git a/projects/microb2010/tests/oa/.config b/projects/microb2010/tests/oa/.config
new file mode 100644 (file)
index 0000000..046653a
--- /dev/null
@@ -0,0 +1,252 @@
+#
+# 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 is not set
+# 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=y
+# 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=12000000
+
+#
+# Generation options
+#
+CONFIG_OPTM_0=y
+# CONFIG_OPTM_1 is not set
+# CONFIG_OPTM_2 is not set
+# CONFIG_OPTM_3 is not set
+# CONFIG_OPTM_S is not set
+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_FORMAT_IHEX=y
+# CONFIG_FORMAT_SREC is not set
+# CONFIG_FORMAT_BINARY is not set
+
+#
+# Base modules
+#
+# CONFIG_MODULE_CIRBUF is not set
+# CONFIG_MODULE_CIRBUF_LARGE is not set
+# CONFIG_MODULE_FIXED_POINT is not set
+# CONFIG_MODULE_VECT2 is not set
+CONFIG_MODULE_GEOMETRY=y
+# 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 is not set
+# CONFIG_MODULE_UART_9BITS is not set
+# CONFIG_MODULE_UART_CREATE_CONFIG is not set
+# 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=y
+CONFIG_MODULE_OBSTACLE_AVOIDANCE_CREATE_CONFIG=y
+
+#
+# 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=y
+CONFIG_MODULE_ERROR_CREATE_CONFIG=y
+
+#
+# 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/oa/.config.old b/projects/microb2010/tests/oa/.config.old
new file mode 100644 (file)
index 0000000..112f126
--- /dev/null
@@ -0,0 +1,280 @@
+#
+# Automatically generated make config: 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 is not set
+# 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=y
+# 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=12000000
+
+#
+# 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=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_FORMAT_IHEX=y
+# CONFIG_FORMAT_SREC is not set
+# CONFIG_FORMAT_BINARY is not set
+
+#
+# Base modules
+#
+
+#
+# Enable math library in generation options to see all modules
+#
+# CONFIG_MODULE_CIRBUF is not set
+# CONFIG_MODULE_CIRBUF_LARGE is not set
+# CONFIG_MODULE_FIXED_POINT is not set
+# CONFIG_MODULE_VECT2 is not set
+CONFIG_MODULE_GEOMETRY=y
+# 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
+#
+
+#
+# uart needs circular buffer, mf2 client may need scheduler
+#
+# CONFIG_MODULE_UART is not set
+# CONFIG_MODULE_UART_9BITS is not set
+# CONFIG_MODULE_UART_CREATE_CONFIG is not set
+# 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=y
+CONFIG_MODULE_OBSTACLE_AVOIDANCE_CREATE_CONFIG=y
+
+#
+# Control system modules
+#
+# CONFIG_MODULE_CONTROL_SYSTEM_MANAGER is not set
+
+#
+# Filters
+#
+# 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
+#
+
+#
+# Some radio devices require SPI to be activated
+#
+# CONFIG_MODULE_CC2420 is not set
+# CONFIG_MODULE_CC2420_CREATE_CONFIG is not set
+
+#
+# Crypto modules
+#
+
+#
+# Crypto modules depend on utils module
+#
+# 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
+#
+
+#
+# Encoding modules depend on utils module
+#
+# CONFIG_MODULE_BASE64 is not set
+# CONFIG_MODULE_HAMMING is not set
+
+#
+# Debug modules
+#
+
+#
+# Debug modules depend on utils module
+#
+# CONFIG_MODULE_DIAGNOSTIC is not set
+# CONFIG_MODULE_DIAGNOSTIC_CREATE_CONFIG is not set
+CONFIG_MODULE_ERROR=y
+CONFIG_MODULE_ERROR_CREATE_CONFIG=y
+
+#
+# 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/oa/.gdb_history b/projects/microb2010/tests/oa/.gdb_history
new file mode 100644 (file)
index 0000000..aabef02
--- /dev/null
@@ -0,0 +1,127 @@
+set height 0
+set width 0
+complete b dij
+complete b dijkstra_p
+b dijkstra_process_neighs 
+c
+r
+complete b neig
+n
+c
+r
+complete b get_n
+b get_next_neigh 
+c
+bt
+s
+print j
+print i
+bt
+up
+down
+break main.c:98
+clear main.c:98
+break main.c:98
+c
+r
+c
+break main.c:134
+c
+c
+r
+c
+print pt
+complete print pos
+complete print posi
+complete print posit
+print position 
+print *position 
+print *pt
+break main.c:136
+c
+r
+del
+break main.c:233
+c
+complete dspl
+complete displ
+complete display nei
+display neigh 
+display *neigh 
+c
+r
+r
+c
+complete displ
+complete display *neigh
+display *neigh 
+c
+break main.c:392
+clear main.c:392
+c
+r
+r
+n
+c
+c
+break main.c:159
+clear main.c:159
+d
+r
+c
+n
+complete b get_ne
+complete b get_nex
+b get_next_neigh 
+c
+n
+print *pt
+complete print *pos
+complete print *posi
+complete print *posit
+print *position 
+n
+del
+complete b get_ne
+complete b get_nex
+b get_next_neigh 
+c
+r
+n
+print *position
+r
+print *position
+n
+r
+n
+print pos
+n
+print pos
+n
+c
+del
+r
+r
+b dump
+r
+c
+n
+clear main.c:90
+break main.c:266
+c
+n
+break main.c:237
+c
+complete disp
+display i
+display j
+c
+n
+complete print par
+complete print pare
+print parent
+complete print parent_p
+print parent_pos 
+print neigh->parent_pos
+c
+q
diff --git a/projects/microb2010/tests/oa/Makefile b/projects/microb2010/tests/oa/Makefile
new file mode 100644 (file)
index 0000000..dfdae06
--- /dev/null
@@ -0,0 +1,16 @@
+TARGET = main
+
+# repertoire des modules
+AVERSIVE_DIR = ../../../..
+
+SRC  = $(TARGET).c
+
+ASRC = 
+
+CFLAGS += -Wall -Werror
+
+########################################
+
+-include .aversive_conf
+include $(AVERSIVE_DIR)/mk/aversive_project.mk
+
diff --git a/projects/microb2010/tests/oa/error_config.h b/projects/microb2010/tests/oa/error_config.h
new file mode 100644 (file)
index 0000000..3dae63c
--- /dev/null
@@ -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 2009-04-24 19:30:42 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
diff --git a/projects/microb2010/tests/oa/graph.py b/projects/microb2010/tests/oa/graph.py
new file mode 100644 (file)
index 0000000..0b304bc
--- /dev/null
@@ -0,0 +1,260 @@
+import sys, re, math
+import numpy as np
+import matplotlib
+import matplotlib.path as mpath
+import matplotlib.patches as mpatches
+import matplotlib.pyplot as plt
+from matplotlib.patches import Arrow, Circle, Wedge, Polygon
+from matplotlib.collections import PatchCollection
+import popen2, random
+
+OFFSET_CORN_X=150
+OFFSET_CORN_Y=222
+STEP_CORN_X=225
+STEP_CORN_Y=250
+
+WAYPOINTS_NBX = 13
+WAYPOINTS_NBY = 8
+
+TYPE_WAYPOINT=0
+TYPE_DANGEROUS=1
+TYPE_WHITE_CORN=2
+TYPE_BLACK_CORN=3
+TYPE_OBSTACLE=4
+TYPE_NEIGH=5
+
+col = [TYPE_WAYPOINT] * WAYPOINTS_NBY
+waypoints = [col[:] for i in range(WAYPOINTS_NBX)]
+corn_table = [TYPE_WHITE_CORN]*18
+
+corn_side_confs = [
+    [ 1, 4 ],
+    [ 0, 4 ],
+    [ 2, 4 ],
+    [ 2, 3 ],
+    [ 0, 3 ],
+    [ 1, 3 ],
+    [ 1, 6 ],
+    [ 0, 6 ],
+    [ 2, 6 ],
+    ]
+corn_center_confs = [
+    [ 5, 8 ],
+    [ 7, 8 ],
+    [ 5, 9 ],
+    [ 7, 8 ],
+    ]
+
+Path = mpath.Path
+
+def mark_one_neigh(i, j):
+    global waypoints
+    if i < 0 or j < 0 or i >= WAYPOINTS_NBX or j >= WAYPOINTS_NBY:
+        return
+    if waypoints[i][j] != TYPE_WAYPOINT:
+        return
+    waypoints[i][j] = TYPE_NEIGH
+
+def mark_all_neigh(i, j):
+    global waypoints
+    if waypoints[i][j] != TYPE_WAYPOINT:
+        return
+    waypoints[i][j] = TYPE_NEIGH
+    mark_one_neigh(i,j+1)
+    mark_one_neigh(i,j-1)
+    mark_one_neigh(i+1,j)
+    mark_one_neigh(i-1,j)
+    if i & 1 == 0:
+        mark_one_neigh(i+1,j-1)
+        mark_one_neigh(i-1,j-1)
+    else:
+        mark_one_neigh(i+1,j+1)
+        mark_one_neigh(i-1,j+1)
+
+def pt2corn(i,j):
+    if i == 0 and j == 2: return 0
+    if i == 0 and j == 4: return 1
+    if i == 0 and j == 6: return 2
+    if i == 2 and j == 3: return 3
+    if i == 2 and j == 5: return 4
+    if i == 2 and j == 7: return 5
+    if i == 4 and j == 4: return 6
+    if i == 4 and j == 6: return 7
+    if i == 6 and j == 5: return 8
+    if i == 6 and j == 7: return 9
+    if i == 8 and j == 4: return 10
+    if i == 8 and j == 6: return 11
+    if i == 10 and j == 3: return 12
+    if i == 10 and j == 5: return 13
+    if i == 10 and j == 7: return 14
+    if i == 12 and j == 2: return 15
+    if i == 12 and j == 4: return 16
+    if i == 12 and j == 6: return 17
+    return -1
+
+def corn_get_sym(i):
+    sym = [15, 16, 17, 12, 13, 14, 10, 11, 8, 9, 6, 7, 3, 4, 5, 0, 1, 2]
+    return sym[i]
+
+def init_corn_table(conf_side, conf_center):
+    global corn_table, corn_side_confs, corn_center_confs
+    print "confs = %d, %d"%(conf_side, conf_center)
+    for i in range(18):
+        if i in corn_side_confs[conf_side]:
+            corn_table[i] = TYPE_BLACK_CORN
+            continue
+        if corn_get_sym(i) in corn_side_confs[conf_side]:
+            corn_table[i] = TYPE_BLACK_CORN
+            continue
+        if i in corn_center_confs[conf_center]:
+            corn_table[i] = TYPE_BLACK_CORN
+            continue
+        if corn_get_sym(i) in corn_center_confs[conf_center]:
+            corn_table[i] = TYPE_BLACK_CORN
+            continue
+        corn_table[i] = TYPE_WHITE_CORN
+            
+def init_waypoints():
+    global waypoints, corn_table
+
+    for i in range(WAYPOINTS_NBX):
+        for j in range(WAYPOINTS_NBY):
+            # corn
+            c = pt2corn(i, j)
+            if c >= 0:
+                waypoints[i][j] = corn_table[c]
+                continue
+            # too close of border
+            if (i & 1) == 1 and j == WAYPOINTS_NBY -1:
+                waypoints[i][j] = TYPE_OBSTACLE
+                continue
+            # hill
+            if i >= 2 and i < WAYPOINTS_NBX - 2 and j < 2:
+                waypoints[i][j] = TYPE_OBSTACLE
+                continue
+            # dangerous points
+            if i == 0 or i == WAYPOINTS_NBX-1:
+                waypoints[i][j] = TYPE_DANGEROUS
+                continue
+            if (i&1) == 0 and j == WAYPOINTS_NBY-1:
+                waypoints[i][j] = TYPE_DANGEROUS
+                continue
+
+            waypoints[i][j] = TYPE_WAYPOINT
+            
+        print i, waypoints[i]
+    return waypoints
+
+def build_poly(ptlist):
+    polydata = []
+    polydata.append((Path.MOVETO, (ptlist[0])))
+    for pt in ptlist[1:]:
+        polydata.append((Path.LINETO, (pt)))
+    polydata.append((Path.CLOSEPOLY, (ptlist[0])))
+    codes, verts = zip(*polydata)
+    poly = mpath.Path(verts, codes)
+    x, y = zip(*poly.vertices)
+    return x,y
+
+def build_path(ptlist):
+    polydata = []
+    polydata.append((Path.MOVETO, (ptlist[0])))
+    for pt in ptlist[1:]:
+        polydata.append((Path.LINETO, (pt)))
+    codes, verts = zip(*polydata)
+    poly = mpath.Path(verts, codes)
+    x, y = zip(*poly.vertices)
+    return x,y
+
+def build_area(ax):
+    # area
+    x,y = build_poly([(0,0), (3000,0), (3000,2100), (0,2100)])
+    ax.plot(x, y, 'g-')
+    
+    x,y = build_poly([(0,0), (0,500), (500,500), (500,0)])
+    ax.plot(x, y, 'y-')
+
+    x,y = build_poly([(3000,0), (3000,500), (2500,500), (2500,0)])
+    ax.plot(x, y, 'b-')
+
+    x,y = build_poly([(740,0), (740,500), (2260,500), (2260,0)])
+    ax.plot(x, y, 'g--')
+   # limit
+    #x,y = build_poly([(250,250), (2750,250), (2750,1850), (250,1850)])
+    #ax.plot(x, y, 'g--')
+    
+    init_corn_table(random.randint(0,8), random.randint(0,3))
+
+    waypoints = init_waypoints()
+    mark_all_neigh(5,6)
+    
+    wcorn = []
+    bcorn = []
+    points = []
+    dpoints = []
+    neighs = []
+
+    i = 0
+    j = 0
+    x = OFFSET_CORN_X
+    while x < 3000:
+        if (i & 1) == 0:
+            y = OFFSET_CORN_Y
+        else:
+            y = OFFSET_CORN_Y + STEP_CORN_Y/2
+        j = 0
+        while y < 2100:
+            
+            if waypoints[i][j] == TYPE_WHITE_CORN:
+                wcorn.append(Circle((x, y), 25))
+            if waypoints[i][j] == TYPE_BLACK_CORN:
+                bcorn.append(Circle((x, y), 25))
+            elif waypoints[i][j] == TYPE_WAYPOINT:
+                points.append(Circle((x, y), 10))
+            elif waypoints[i][j] == TYPE_DANGEROUS:
+                dpoints.append(Circle((x, y), 10))
+            elif waypoints[i][j] == TYPE_NEIGH:
+                neighs.append(Circle((x, y), 10))
+
+            j += 1
+            y += STEP_CORN_Y
+        i += 1
+        x += STEP_CORN_X
+
+    p = PatchCollection(wcorn, cmap=matplotlib.cm.jet,
+                        alpha=0.5, facecolor=(.5,.5,1))
+    ax.add_collection(p)
+
+    p = PatchCollection(bcorn, cmap=matplotlib.cm.jet,
+                        alpha=0.7, facecolor=(0,0,0))
+    ax.add_collection(p)
+
+    p = PatchCollection(points, cmap=matplotlib.cm.jet,
+                        alpha=0.3, facecolor=(1,1,0))
+    ax.add_collection(p)
+
+    p = PatchCollection(dpoints, cmap=matplotlib.cm.jet,
+                        alpha=0.5, facecolor=(1,0,1))
+    ax.add_collection(p)
+
+    p = PatchCollection(neighs, cmap=matplotlib.cm.jet,
+                        alpha=1., facecolor=(1,0,0),
+                        edgecolor=(1,0,0))
+    ax.add_collection(p)
+
+
+def graph(filename):
+    fig = plt.figure()
+    ax = fig.add_subplot(111)
+
+    build_area(ax)
+
+    ax.grid()
+    ax.set_xlim(-100, 3100)
+    ax.set_ylim(-100, 2200)
+    #ax.set_title('spline paths')
+    #plt.show()
+    fig.savefig(filename)
+
+graph("test.png")
diff --git a/projects/microb2010/tests/oa/main.c b/projects/microb2010/tests/oa/main.c
new file mode 100644 (file)
index 0000000..5d05ae9
--- /dev/null
@@ -0,0 +1,467 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <math.h>
+
+/* XXX TODO
+static
+const
+change x,y -> i,j to avoid confusion with coords
+could be optimized in mem space: it is not needed to store the x,y coord,
+   we can process it from idx. however it will be less optimized for speed
+
+*/
+
+#define OFFSET_CORN_X 150
+#define OFFSET_CORN_Y 222
+#define STEP_CORN_X 225
+#define STEP_CORN_Y 250
+
+#define CORN_NB 18
+
+#define WAYPOINTS_NBX 13
+#define WAYPOINTS_NBY 8
+
+/* enum is better */
+#define TYPE_WAYPOINT 0
+#define TYPE_DANGEROUS 1
+#define TYPE_WHITE_CORN 2
+#define TYPE_BLACK_CORN 3
+#define TYPE_OBSTACLE 4
+
+/* XXX enum possible ? else just rename */
+#define START      0
+#define UP         1
+#define UP_RIGHT   2
+#define DOWN_RIGHT 3
+#define DOWN       4
+#define DOWN_LEFT  5
+#define UP_LEFT    6
+#define END        7
+
+struct point {
+       int32_t x;
+       int32_t y;
+};
+
+struct djpoint {
+       struct point pos;
+       uint16_t weight;
+       struct djpoint *parent;
+       
+       uint8_t type:3;
+       uint8_t parent_pos:3;
+       uint8_t updated:1;
+       uint8_t todo:1;
+};
+
+uint8_t corn_table[CORN_NB];
+static struct djpoint djpoints[WAYPOINTS_NBX][WAYPOINTS_NBY];
+
+/* table to find the symetric idx */
+uint8_t corn_sym[] = {
+       15, 16, 17, 12, 13, 14, 10, 11, 8, 9, 6, 7, 3, 4, 5, 0, 1, 2 
+};
+
+uint8_t corn_side_confs[9][2] = {
+       { 1, 4 },
+       { 0, 4 },
+       { 2, 4 },
+       { 2, 3 },
+       { 0, 3 },
+       { 1, 3 },
+       { 1, 6 },
+       { 0, 6 },
+       { 2, 6 },
+};
+uint8_t corn_center_confs[4][2] = {
+       { 5, 8 },
+       { 7, 8 },
+       { 5, 9 },
+       { 7, 8 },
+};
+
+
+/* return index from neigh pointer */
+#define PT2IDX(neigh) ( ((void *)(neigh)-(void *)(&djpoints)) / sizeof(*neigh) )
+
+void dump(void)
+{
+       int8_t i, j;
+       struct djpoint *pt;
+
+       printf("         ");
+       for (i=0; i<WAYPOINTS_NBX; i++) {
+               printf(" %2d ", i);
+       }
+       printf("\n");
+                       
+       for (j=WAYPOINTS_NBY*2-1; j>=0; j--) {
+               printf("%3d   ", j/2);
+
+               if ((j&1) == 0)
+                       printf("    ");
+
+               for (i=0; i<WAYPOINTS_NBX; i++) {
+                       pt = &djpoints[i][j/2];
+                       
+                       if (((i+j) & 1) == 0)
+                               continue;
+
+                       if (pt->type == TYPE_OBSTACLE)
+                               printf("     X  ");
+                       else if (pt->type == TYPE_DANGEROUS)
+                               printf("     D  ");
+                       else if (pt->type == TYPE_WHITE_CORN)
+                               printf("     W  ");
+                       else if (pt->type == TYPE_BLACK_CORN)
+                               printf("     B  ");
+                       else if (pt->type == TYPE_WAYPOINT)
+                               printf(" %5d  ", pt->weight);
+                       else
+                               printf("     ?  "); 
+               }
+               printf("\n");
+       }
+}
+
+static inline uint8_t opposite_position(uint8_t pos)
+{
+       pos += 3;
+       if (pos > UP_LEFT)
+               pos -= 6;
+       return pos;
+}
+
+/* return coord of the entry in the table from the pointer */
+static void djpoint2ij(struct djpoint *pt, int8_t *x, int8_t *y)
+{
+       int8_t idx = PT2IDX(pt);
+       *x = idx / WAYPOINTS_NBY;
+       *y = idx % WAYPOINTS_NBY;
+}
+
+/* get the neighbour of the point at specified position */
+static struct djpoint *get_neigh(struct djpoint *pt,
+                                uint8_t position)
+{
+       int8_t i,j;
+       struct djpoint *neigh;
+
+       djpoint2ij(pt, &i, &j);
+
+       switch (position) {
+       case UP:
+               j++;
+               break;
+       case UP_RIGHT:
+               if (!(i & 1)) j++;
+               i++;
+               break;
+       case DOWN_RIGHT:
+               if (i & 1) j--;
+               i++;
+               break;
+       case DOWN:
+               j--;
+               break;
+       case DOWN_LEFT:
+               if (i & 1) j--;
+               i--;
+               break;
+       case UP_LEFT:
+               if (!(i & 1)) j++;
+               i--;
+               break;
+       default:
+               return NULL;
+       }
+       if (i < 0 || j < 0 || i >= WAYPOINTS_NBX || j >= WAYPOINTS_NBY)
+               return NULL;
+
+       neigh = &djpoints[i][j];
+
+       if (neigh->type != TYPE_WAYPOINT)
+               return NULL;
+
+       return neigh;
+}
+
+static struct djpoint *get_next_neigh(struct djpoint *pt, uint8_t *position)
+{
+       struct djpoint *neigh = NULL;
+       uint8_t pos = *position + 1;
+
+       for (pos = *position + 1; pos < END; pos++) {
+               neigh = get_neigh(pt, pos);
+               if (neigh != NULL)
+                       break;
+       }
+
+       *position = pos;
+       return neigh;
+}
+
+/* browse all points */
+#define POINT_FOREACH(cur)                                             \
+       for (cur = &djpoints[0][0];                                     \
+            cur < &djpoints[WAYPOINTS_NBX][WAYPOINTS_NBY];             \
+            cur ++)
+
+/* XXX comment */
+#define NEIGH_FOREACH(neigh, pos, point)                       \
+       for (pos = START, neigh = get_next_neigh(point, &pos);  \
+            neigh;                                             \
+            neigh = get_next_neigh(point, &pos))
+
+int dijkstra_init(void)
+{
+       return 0;
+}
+
+static uint16_t dist(struct djpoint *p1, struct djpoint *p2)
+{
+       double vx, vy;
+       vx = p2->pos.x - p1->pos.x;
+       vy = p2->pos.y - p1->pos.y;
+       return sqrt(vx * vx + vy * vy);
+}
+
+void dijkstra_process_neighs(struct djpoint *pt)
+{
+       struct djpoint *neigh;
+       uint8_t pos, parent_pos;
+       uint16_t weight;
+       int8_t i,j;
+
+       djpoint2ij(pt, &i, &j);
+       printf("at %d %d:\n", i, j);
+
+       NEIGH_FOREACH(neigh, pos, pt) {
+               weight = pt->weight + dist(pt, neigh);
+               parent_pos = opposite_position(pos);
+
+               /* bonus if we keep the same direction */
+               if (parent_pos == pt->parent_pos ||
+                   pt->parent_pos == END)
+                       weight = weight - 1;
+
+               printf("  pos=%d: ppos=%d opos=%d nw=%d w=%d\n", pos,
+                      pt->parent_pos, parent_pos,
+                      neigh->weight, weight);
+               if (neigh->weight == 0 || weight < neigh->weight) {
+                       djpoint2ij(neigh, &i, &j);
+                       //printf("    %d,%d updated\n", i, j);
+                       neigh->weight = weight;
+                       neigh->parent_pos = parent_pos;
+                       neigh->updated = 1;
+               }
+       }
+}
+
+int dijkstra(struct djpoint *start)
+{
+       struct djpoint *cur;
+       uint8_t todolist = 1;
+
+       start->todo = 1;
+
+       while (todolist) {
+               printf("\n");
+               dump();
+               /* process all neighbours of todo list */
+               POINT_FOREACH(cur) {
+                       if (!cur->todo)
+                               continue;
+                       dijkstra_process_neighs(cur);
+                       cur->todo = 0;
+               }
+
+               /* convert updated list in todo list */
+               todolist = 0;
+               POINT_FOREACH(cur) {
+                       if (!cur->updated)
+                               continue;
+                       todolist = 1;
+                       cur->todo = 1;
+                       cur->updated = 0;
+               }               
+       }
+       return 0; /* XXX */
+}
+
+int8_t coord_to_corn_idx(int8_t i, int8_t j)
+{
+       if (i == 0 && j == 2) return 0;
+       if (i == 0 && j == 4) return 1;
+       if (i == 0 && j == 6) return 2;
+       if (i == 2 && j == 3) return 3;
+       if (i == 2 && j == 5) return 4;
+       if (i == 2 && j == 7) return 5;
+       if (i == 4 && j == 4) return 6;
+       if (i == 4 && j == 6) return 7;
+       if (i == 6 && j == 5) return 8;
+       if (i == 6 && j == 7) return 9;
+       if (i == 8 && j == 4) return 10;
+       if (i == 8 && j == 6) return 11;
+       if (i == 10 && j == 3) return 12;
+       if (i == 10 && j == 5) return 13;
+       if (i == 10 && j == 7) return 14;
+       if (i == 12 && j == 2) return 15;
+       if (i == 12 && j == 4) return 16;
+       if (i == 12 && j == 6) return 17;
+       return -1;
+}
+
+int8_t corn_get_sym(int8_t i)
+{
+       if (i >= CORN_NB)
+               return -1;
+       return corn_sym[i];
+}
+
+void init_corn_table(uint8_t conf_side, uint8_t conf_center)
+{
+       int8_t sym, i;
+
+       printf("confs = %d, %d\n", conf_side, conf_center);
+       for (i=0; i<CORN_NB; i++) {
+               if (i == corn_side_confs[conf_side][0] ||
+                   i == corn_side_confs[conf_side][1]) {
+                       corn_table[i] = TYPE_BLACK_CORN;
+                       continue;
+               }
+               sym = corn_get_sym(i);
+               if (sym == corn_side_confs[conf_side][0] ||
+                   sym == corn_side_confs[conf_side][1]) {
+                       corn_table[i] = TYPE_BLACK_CORN;
+                       continue;
+               }
+               if (i == corn_center_confs[conf_center][0] ||
+                   i == corn_center_confs[conf_center][1]) {
+                       corn_table[i] = TYPE_BLACK_CORN;
+                       continue;
+               }
+               sym = corn_get_sym(i);
+               if (sym == corn_center_confs[conf_center][0] ||
+                   sym == corn_center_confs[conf_center][1]) {
+                       corn_table[i] = TYPE_BLACK_CORN;
+                       continue;
+               }
+               corn_table[i] = TYPE_WHITE_CORN;
+       }
+}
+
+/* init waypoints position */
+void init_waypoints(void)
+{
+       int8_t i, j;
+       int32_t x, y;
+       struct djpoint *pt;
+
+       x = OFFSET_CORN_X;
+       for (i=0; i<WAYPOINTS_NBX; i++) {
+
+               if (i & 1)
+                       y = OFFSET_CORN_Y - STEP_CORN_Y/2;
+               else
+                       y = OFFSET_CORN_Y;                      
+
+               for (j=0; j<WAYPOINTS_NBY; j++) {
+                       pt = &djpoints[i][j];
+
+                       pt->pos.x = x;
+                       pt->pos.y = y;
+
+                       pt->type = TYPE_WAYPOINT;
+                       pt->parent_pos = END;
+                       pt->updated = 0;
+                       pt->todo = 0;
+
+                       y += STEP_CORN_Y;
+               }
+
+               x += STEP_CORN_X;
+       }
+}
+
+/* update the type and weight of waypoints, before starting
+ * dijkstra */
+void update_waypoints(void)
+{
+       int8_t i, j, c;
+       struct djpoint *pt;
+
+       for (i=0; i<WAYPOINTS_NBX; i++) {
+
+               for (j=0; j<WAYPOINTS_NBY; j++) {
+                       pt = &djpoints[i][j];
+
+                       pt->weight = 0;
+
+                       /* corn */
+                       c = coord_to_corn_idx(i, j);
+                       if (c >= 0) {
+                               pt->type = corn_table[c];
+                               continue;
+                       }
+                       /* too close of border */
+                       if ((i & 1) == 1 && j == (WAYPOINTS_NBY-1)) {
+                               pt->type = TYPE_OBSTACLE;
+                               continue;
+                       }
+                       /* hill */
+                       if (i >= 2 && i < (WAYPOINTS_NBX-2) && j < 2) {
+                               pt->type = TYPE_OBSTACLE;
+                               continue;
+                       }
+                       /* dangerous points */
+                       if (i == 0 || i == (WAYPOINTS_NBX-1)) {
+                               pt->type = TYPE_DANGEROUS;
+                               continue;
+                       }
+                       if ( (i&1) == 0 && j == (WAYPOINTS_NBY-1)) {
+                               pt->type = TYPE_DANGEROUS;
+                               continue;
+                       }
+                       pt->type = TYPE_WAYPOINT;
+               }
+       }
+}
+
+int get_path(struct djpoint *start, struct djpoint *end)
+{
+       struct djpoint *cur;
+       uint8_t prev_direction = 0;
+
+       for (cur=start;
+            cur != NULL && cur->parent_pos != END && cur != end;
+            cur = get_neigh(cur, cur->parent_pos)) {
+               if (prev_direction != cur->parent_pos)
+                       printf("%d %d (%d)\n", cur->pos.x, cur->pos.y, cur->parent_pos);
+               prev_direction = cur->parent_pos;
+       }
+       printf("%d %d\n", end->pos.x, end->pos.y);
+
+       return 0; /* XXX */
+}
+
+int main(void)
+{
+       struct djpoint *start;
+       struct djpoint *end;
+       
+       start = &djpoints[1][1];
+       end = &djpoints[12][1];
+
+       init_corn_table(0, 0);
+       init_waypoints();
+       update_waypoints();
+
+       dijkstra(end);
+       dump();
+
+       get_path(start, end);
+
+       return 0;
+}
diff --git a/projects/microb2010/tests/oa/obstacle_avoidance_config.h b/projects/microb2010/tests/oa/obstacle_avoidance_config.h
new file mode 100644 (file)
index 0000000..3c3f310
--- /dev/null
@@ -0,0 +1,25 @@
+/*  
+ *  Copyright Droids Corporation, Microb Technology (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
+ *  (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: obstacle_avoidance_config.h,v 1.2 2009-05-02 10:12:53 zer0 Exp $
+ *
+ */
+
+#define MAX_POLY 3
+#define MAX_PTS 12
+#define MAX_RAYS 150
+#define MAX_CHKPOINTS 6