Revision 414a3516
| CMakeLists.txt | ||
|---|---|---|
| 3 | 3 | 
     | 
| 4 | 4 | 
    set(ENV{ROS_LANG_DISABLE} "genjava")
   | 
| 5 | 5 | 
     | 
| 6 | 
     | 
|
| 7 | 6 | 
    set(ROS_BUILD_TYPE Debug)  | 
| 8 | 7 | 
     | 
| 9 | 
     | 
|
| 10 | 
    #######################################  | 
|
| 11 | 
    #allow forced disable of RSB  | 
|
| 12 | 
    option(IGNORE_RSB "IGNORE_RSB" OFF)  | 
|
| 13 | 
     | 
|
| 14 | 
    #######################################  | 
|
| 15 | 
    # check if we have RSB support:  | 
|
| 16 | 
    IF (IGNORE_RSB)  | 
|
| 17 | 
    MESSAGE(INFO "RSB disabled per command line flag IGNORE_RSB")  | 
|
| 18 | 
    ELSE (IGNORE_RSB)  | 
|
| 19 | 
    FIND_PACKAGE(RSB 0.11)  | 
|
| 20 | 
    IF (RSB_FOUND)  | 
|
| 21 | 
    #RSB  | 
|
| 22 | 
    SET(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib:\$ORIGIN/")  | 
|
| 23 | 
    FIND_PACKAGE(RSC 0.11 REQUIRED)  | 
|
| 24 | 
    FIND_PACKAGE(RSB 0.11 REQUIRED)  | 
|
| 25 | 
    #RST  | 
|
| 26 | 
    FIND_PACKAGE(RST REQUIRED COMPONENTS sandbox)  | 
|
| 27 | 
        INCLUDE_DIRECTORIES(BEFORE SYSTEM ${RST_INCLUDE_DIRS})
   | 
|
| 28 | 
        ADD_DEFINITIONS(${RST_CFLAGS} ${RSTSANDBOX_CFLAGS})
   | 
|
| 29 | 
     | 
|
| 30 | 
        INCLUDE_DIRECTORIES(BEFORE SYSTEM ${RSB_INCLUDE_DIRS})
   | 
|
| 31 | 
        LIST(INSERT CMAKE_MODULE_PATH 0 ${RSC_CMAKE_MODULE_PATH})
   | 
|
| 32 | 
    #RSB  | 
|
| 33 | 
    SET(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib:\$ORIGIN/")  | 
|
| 34 | 
    FIND_PACKAGE(RSC 0.11 REQUIRED)  | 
|
| 35 | 
    FIND_PACKAGE(RSB 0.11 REQUIRED)  | 
|
| 36 | 
    #RST  | 
|
| 37 | 
    FIND_PACKAGE(RST REQUIRED COMPONENTS sandbox)  | 
|
| 38 | 
        INCLUDE_DIRECTORIES(BEFORE SYSTEM ${RST_INCLUDE_DIRS})
   | 
|
| 39 | 
        ADD_DEFINITIONS(${RST_CFLAGS} ${RSTSANDBOX_CFLAGS})
   | 
|
| 40 | 
     | 
|
| 41 | 
        INCLUDE_DIRECTORIES(BEFORE SYSTEM ${RSB_INCLUDE_DIRS})
   | 
|
| 42 | 
        LIST(INSERT CMAKE_MODULE_PATH 0 ${RSC_CMAKE_MODULE_PATH})
   | 
|
| 43 | 
     | 
|
| 44 | 
    message(STATUS "RSB Support is ON")  | 
|
| 45 | 
    add_definitions(-DRSB_SUPPORT=1)  | 
|
| 46 | 
    ENDIF (RSB_FOUND)  | 
|
| 47 | 
    ENDIF(IGNORE_RSB)  | 
|
| 48 | 
     | 
|
| 49 | 8 | 
    ################################################################  | 
| 50 | 9 | 
    # check for ROS support:  | 
| 51 | 10 | 
    find_package(catkin REQUIRED COMPONENTS roscpp std_msgs sensor_msgs message_generation genmsg)  | 
| 52 | 
    IF (catkin_FOUND)  | 
|
| 53 | 
    set(ROS_FOUND 1)  | 
|
| 54 | 
    message(STATUS "ROS Support is ON")  | 
|
| 55 | 
    add_definitions(-DROS_SUPPORT=1)  | 
|
| 11 | 
    IF (NOT catkin_FOUND)  | 
|
| 12 | 
    MESSAGE(FATAL_ERROR "Error: could not find ROS middleware!")  | 
|
| 56 | 13 | 
    ENDIF (catkin_FOUND)  | 
| 57 | 14 | 
     | 
| 58 | 
     | 
|
| 59 | 15 | 
    INCLUDE(FindPkgConfig)  | 
| 60 | 16 | 
     | 
| 61 | 17 | 
    ##libreflexxes  | 
| ... | ... | |
| 69 | 25 | 
    ENDIF ()  | 
| 70 | 26 | 
    ENDIF ()  | 
| 71 | 27 | 
     | 
| 72 | 
    IF (NOT catkin_FOUND AND NOT RSB_FOUND)  | 
|
| 73 | 
    message(FATAL_ERROR "Error: could neither find RSB or ROS middleware!")  | 
|
| 74 | 
    ENDIF ()  | 
|
| 75 | 
     | 
|
| 76 | 28 | 
     | 
| 77 | 29 | 
    SET(REFLEXXES_LIBRARY_DIRS "${REFLEXXES_PREFIX}/lib")
   | 
| 78 | 30 | 
    SET(REFLEXXES_INCLUDE_DIRS "${REFLEXXES_PREFIX}/include")
   | 
| ... | ... | |
| 81 | 33 | 
    find_library(REFLEXXES_LIBRARY NAMES ${REFLEXXES_LIBRARIES} HINTS ${REFLEXXES_LIBRARY_DIRS})
   | 
| 82 | 34 | 
     | 
| 83 | 35 | 
    MESSAGE("-- using libReflexxesTypeII version ${REFLEXXES_VERSION} from ${REFLEXXES_INCLUDE_DIRS} and ${REFLEXXES_LIBRARY_DIRS}")
   | 
| 84 | 
    MESSAGE("-- will ink against ${REFLEXXES_LIBRARY}")
   | 
|
| 36 | 
    MESSAGE("-- will link against ${REFLEXXES_LIBRARY}")
   | 
|
| 85 | 37 | 
     | 
| 86 | 38 | 
    set(CMAKE_CXX_FLAGS "-g -Wall")  | 
| 87 | 39 | 
    add_definitions ("-Wall")
   | 
| 88 | 40 | 
     | 
| 41 | 
    #######################################  | 
|
| 42 | 
    ## Declare ROS messages and services ##  | 
|
| 43 | 
    #######################################  | 
|
| 89 | 44 | 
     | 
| 90 | 
    IF (catkin_FOUND)  | 
|
| 91 | 
    #######################################  | 
|
| 92 | 
    ## Declare ROS messages and services ##  | 
|
| 93 | 
    #######################################  | 
|
| 94 | 
     | 
|
| 95 | 
    add_message_files(  | 
|
| 96 | 
    FILES  | 
|
| 97 | 
    gaze.msg  | 
|
| 98 | 
    position_lcr.msg  | 
|
| 99 | 
    mouth.msg  | 
|
| 100 | 
    )  | 
|
| 101 | 
     | 
|
| 102 | 
    ## Generate added messages and services with any dependencies listed here  | 
|
| 103 | 
    generate_messages(  | 
|
| 104 | 
    DEPENDENCIES  | 
|
| 105 | 
    std_msgs  | 
|
| 106 | 
    humotion  | 
|
| 107 | 
    )  | 
|
| 108 | 
     | 
|
| 109 | 
     | 
|
| 110 | 
    #  | 
|
| 111 | 
    ###################################  | 
|
| 112 | 
    ## catkin specific configuration ##  | 
|
| 113 | 
    ###################################  | 
|
| 114 | 
    ## The catkin_package macro generates cmake config files for your package  | 
|
| 115 | 
    ## Declare things to be passed to dependent projects  | 
|
| 116 | 
    ## INCLUDE_DIRS: uncomment this if you package contains header files  | 
|
| 117 | 
    ## LIBRARIES: libraries you create in this project that dependent projects also need  | 
|
| 118 | 
    ## CATKIN_DEPENDS: catkin_packages dependent projects also need  | 
|
| 119 | 
    ## DEPENDS: system dependencies of this project that dependent projects also need  | 
|
| 120 | 
    catkin_package(  | 
|
| 121 | 
    INCLUDE_DIRS include  | 
|
| 122 | 
    LIBRARIES humotion  | 
|
| 123 | 
    #CATKIN_DEPENDS message_runtime  | 
|
| 124 | 
    #DEPENDS system_lib  | 
|
| 125 | 
    )  | 
|
| 126 | 
    ENDIF (catkin_FOUND)  | 
|
| 45 | 
    add_message_files(  | 
|
| 46 | 
    FILES  | 
|
| 47 | 
    gaze.msg  | 
|
| 48 | 
    position_lcr.msg  | 
|
| 49 | 
    mouth.msg  | 
|
| 50 | 
    )  | 
|
| 51 | 
     | 
|
| 52 | 
    ## Generate added messages and services with any dependencies listed here  | 
|
| 53 | 
    generate_messages(  | 
|
| 54 | 
    DEPENDENCIES  | 
|
| 55 | 
    std_msgs  | 
|
| 56 | 
    humotion  | 
|
| 57 | 
    )  | 
|
| 58 | 
     | 
|
| 59 | 
     | 
|
| 60 | 
    #  | 
|
| 61 | 
    ###################################  | 
|
| 62 | 
    ## catkin specific configuration ##  | 
|
| 63 | 
    ###################################  | 
|
| 64 | 
    ## The catkin_package macro generates cmake config files for your package  | 
|
| 65 | 
    ## Declare things to be passed to dependent projects  | 
|
| 66 | 
    ## INCLUDE_DIRS: uncomment this if you package contains header files  | 
|
| 67 | 
    ## LIBRARIES: libraries you create in this project that dependent projects also need  | 
|
| 68 | 
    ## CATKIN_DEPENDS: catkin_packages dependent projects also need  | 
|
| 69 | 
    ## DEPENDS: system dependencies of this project that dependent projects also need  | 
|
| 70 | 
    catkin_package(  | 
|
| 71 | 
    INCLUDE_DIRS include  | 
|
| 72 | 
    LIBRARIES humotion  | 
|
| 73 | 
    #CATKIN_DEPENDS message_runtime  | 
|
| 74 | 
    #DEPENDS system_lib  | 
|
| 75 | 
    )  | 
|
| 127 | 76 | 
     | 
| 128 | 77 | 
    ###########  | 
| 129 | 78 | 
    ## Build ##  | 
| ... | ... | |
| 153 | 102 | 
    src/client/client.cpp  | 
| 154 | 103 | 
    src/client/middleware.cpp  | 
| 155 | 104 | 
    src/client/middleware_ros.cpp  | 
| 156 | 
    src/client/middleware_rsb.cpp  | 
|
| 157 | 105 | 
     | 
| 158 | 106 | 
    src/server/server.cpp  | 
| 159 | 107 | 
    src/server/middleware.cpp  | 
| 160 | 108 | 
    src/server/middleware_ros.cpp  | 
| 161 | 
    src/server/middleware_rsb.cpp  | 
|
| 162 | 109 | 
     | 
| 163 | 110 | 
    src/server/controller.cpp  | 
| 164 | 111 | 
    src/server/joint_interface.cpp  | 
| ... | ... | |
| 177 | 124 | 
     | 
| 178 | 125 | 
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
   | 
| 179 | 126 | 
     | 
| 180 | 
     | 
|
| 181 | 127 | 
    ## Add cmake target dependencies of the executable/library  | 
| 182 | 128 | 
    ## as an example, message headers may need to be generated before nodes  | 
| 183 | 129 | 
    add_dependencies(humotion ${catkin_EXPORTED_TARGETS} humotion_gencpp)
   | 
| 184 | 130 | 
     | 
| 185 | 131 | 
    ## Specify libraries to link a library or executable target against  | 
| 186 | 132 | 
    target_link_libraries(humotion  | 
| 187 | 
    			${Boost_LIBRARIES}
   | 
|
| 188 | 
    			${catkin_LIBRARIES}
   | 
|
| 189 | 
    			${REFLEXXES_LIBRARY}
   | 
|
| 190 | 
    			${RST_LIBRARIES}
   | 
|
| 191 | 
    			${RSB_LIBRARIES}
   | 
|
| 133 | 
        ${Boost_LIBRARIES}
   | 
|
| 134 | 
        ${catkin_LIBRARIES}
   | 
|
| 135 | 
        ${REFLEXXES_LIBRARY}
   | 
|
| 192 | 136 | 
    )  | 
| 193 | 137 | 
     | 
| 194 | 138 | 
    set_property(TARGET humotion PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)  | 
| ... | ... | |
| 208 | 152 | 
    # )  | 
| 209 | 153 | 
     | 
| 210 | 154 | 
    ## Mark executables and/or libraries for installation  | 
| 211 | 
    IF (catkin_FOUND)  | 
|
| 212 | 
    install(TARGETS humotion  | 
|
| 213 | 
            ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
   | 
|
| 214 | 
            LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
   | 
|
| 215 | 
            RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
   | 
|
| 216 | 
    )  | 
|
| 217 | 
    ## Mark cpp header files for installation  | 
|
| 218 | 
    install(DIRECTORY include/humotion/  | 
|
| 219 | 
            DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
   | 
|
| 220 | 
    )  | 
|
| 221 | 
    ENDIF (catkin_FOUND)  | 
|
| 222 | 
     | 
|
| 155 | 
    install(TARGETS humotion  | 
|
| 156 | 
        ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
   | 
|
| 157 | 
        LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
   | 
|
| 158 | 
        RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
   | 
|
| 159 | 
    )  | 
|
| 160 | 
    ## Mark cpp header files for installation  | 
|
| 161 | 
    install(DIRECTORY include/humotion/  | 
|
| 162 | 
        DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
   | 
|
| 163 | 
    )  | 
|
| 223 | 164 | 
     | 
| 224 | 165 | 
    #############  | 
| 225 | 166 | 
    ## Testing ##  | 
| 226 | 167 | 
    #############  | 
| 227 | 
    IF (catkin_FOUND)  | 
|
| 228 | 
    ## Add gtest based cpp test target and link libraries  | 
|
| 229 | 
        catkin_add_gtest(${PROJECT_NAME}-test-server test/server.cpp)
   | 
|
| 230 | 
        if(TARGET ${PROJECT_NAME}-test-server)
   | 
|
| 231 | 
        target_link_libraries(${PROJECT_NAME}-test-server ${PROJECT_NAME})
   | 
|
| 232 | 
    endif()  | 
|
| 233 | 
        catkin_add_gtest(${PROJECT_NAME}-test-client test/client.cpp)
   | 
|
| 234 | 
        if(TARGET ${PROJECT_NAME}-test-client)
   | 
|
| 235 | 
        target_link_libraries(${PROJECT_NAME}-test-client ${PROJECT_NAME})
   | 
|
| 236 | 
    endif()  | 
|
| 237 | 
        catkin_add_gtest(${PROJECT_NAME}-test-timestamp test/timestamp.cpp)
   | 
|
| 238 | 
        if(TARGET ${PROJECT_NAME}-test-timestamp)
   | 
|
| 239 | 
        target_link_libraries(${PROJECT_NAME}-test-timestamp ${PROJECT_NAME})
   | 
|
| 240 | 
    endif()  | 
|
| 241 | 
    ENDIF (catkin_FOUND)  | 
|
| 242 | 
     | 
|
| 168 | 
    ## Add gtest based cpp test target and link libraries  | 
|
| 169 | 
    catkin_add_gtest(${PROJECT_NAME}-test-server test/server.cpp)
   | 
|
| 170 | 
    if(TARGET ${PROJECT_NAME}-test-server)
   | 
|
| 171 | 
    target_link_libraries(${PROJECT_NAME}-test-server ${PROJECT_NAME})
   | 
|
| 172 | 
    endif()  | 
|
| 173 | 
    catkin_add_gtest(${PROJECT_NAME}-test-client test/client.cpp)
   | 
|
| 174 | 
    if(TARGET ${PROJECT_NAME}-test-client)
   | 
|
| 175 | 
    target_link_libraries(${PROJECT_NAME}-test-client ${PROJECT_NAME})
   | 
|
| 176 | 
    endif()  | 
|
| 177 | 
    catkin_add_gtest(${PROJECT_NAME}-test-timestamp test/timestamp.cpp)
   | 
|
| 178 | 
    if(TARGET ${PROJECT_NAME}-test-timestamp)
   | 
|
| 179 | 
    target_link_libraries(${PROJECT_NAME}-test-timestamp ${PROJECT_NAME})
   | 
|
| 180 | 
    endif()  | 
|
| 243 | 181 | 
     | 
| 244 | 182 | 
    ### Add folders to be run by python nosetests  | 
| 245 | 183 | 
    # catkin_add_nosetests(test)  | 
| include/humotion/client/middleware_ros.h | ||
|---|---|---|
| 30 | 30 | 
    * Forschungsgemeinschaft (DFG) in the context of the German  | 
| 31 | 31 | 
    * Excellence Initiative.  | 
| 32 | 32 | 
    */  | 
| 33 | 
    #include "ros/ros.h"  | 
|
| 33 | 34 | 
     | 
| 34 | 35 | 
    namespace humotion{
   | 
| 35 | 36 | 
    namespace client{
   | 
| 36 | 37 | 
     | 
| 37 | 38 | 
    class MiddlewareROS : public Middleware{
   | 
| 38 | 
    #ifndef ROS_SUPPORT  | 
|
| 39 | 
    public:  | 
|
| 40 | 
        MiddlewareROS(std::string name) : Middleware(name){
   | 
|
| 41 | 
            printf("> ERROR: humotion was compiled without ROS middleware support. Please use MiddlewareRSB() instead!\n\n");
   | 
|
| 42 | 
    exit(EXIT_FAILURE);  | 
|
| 43 | 
    }  | 
|
| 44 | 
     | 
|
| 45 | 
        ~MiddlewareROS(){}
   | 
|
| 46 | 
        void send_mouth_target(){};
   | 
|
| 47 | 
        void send_gaze_target(){};
   | 
|
| 48 | 
        bool ok(){ return false; }
   | 
|
| 49 | 
        void tick(){}
   | 
|
| 50 | 
     | 
|
| 51 | 
    #else  | 
|
| 52 | 39 | 
    public:  | 
| 53 | 40 | 
    MiddlewareROS(std::string name);  | 
| 54 | 41 | 
    ~MiddlewareROS();  | 
| ... | ... | |
| 64 | 51 | 
    //boost::shared_ptr<ros::NodeHandle> node_handle;  | 
| 65 | 52 | 
    ros::Publisher mouth_target_publisher;  | 
| 66 | 53 | 
    ros::Publisher gaze_target_publisher;  | 
| 67 | 
    #endif  | 
|
| 68 | 54 | 
    };  | 
| 69 | 55 | 
     | 
| 70 | 56 | 
    }  | 
| include/humotion/server/middleware_ros.h | ||
|---|---|---|
| 29 | 29 | 
    #include "middleware.h"  | 
| 30 | 30 | 
    #include "humotion/mouth.h"  | 
| 31 | 31 | 
    #include "humotion/gaze.h"  | 
| 32 | 
     | 
|
| 33 | 
    #ifdef ROS_SUPPORT  | 
|
| 34 | 32 | 
    #include "ros/ros.h"  | 
| 35 | 
    #endif  | 
|
| 36 | 
     | 
|
| 37 | 33 | 
    #include <boost/shared_ptr.hpp>  | 
| 38 | 34 | 
     | 
| 39 | 35 | 
    namespace humotion{
   | 
| 40 | 36 | 
    namespace server{
   | 
| 41 | 37 | 
     | 
| 42 | 38 | 
    class MiddlewareROS : public Middleware{
   | 
| 43 | 
    #ifndef ROS_SUPPORT  | 
|
| 44 | 
    public:  | 
|
| 45 | 
        MiddlewareROS(std::string name, Controller *c) : Middleware(name, c){
   | 
|
| 46 | 
            printf("> ERROR: humotion was compiled without ROS middleware support. Please use MiddlewareRSB() instead!\n\n");
   | 
|
| 47 | 
    exit(EXIT_FAILURE);  | 
|
| 48 | 
    }  | 
|
| 49 | 
     | 
|
| 50 | 
        ~MiddlewareROS(){}
   | 
|
| 51 | 
        bool ok(){ return false; }
   | 
|
| 52 | 
        void tick(){}
   | 
|
| 53 | 
     | 
|
| 54 | 
    #else  | 
|
| 55 | 39 | 
    public:  | 
| 56 | 40 | 
    MiddlewareROS(std::string name, Controller *c);  | 
| 57 | 41 | 
    ~MiddlewareROS();  | 
| ... | ... | |
| 65 | 49 | 
     | 
| 66 | 50 | 
    ros::Subscriber mouth_target_subscriber;  | 
| 67 | 51 | 
    ros::Subscriber gaze_target_subscriber;  | 
| 68 | 
    #endif  | 
|
| 69 | 52 | 
    };  | 
| 70 | 53 | 
     | 
| 71 | 54 | 
    }  | 
| include/humotion/server/middleware_rsb.h | ||
|---|---|---|
| 1 | 
    /*  | 
|
| 2 | 
    * This file is part of humotion  | 
|
| 3 | 
    *  | 
|
| 4 | 
    * Copyright(c) sschulz <AT> techfak.uni-bielefeld.de  | 
|
| 5 | 
    * http://opensource.cit-ec.de/projects/humotion  | 
|
| 6 | 
    *  | 
|
| 7 | 
    * This file may be licensed under the terms of the  | 
|
| 8 | 
    * GNU Lesser General Public License Version 3 (the ``LGPL''),  | 
|
| 9 | 
    * or (at your option) any later version.  | 
|
| 10 | 
    *  | 
|
| 11 | 
    * Software distributed under the License is distributed  | 
|
| 12 | 
    * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either  | 
|
| 13 | 
    * express or implied. See the LGPL for the specific language  | 
|
| 14 | 
    * governing rights and limitations.  | 
|
| 15 | 
    *  | 
|
| 16 | 
    * You should have received a copy of the LGPL along with this  | 
|
| 17 | 
    * program. If not, go to http://www.gnu.org/licenses/lgpl.html  | 
|
| 18 | 
    * or write to the Free Software Foundation, Inc.,  | 
|
| 19 | 
    * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  | 
|
| 20 | 
    *  | 
|
| 21 | 
    * The development of this software was supported by the  | 
|
| 22 | 
    * Excellence Cluster EXC 277 Cognitive Interaction Technology.  | 
|
| 23 | 
    * The Excellence Cluster EXC 277 is a grant of the Deutsche  | 
|
| 24 | 
    * Forschungsgemeinschaft (DFG) in the context of the German  | 
|
| 25 | 
    * Excellence Initiative.  | 
|
| 26 | 
    */  | 
|
| 27 | 
     | 
|
| 28 | 
    #pragma once  | 
|
| 29 | 
    #include "middleware.h"  | 
|
| 30 | 
    #include "humotion/mouth.h"  | 
|
| 31 | 
    #include "humotion/gaze.h"  | 
|
| 32 | 
     | 
|
| 33 | 
    #ifdef RSB_SUPPORT  | 
|
| 34 | 
    #define BOOST_SIGNALS_NO_DEPRECATION_WARNING 1  | 
|
| 35 | 
    #include <rsb/Listener.h>  | 
|
| 36 | 
    #include <rst/robot/HumotionGazeTarget.pb.h>  | 
|
| 37 | 
    #include <rst/robot/MouthTarget.pb.h>  | 
|
| 38 | 
    #endif  | 
|
| 39 | 
     | 
|
| 40 | 
    namespace humotion{
   | 
|
| 41 | 
    namespace server{
   | 
|
| 42 | 
     | 
|
| 43 | 
    class MiddlewareRSB : public Middleware{
   | 
|
| 44 | 
     | 
|
| 45 | 
    #ifndef RSB_SUPPORT  | 
|
| 46 | 
    public:  | 
|
| 47 | 
        MiddlewareRSB(std::string name, Controller *c) : Middleware(name, c){
   | 
|
| 48 | 
            printf("> ERROR: humotion was compiled without RSB middleware support. Please use MiddlewareROS() instead!\n\n");
   | 
|
| 49 | 
    exit(EXIT_FAILURE);  | 
|
| 50 | 
    }  | 
|
| 51 | 
     | 
|
| 52 | 
        ~MiddlewareRSB(){}
   | 
|
| 53 | 
        bool ok(){ return false; }
   | 
|
| 54 | 
        void tick(){}
   | 
|
| 55 | 
     | 
|
| 56 | 
    #else  | 
|
| 57 | 
    public:  | 
|
| 58 | 
    MiddlewareRSB(std::string name, Controller *c);  | 
|
| 59 | 
    ~MiddlewareRSB();  | 
|
| 60 | 
     | 
|
| 61 | 
    bool ok();  | 
|
| 62 | 
    void tick();  | 
|
| 63 | 
     | 
|
| 64 | 
     | 
|
| 65 | 
    private:  | 
|
| 66 | 
     | 
|
| 67 | 
    void incoming_mouth_target(boost::shared_ptr<rst::robot::MouthTarget> event);  | 
|
| 68 | 
    void incoming_gaze_target(rsb::EventPtr e);  | 
|
| 69 | 
     | 
|
| 70 | 
    rsb::ListenerPtr mouth_target_listener;  | 
|
| 71 | 
    rsb::ListenerPtr gaze_target_listener;  | 
|
| 72 | 
     | 
|
| 73 | 
    #endif  | 
|
| 74 | 
    };  | 
|
| 75 | 
     | 
|
| 76 | 
    }  | 
|
| 77 | 
    }  | 
|
| 1 | 
    dropped RSB support  | 
|
| src/client/client.cpp | ||
|---|---|---|
| 27 | 27 | 
     | 
| 28 | 28 | 
    #include "client/client.h"  | 
| 29 | 29 | 
    #include "client/middleware_ros.h"  | 
| 30 | 
    #include "client/middleware_rsb.h"  | 
|
| 31 | 30 | 
    #include <boost/algorithm/string.hpp>  | 
| 32 | 31 | 
     | 
| 33 | 32 | 
    using namespace std;  | 
| ... | ... | |
| 46 | 45 | 
    //start middleware:  | 
| 47 | 46 | 
        if (mw == "ROS"){
   | 
| 48 | 47 | 
    middleware = new MiddlewareROS(scope);  | 
| 49 | 
        }else if (mw == "RSB"){
   | 
|
| 50 | 
    middleware = new MiddlewareRSB(scope);  | 
|
| 51 | 48 | 
        }else{
   | 
| 52 | 
            printf("> ERROR: invalid mw '%s' given. Please use ROS or RSB\n\n",mw.c_str());
   | 
|
| 49 | 
            printf("> ERROR: invalid mw '%s' given. RSB support was droppd. please use ROS\n\n",mw.c_str());
   | 
|
| 53 | 50 | 
    exit(EXIT_FAILURE);  | 
| 54 | 51 | 
    }  | 
| 55 | 52 | 
    }  | 
| src/client/middleware_ros.cpp | ||
|---|---|---|
| 27 | 27 | 
     | 
| 28 | 28 | 
    #include "client/middleware_ros.h"  | 
| 29 | 29 | 
     | 
| 30 | 
    #ifdef ROS_SUPPORT  | 
|
| 31 | 
     | 
|
| 32 | 30 | 
    #include "humotion/mouth.h"  | 
| 33 | 31 | 
    #include "humotion/gaze.h"  | 
| 34 | 32 | 
    #include <boost/range/algorithm/remove_if.hpp>  | 
| ... | ... | |
| 146 | 144 | 
    tick();  | 
| 147 | 145 | 
    }  | 
| 148 | 146 | 
     | 
| 149 | 
    #endif  | 
|
| src/server/middleware_ros.cpp | ||
|---|---|---|
| 27 | 27 | 
     | 
| 28 | 28 | 
    #include "server/middleware_ros.h"  | 
| 29 | 29 | 
     | 
| 30 | 
    #ifdef ROS_SUPPORT  | 
|
| 31 | 
     | 
|
| 32 | 30 | 
    #include <boost/range/algorithm/remove_if.hpp>  | 
| 33 | 31 | 
    #include <boost/algorithm/string/classification.hpp>  | 
| 34 | 32 | 
    using namespace std;  | 
| ... | ... | |
| 134 | 132 | 
     | 
| 135 | 133 | 
    }  | 
| 136 | 134 | 
     | 
| 137 | 
    #endif  | 
|
| src/server/server.cpp | ||
|---|---|---|
| 27 | 27 | 
     | 
| 28 | 28 | 
    #include "server/server.h"  | 
| 29 | 29 | 
    #include "server/middleware_ros.h"  | 
| 30 | 
    #include "server/middleware_rsb.h"  | 
|
| 31 | 30 | 
    #include <boost/algorithm/string.hpp>  | 
| 32 | 31 | 
    #include <string>  | 
| 33 | 32 | 
     | 
| ... | ... | |
| 60 | 59 | 
    //start middleware:  | 
| 61 | 60 | 
        if (mw == "ROS"){
   | 
| 62 | 61 | 
    middleware = new MiddlewareROS(scope, controller);  | 
| 63 | 
        }else if (mw == "RSB"){
   | 
|
| 64 | 
    middleware = new MiddlewareRSB(scope, controller);  | 
|
| 65 | 62 | 
        }else{
   | 
| 66 | 
            printf("> ERROR: invalid mw '%s' given. Please use ROS or RSB\n\n",mw.c_str());
   | 
|
| 63 | 
            printf("> ERROR: invalid mw '%s' given. RSB support was dropped. Please use ROS\n\n",mw.c_str());
   | 
|
| 67 | 64 | 
    exit(EXIT_FAILURE);  | 
| 68 | 65 | 
    }  | 
| 69 | 66 | 
     | 
Also available in: Unified diff