Commit f8d6d071 authored by Nicolas Furquez's avatar Nicolas Furquez
Browse files

compilacion de la integracion

parent d26ddbef
......@@ -9,16 +9,18 @@ PROJECT(NewVisRob2)
SET (LIBRARY_OUTPUT_PATH ${NewVisRob2_BINARY_DIR}/bin
CACHE PATH "Directory for Libraries")
#set_source_files_properties(*.c PROPERTIES LANGUAGE CXX )
add_subdirectory (src/Configuracion)
add_subdirectory (src/Comunicacion)
#add_subdirectory (src/Comunicacion)
add_subdirectory (src/Havimo)
add_subdirectory (src/DynamixelCustom)
#add_subdirectory (src/DynamixelCustom)
add_subdirectory (src/Poses)
add_subdirectory (src/Utils)
#add_subdirectory (src/Utils)
add_subdirectory (src/Vision)
add_subdirectory (src/ZigbeeVisionFilter)
#add_subdirectory (src/ZigbeeVisionFilter)
add_subdirectory (src/Zgb_console)
#add_subdirectory (src/Zgb_console)
INCLUDE_DIRECTORIES(./include)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(integrationTest)
INCLUDE(FindPkgConfig)
find_package(OpenCV REQUIRED)
find_package(cvBlob REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS} ${cvBlob_INCLUDE_DIRS})
set(LIBS ${cvBlob_LIBS} ${OpenCV_LIBS})
link_directories(${OpenCV_INCLUDE_DIRS} ${cvBlob_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../include)
add_library(libICamera STATIC IMPORTED)
set_property(TARGET libICamera PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/../../lib/libICamera.a)
add_library(libvision STATIC IMPORTED)
set_property(TARGET libvision PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/../../lib/libvision.a)
set_source_files_properties(main.c PROPERTIES LANGUAGE CXX )
add_executable(integrationTest main.c)
SET_TARGET_PROPERTIES(integrationTest PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(integrationTest libvision libICamera ${LIBS} -lm)
INSTALL(TARGETS integrationTest DESTINATION ${CMAKE_CURRENT_SOURCE_DIR})
\ No newline at end of file
/*############################################################
# #
# Proyecto Futbol de Robots. - PAIE 2014 #
# http://www.fing.edu.uy/inco/proyectos/futbot13/ #
# #
############################################################*/
#include "vision.h"
#include <stdio.h>
int main() {
if (!vision_initialize(DEFAULT_HAVIMO_ID, DEFAULT_BAUDNUM, CYAN_COLOR))
return -1;
vision_checkVision(0);
vision_terminate();
printf("FINAL FELIZ...\n");
return 0;
}
#ifndef I_CONFIG
#define I_CONFIG
#include "confuse.h"
cfg_t *initCfg(const char* fileConf);
#endif
\ No newline at end of file
/*############################################################
# #
# Proyecto Visión robótica y reconstrucción espacial #
# con aplicaciones prácticas. 2010 #
# http://www.fing.edu.uy/inco/grupos/mina/pGrado/vision2010 #
# #
############################################################*/
/**
* iHaViMo.h: Interfaz de capa de Interaccion con HaViMo.
* Realiza el pasaje de blobs detectados de la memoria de la camara a la memoria del controlador
* @author: Gonzalo Gismero
*/
#ifndef I_HAVIMO
#define I_HAVIMO
#define CANT_REGIONS 15
//Region index 0..15
#define INVALID_REGION 0
//Region color
#define UNKOWN_REGION 0
#define BALL_REGION 1
#define FIELD_REGION 2
#define MY_GOAL_REGION 3
#define OPP_GOAL_REGION 4
#define ROBOT_REGION 5
#define CYAN_REGION 6
#define MAGENTA_REGION 7
#define IMAGE_WIDTH 160 //px
#define IMAGE_HEIGHT 120 //px
#define DISTANCIA_FOCAL_HAVIMO 164//d(cm) * ancho(px) / ancho(cm)
#define DFH_FOR_PROPORTION 179
struct blob {
unsigned int region_index;
unsigned int region_color;
unsigned int number_of_pixels;
unsigned int sum_of_x_coord_high;
unsigned int sum_of_x_coord_low;
unsigned int sum_of_y_coord_high;
unsigned int sum_of_y_coord_low;
unsigned int max_x;
unsigned int min_x;
unsigned int max_y;
unsigned int min_y;
};
/**
* Inicializa las estructuras que utiliza la interfaz, y envía a HaViMo el primer pedido de procesamiento de frame.
* Tambien inicializa las comunicaciones de la libreria dynamixel.
* HaViMo_dxl_ID: identificador dxl de HaViMO. Por defecto es 100
* baudnum: baudnum, por defecto es 1.
*/
int vision_iHaViMo_initialize(int HaViMo_dxl_ID, int baudnum);
/**
* Elimina las estructuras utilizadas por el modulo.
*/
int vision_iHaViMo_terminate(void);
/**
* Obtiene el siguiente frame de HaViMo. En caso de que no este disponible se devuelve NULL
* Si el resultado es valido, antes de devolverlo se le pide a HaViMo que procese el siguiente frame.
* HaViMo_dxl_ID: identificador dxl de HaViMO. Por defecto es 100
*/
struct blob * vision_iHaViMo_getNextFrame(int HaViMo_dxl_ID);
/*---------------FUNCIONES AUXILIARES PARA MANEJO DE BLOB---------------*/
/**
* Retorna la comparacion de los arrays de blobs b1 y b2
* b1: array para comparar con b2
* b2: array para comparar con b1
*/
unsigned int blob_array_blob_equals(struct blob * b1, struct blob * b2);
/**
* Compara 2 blobs
* b1: blob a comparar con b2
* b2: blob a comparar con b1
*/
unsigned int blob_equals(struct blob b1, struct blob b2);
/**
* Imprime un conjunto de blobs en consola. Se debe estar conectado a través del puerto serial.
* blobs: array de blobs a imprimr
*/
void vision_iHaViMo_printBlobs(struct blob* blobs);
#endif
/*############################################################
# #
# Proyecto Futbol de Robots. - PAIE 2014 #
# http://www.fing.edu.uy/inco/proyectos/futbot13/ #
# #
############################################################*/
/**
* iVisionModule.h: Interfaz de capa de Interaccion con Camara.
* Realiza el pasaje de blobs detectado.
*/
#ifndef I_VISION_MODULE
#define I_VISION_MODULE
//Region index 0..15
#define INVALID_REGION 0
//Region color
#define UNKOWN_REGION 0
#define BALL_REGION 1
#define FIELD_REGION 2
#define MY_GOAL_REGION 3
#define OPP_GOAL_REGION 4
#define ROBOT_REGION 5
#define CYAN_REGION 6
#define MAGENTA_REGION 7
#define CANT_REGIONS 15
#define IMAGE_WIDTH 160 //px
#define IMAGE_HEIGHT 120 //px
#define DISTANCIA_FOCAL_HAVIMO 164//d(cm) * ancho(px) / ancho(cm)
#define DFH_FOR_PROPORTION 179
struct blob {
unsigned int region_index;
unsigned int region_color;
unsigned int number_of_pixels;
unsigned int sum_of_x_coord_high;
unsigned int sum_of_x_coord_low;
unsigned int sum_of_y_coord_high;
unsigned int sum_of_y_coord_low;
unsigned int max_x;
unsigned int min_x;
unsigned int max_y;
unsigned int min_y;
};
/**
* Inicializa las estructuras que utiliza la interfaz.
*/
int iVisionModule_initialize(int ID, int rate);
/**
* Elimina las estructuras utilizadas por el modulo.
*/
int iVisionModule_terminate(void);
/**
* Obtiene el siguiente frame de la camara. En caso de que no este disponible se devuelve NULL
* Si el resultado es valido, antes de devolverlo se procesa.
*/
struct blob * iVisionModule_getNextFrame(int ID);
/*---------------FUNCIONES AUXILIARES PARA MANEJO DE BLOB---------------*/
/**
* Retorna la comparacion de los arrays de blobs b1 y b2
* b1: array para comparar con b2
* b2: array para comparar con b1
*/
unsigned int blob_array_blob_equals(struct blob * b1, struct blob * b2);
/**
* Compara 2 blobs
* b1: blob a comparar con b2
* b2: blob a comparar con b1
*/
unsigned int blob_equals(struct blob b1, struct blob b2);
/**
* Imprime un conjunto de blobs en consola. Se debe estar conectado a través del puerto serial.
* blobs: array de blobs a imprimr
*/
void iVisionModule_printBlobs(struct blob* blobs);
#endif
......@@ -11,18 +11,18 @@
* Sirve los resultados de la capa de vision a quien lo requiera.
* @author: Gonzalo Gismero
*/
#ifndef I_VISION
#define I_VISION
#include "iHaViMo.h"
#include "iVisionModule.h"
#define MYSELF 0 //No se retornan datos del propio robot. No es utilizado
#define BALL 1
#define PARTNER 2
#define ENEMY 3
#define RIGHT_LANDMARK 4
#define LEFT_LANDMARK 5
#define LEFT_LANDMARK 5
#define MY_GOAL 6
#define OPP_GOAL 7
#define MY_LATERAL_POST 8
......@@ -104,7 +104,7 @@ void vision_setRobotHeight(double height);
/**
* Chequea si se puede procesar un nuevo frame. En caso de que un nuevo frame este disponible, se lo procesa tambien.
* Retorna 0 en caso de que no se tenga un frame, o 1 sino. El resultado del procesamiento se puede chequear en la variable
* Retorna 0 en caso de que no se tenga un frame, o 1 sino. El resultado del procesamiento se puede chequear en la variable
* global objects, que tiene tamanio obj_size.
* force_frame fuerza la obtencion del frame.
*/
......
......@@ -6,6 +6,7 @@ INCLUDE_DIRECTORIES(../../include)
ADD_LIBRARY(Configuracion STATIC Config.c)
SET_PROPERTY(TARGET Configuracion PROPERTY SOVERSION 1.0)
INSTALL(TARGETS Configuracion DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/../../lib)
install(FILES Config.h DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/../../include)
......
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(libHavimo)
PROJECT(libICamera)
INCLUDE(FindPkgConfig)
INCLUDE_DIRECTORIES(../../include)
ADD_LIBRARY(havimo STATIC iHaViMo.c)
SET_PROPERTY(TARGET havimo PROPERTY SOVERSION 1.0)
INSTALL(TARGETS havimo DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/../../lib)
\ No newline at end of file
IF(CAMARA STREQUAL "hav")
MESSAGE("Se usara la interface iHaViMo")
file (GLOB i_camera_SRC "iHaViMo.c")
add_definitions(-DUSE_HAVIMO)
ELSEIF(CAMARA STREQUAL "web")
MESSAGE("Se usara la interface icvBlobs")
find_package(OpenCV REQUIRED)
find_package(cvBlob REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS} ${cvBlob_INCLUDE_DIRS})
set(LIBS ${cvBlob_LIBS} ${OpenCV_LIBS})
link_directories(${OpenCV_INCLUDE_DIRS} ${cvBlob_INCLUDE_DIRS})
set_source_files_properties(icvBlobs.c PROPERTIES LANGUAGE CXX )
file (GLOB i_camera_SRC utilsBlobs.cpp utilsBlobs.h icvBlobs.c )
add_definitions(-DUSE_WEB)
ELSE(CAMARA STREQUAL "")
MESSAGE("NO SE DEFINIO CAMARA")
ENDIF()
ADD_LIBRARY(ICamera STATIC ${i_camera_SRC})
IF(CAMARA STREQUAL "web")
SET_TARGET_PROPERTIES(ICamera PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(ICamera ${LIBS})
ENDIF()
SET_PROPERTY(TARGET ICamera PROPERTY SOVERSION 1.0)
INSTALL(TARGETS ICamera DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/../../lib)
/*############################################################
# #
# Proyecto Visión robótica y reconstrucción espacial #
# con aplicaciones prácticas. 2010 #
# http://www.fing.edu.uy/inco/grupos/mina/pGrado/vision2010 #
# #
############################################################*/
# Hey Emacs, this is a -*- makefile -*-
#----------------------------------------------------------------------------
# WinAVR Makefile Template written by Eric B. Weddington, J?rg Wunsch, et al.
#
# Released to the Public Domain
#
# Additional material for this makefile was written by:
# Peter Fleury
# Tim Henigan
# Colin O'Flynn
# Reiner Patommel
# Markus Pfaff
# Sander Pool
# Frederik Rouleau
# Carlos Lamas
#
#----------------------------------------------------------------------------
# On command line:
#
# make all = Make software.
#
# make clean = Clean out built project files.
#
# make coff = Convert ELF to AVR COFF.
#
# make extcoff = Convert ELF to AVR Extended COFF.
#
# make program = Download the hex file to the device, using avrdude.
# Please customize the avrdude settings below first!
#
# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
#
# make filename.i = Create a preprocessed source file for use in submitting
# bug reports to the GCC project.
#
# To rebuild project do "make clean" then "make all".
#----------------------------------------------------------------------------
# MCU name
MCU = atmega2561
# Processor frequency.
# This will define a symbol, F_CPU, in all source code files equal to the
# processor frequency. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
# Typical values are:
# F_CPU = 1000000
# F_CPU = 1843200
# F_CPU = 2000000
# F_CPU = 3686400
# F_CPU = 4000000
# F_CPU = 7372800
# F_CPU = 8000000
# F_CPU = 11059200
# F_CPU = 14745600
# F_CPU = 16000000
# F_CPU = 18432000
# F_CPU = 20000000
F_CPU = 16000000
# Output format. (can be srec, ihex, binary)
FORMAT = ihex
# Target file name (without extension).
TARGET = libhavimo
# Object files directory
# To put object files in current directory, use a dot (.), do NOT make
# this an empty or blank macro!
OBJDIR = ./output
# List C source files here. (C dependencies are automatically generated.)
SRC = iHaViMo.c
# List C++ source files here. (C dependencies are automatically generated.)
CPPSRC =
# List Assembler source files here.
# Make them always end in a capital .S. Files ending in a lowercase .s
# will not be considered source files but generated files (assembler
# output from the compiler), and will be deleted upon "make clean"!
# Even though the DOS/Win* filesystem matches both .s and .S the same,
# it will preserve the spelling of the filenames, and gcc itself does
# care about how the name is spelled on its command-line.
ASRC =
# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
# Debugging format.
# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
# AVR Studio 4.10 requires dwarf-2.
# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
DEBUG = dwarf-2
# List any extra directories to look for include files here.
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
EXTRAINCDIRS = ../../include/
# Compiler flag to set the C Standard level.
# c89 = "ANSI" C
# gnu89 = c89 plus GCC extensions
# c99 = ISO C99 standard (not yet fully implemented)
# gnu99 = c99 plus GCC extensions
CSTANDARD = -std=gnu99
# Place -D or -U options here for C sources
CDEFS = -DF_CPU=$(F_CPU)UL
# Place -D or -U options here for ASM sources
ADEFS = -DF_CPU=$(F_CPU)
# Place -D or -U options here for C++ sources
CPPDEFS = -DF_CPU=$(F_CPU)UL
#CPPDEFS += -D__STDC_LIMIT_MACROS
#CPPDEFS += -D__STDC_CONSTANT_MACROS
#---------------- Compiler Options C ----------------
# -g*: generate debugging information
# -O*: optimization level
# -f...: tuning, see GCC manual and avr-libc documentation
# -Wall...: warning level
# -Wa,...: tell GCC to pass this to the assembler.
# -adhlns...: create assembler listing
CFLAGS = -g$(DEBUG)
CFLAGS += $(CDEFS)
CFLAGS += -O$(OPT)
CFLAGS += -funsigned-char
CFLAGS += -funsigned-bitfields
CFLAGS += -fpack-struct
CFLAGS += -fshort-enums
CFLAGS += -Wall
CFLAGS += -Wstrict-prototypes
#CFLAGS += -mshort-calls
#CFLAGS += -fno-unit-at-a-time
#CFLAGS += -Wundef
#CFLAGS += -Wunreachable-code
#CFLAGS += -Wsign-compare
CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
CFLAGS += $(CSTANDARD)
#---------------- Compiler Options C++ ----------------
# -g*: generate debugging information
# -O*: optimization level
# -f...: tuning, see GCC manual and avr-libc documentation
# -Wall...: warning level
# -Wa,...: tell GCC to pass this to the assembler.
# -adhlns...: create assembler listing
CPPFLAGS = -g$(DEBUG)
CPPFLAGS += $(CPPDEFS)
CPPFLAGS += -O$(OPT)
CPPFLAGS += -funsigned-char
CPPFLAGS += -funsigned-bitfields
CPPFLAGS += -fpack-struct
CPPFLAGS += -fshort-enums
CPPFLAGS += -fno-exceptions
CPPFLAGS += -Wall
CPPFLAGS += -Wundef
#CPPFLAGS += -mshort-calls
#CPPFLAGS += -fno-unit-at-a-time
#CPPFLAGS += -Wstrict-prototypes
#CPPFLAGS += -Wunreachable-code
#CPPFLAGS += -Wsign-compare
CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst)
CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
#CPPFLAGS += $(CSTANDARD)
#---------------- Assembler Options ----------------
# -Wa,...: tell GCC to pass this to the assembler.
# -adhlns: create listing
# -gstabs: have the assembler create line number information; note that
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
#---------------- Library Options ----------------
# Minimalistic printf version
PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
# Floating point printf version (requires MATH_LIB = -lm below)
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
# Minimalistic scanf version
SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
MATH_LIB = -lm
# List any extra directories to look for libraries here.
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
EXTRALIBDIRS = ../../libinclude
EXTRALIB = -ldynamixel_custom
#---------------- External Memory Options ----------------
# 64 KB of external RAM, starting after internal RAM (ATmega128!),
# used for variables (.data/.bss) and heap (malloc()).
#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
# 64 KB of external RAM, starting after internal RAM (ATmega128!),
# only used for heap (malloc()).
#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff
EXTMEMOPTS =
#---------------- Linker Options ----------------
# -Wl,...: tell GCC to pass this to linker.
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))