diff --git a/hironx_ros_bridge/robot/hrpiob/CMakeLists.txt b/hironx_ros_bridge/robot/hrpiob/CMakeLists.txt index 7077046e..c67388d4 100644 --- a/hironx_ros_bridge/robot/hrpiob/CMakeLists.txt +++ b/hironx_ros_bridge/robot/hrpiob/CMakeLists.txt @@ -39,14 +39,25 @@ link_directories(/opt/jsk/lib /usr/pkg/lib) #endif() # hrpsys-base -#include(FindPkgConfig) +include(FindPkgConfig) execute_process( COMMAND pkg-config --cflags-only-I hrpsys-base OUTPUT_VARIABLE HRPSYSBASE_CXX_FLAGS RESULT_VARIABLE RESULT) +execute_process( + COMMAND pkg-config --modversion hrpsys-base + OUTPUT_VARIABLE HRPSYSBASE_VERSION + RESULT_VARIABLE RESULT) + message("HRPSYSBASE_CXX_FLAGS: ${HRPSYSBASE_CXX_FLAGS}") +message("HRPSYSBASE_VERSION: ${HRPSYSBASE_VERSION}") +if(NOT "${HRPSYSBASE_VERSION}" VERSION_LESS "315.4.0") + add_definitions(-DROBOT_IOB_VERSION=2) + message(STATUS "USE VERSION 2 OF IOB") + message(STATUS "ADD DEFINITION -DROBOT_IOB_VERSION=2") +endif() add_definitions(${HRPSYSBASE_CXX_FLAGS}) diff --git a/hironx_ros_bridge/robot/hrpiob/iob.cpp b/hironx_ros_bridge/robot/hrpiob/iob.cpp index 138b5e2e..481cb69f 100644 --- a/hironx_ros_bridge/robot/hrpiob/iob.cpp +++ b/hironx_ros_bridge/robot/hrpiob/iob.cpp @@ -733,3 +733,35 @@ int read_digital_output(char *doutput) else return FALSE; } + +#ifndef defined(ROBOT_IOB_VERSION) && ROBOT_IOB_VERSION >= 2 +/** + * @brief Needed for hrpsys 315.4.0 onward (added at https://github.com/fkanehiro/hrpsys-base/pull/598). + * TODO Implement if we want to utilize this. + */ +int number_of_thermometers(void) +{ + std::fprintf(stdout, "number_of_thermometers not implemented. See https://github.com/start-jsk/rtmros_hironx/pull/481\n"); + return 0; +} + +/** + * @brief Needed for hrpsys 315.4.0 onward (added at https://github.com/fkanehiro/hrpsys-base/pull/598). + * TODO Implement if we want to utilize this. + */ +int number_of_batteries(void) +{ + std::fprintf(stdout, "number_of_batteries not implemented. See https://github.com/start-jsk/rtmros_hironx/pull/481\n"); + return 0; +} + +/** + * @brief Needed for hrpsys 315.4.0 onward (added at https://github.com/fkanehiro/hrpsys-base/pull/598). + * TODO Implement if we want to utilize this. + */ +int read_battery(char *battery) +{ + std::fprintf(stdout, "read_battery not implemented. See https://github.com/start-jsk/rtmros_hironx/pull/481\n"); + return 0; +} +#endif diff --git a/hironx_ros_bridge/robot/hrpiob/nextage-open.hpp b/hironx_ros_bridge/robot/hrpiob/nextage-open.hpp index 2e9a434d..22cd66c3 100644 --- a/hironx_ros_bridge/robot/hrpiob/nextage-open.hpp +++ b/hironx_ros_bridge/robot/hrpiob/nextage-open.hpp @@ -60,7 +60,6 @@ namespace NEXTAGE_OPEN virtual int wait_for_iob_signal(void) = 0; virtual long get_signal_period(void) = 0; - virtual int initializeJointAngle(const char *name, const char *option) = 0; virtual int read_digital_input(char *dIn) = 0; virtual int length_digital_input(void) = 0; @@ -68,6 +67,12 @@ namespace NEXTAGE_OPEN virtual int write_digital_output_with_mask(const char *doutput, const char *mask) = 0; virtual int length_digital_output(void) = 0; virtual int read_digital_output(char *doutput) = 0; + + #if defined(ROBOT_IOB_VERSION) && ROBOT_IOB_VERSION >= 2 + virtual int number_of_thermometers(void) = 0; + virtual int number_of_batteries(void) = 0; + virtual int read_battery(char *battery) = 0; + #endif }; } diff --git a/hironx_ros_bridge/robot/hrpiob/package.xml b/hironx_ros_bridge/robot/hrpiob/package.xml new file mode 100644 index 00000000..2086247f --- /dev/null +++ b/hironx_ros_bridge/robot/hrpiob/package.xml @@ -0,0 +1,12 @@ + + hrpiob + 1.0.1 + Hardware I/O interface definition for hrpsys-based robots specific to Kawada's NEXTAGE robot. + + Kawada Industries Inc. + Kawada Robotics Corporation + TORK + CC BY-NC 4.0 + cmake + hrpsys + \ No newline at end of file