Skip to content

Commit

Permalink
RoAH RSBB Comm initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
joaocgreis committed Sep 19, 2014
0 parents commit da95aaa
Show file tree
Hide file tree
Showing 25 changed files with 3,867 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
bin
build
lib
gen/**/*.pb.cc
gen/**/*.pb.h
gen/roah_rsbb_msgs.h
CMakeCache.txt
CMakeFiles
cmake_install.cmake
Makefile
*~
**/*~
*.orig
**/*.orig
.kdev4
*.kdev4
.kdev_include_paths
.cproject
.project
15 changes: 15 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
cmake_minimum_required (VERSION 2.8.7)
project (RoAH_RSBB_Comm)

set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)

add_definitions("-std=c++0x")

add_subdirectory(gen/roah_rsbb_msgs/)
add_subdirectory(libs/)
add_subdirectory(include/)
include_directories(${INCLUDE_DIRS})

add_executable(capture_comm src/capture_comm.cpp)
target_link_libraries(capture_comm roah_rsbb_msgs protobuf_comm)
52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
RoAH RSBB Comm
==============

This repository contains the basic files needed to communicate with
the RoCKIn@Home Referee, Scoring and Benchmarking Box.

Here are provided:

- The proto files used to communicate;
- A reduced version of the protobuf_comm library by Tim Niemueller
(http://www.robocup-logistics.org/refbox), containing only the files
needed to communicate over UDP;
- A C++ header to ease the task of communicating specifically with
RoAH RSBB.


## Dependencies

You need to have installed a C++11 compiler, CMake, Boost, Protobuf
and OpenSSL.

If you are using Ubuntu, install the dependencies with:
```
sudo apt-get install build-essential cmake libboost-all-dev libprotoc-dev libssl-dev
```

This was tested with Ubuntu 12.04.5 LTS (Precise Pangolin) and
14.04.1 LTS (Trusty Tahr).

## Compiling

To compile, use:
```
cmake .
make
```

Two libraries will be compiled, that you can use on your projects:
```
lib/libroah_rsbb_msgs.a
lib/libprotobuf_comm.a
```

## Using roah_rsbb.h

This C++ header file provides a small decorator on top of
protobuf_comm specifically for RoAH. The classes `PublicChannel` and
`PrivateChannel` adapt the use of each channel specifically. They
provide a pooling interface for the last messages of the allowed
types received on each channel as well as a specific signal for each
one. Be careful with synchronization, the callbacks will be called
from different threads.
51 changes: 51 additions & 0 deletions cleanup
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash

DIRS="include src"
SOURCE_FILES=`find -L $DIRS -iname "*\.[ch]pp" -or -iname "*\.[ch]" | grep -v "/\."`
HEADER_FILES=`find -L $DIRS -iname "*\.hpp" -or -iname "*\.h" | grep -v "/\."`


# astyle
if [ "$(astyle -V 2>&1)" != "Artistic Style Version 2.04" ]; then
echo "Please update astyle to version 2.04:"
echo
echo 'mkdir -p $HOME/bin/ &&'
echo 'cd /tmp &&'
echo 'wget -c -T 20 -t 20 -O "astyle_2.04_linux.tar.gz" \'
echo '"http://sourceforge.net/projects/astyle/files/astyle/astyle%202.04/astyle_2.04_linux.tar.gz/download" &&'
echo 'tar xavf astyle_*_linux.tar.* &&'
echo 'cd astyle/build/gcc/ &&'
echo 'make -j5 &&'
echo 'cp bin/astyle $HOME/bin/ &&'
echo 'cd ../../.. &&'
echo 'rm -rfv astyle &&'
echo 'cd'
echo
exit 2
fi
astyle -s2 -A8 -C -S -N -L -w -y -p -d -U -c -E -j -H -k1 -Y $SOURCE_FILES


# Empty lines
echo At least one empty line at and of files
sed -n '1x;1!H;${x;s/$/\n/;p}' -i $SOURCE_FILES
echo At least three empty lines between functions
echo Only one empty line before \#include
echo No empty lines at beginning of blocks
echo No empty lines at end of blocks
echo No empty lines at beginning of files
echo One empty line at end of files
sed -n '1x;1!H;${x;s/\([^\n]\)\n\{2,3\}\([^\n]\)/\1\n\n\n\n\2/g;s/\n\n\n*#include/\n\n#include/g;s/{\(\n *\)*\n/{\n/g;s/\(\n *\)*\n\( *\)}/\n\2}/g;s/^\n*//;s/\n*$//;p}' -i $SOURCE_FILES
echo Only one empty line before \#ifndef in hpps
echo Only one empty line before \#endif in hpps
sed -n '1x;1!H;${x;s/\n\n\n*#ifndef/\n\n#ifndef/g;s/\n\n\n*#endif/\n\n#endif/g;p}' -i $HEADER_FILES


# remove spaces in empty lines
astyle -s2 -A8 -C -S -N -L -w -y -p -d -U -c -j -H -k1 -Y $SOURCE_FILES


# remove garbage
find -L -name "*~" -print -delete
find -L -name "*\.orig" -print -delete
find -L -name "#*#" -print -delete
18 changes: 18 additions & 0 deletions gen/roah_rsbb_msgs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
find_package(Protobuf REQUIRED)
include_directories(${PROTOBUF_INCLUDE_DIRS})

file(GLOB ROAH_RSBB_MSGS_PROTOS ${CMAKE_CURRENT_SOURCE_DIR}/../../proto/*.proto)
protobuf_generate_cpp(RSBB_PROTO_SRCS RSBB_PROTO_HDRS ${ROAH_RSBB_MSGS_PROTOS})
add_library(roah_rsbb_msgs STATIC ${RSBB_PROTO_SRCS})
target_link_libraries(roah_rsbb_msgs ${PROTOBUF_LIBRARIES})

set(ROAH_RSBB_MSGS_HPP "${CMAKE_CURRENT_BINARY_DIR}/../roah_rsbb_msgs.h")
file(REMOVE ${ROAH_RSBB_MSGS_HPP})
foreach(PB_H ${RSBB_PROTO_HDRS})
get_filename_component(FILE_PB_H ${PB_H} NAME)
file(APPEND ${ROAH_RSBB_MSGS_HPP} "#include \"roah_rsbb_msgs/${FILE_PB_H}\"\n")
endforeach()

include_directories(${CMAKE_CURRENT_BINARY_DIR}/../)

set(INCLUDE_DIRS ${INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR}/../ PARENT_SCOPE)
Loading

0 comments on commit da95aaa

Please sign in to comment.