기존에 사용하던 ros2 serial 패키지가 빌드되지 않는다.
https://github.com/kyuhyong/ros2_serial
원인은 libserial 패키지를 foxy에서 지원하지 않기 때문인데
몇가지 변경사항이 있었음.
https://libserial.readthedocs.io/en/latest/index.html
참조
https://github.com/crayzeewulf/libserial/issues/113
이 패키지를 빌드해보면
Install the project...
-- Install configuration: ""
-- Up-to-date: /usr/local/share/pkgconfig/libserial.pc
-- Up-to-date: /usr/local/lib/libserialmod.so
-- Up-to-date: /usr/local/include/libserial
-- Up-to-date: /usr/local/include/libserial/Makefile.am
-- Up-to-date: /usr/local/include/libserial/SerialPortConstants.h
-- Up-to-date: /usr/local/include/libserial/SerialStreamBuf.h
-- Up-to-date: /usr/local/include/libserial/SerialStream.h
-- Up-to-date: /usr/local/include/libserial/SerialPort.h
-- Up-to-date: /usr/local/lib/libserial.a
-- Up-to-date: /usr/local/lib/libserial.so.1.0.0
-- Up-to-date: /usr/local/lib/libserial.so.1
-- Up-to-date: /usr/local/lib/libserial.so
이 경로를 지정하기 위해 ros2 패키지에
CMakeModules/Findserial.cmake
파일을 만들고 다음과 같은 내용을 추가한다.
# SERIAL_FOUND - system has Potrace
# SERIAL_INCLUDE_DIR - the Potrace include directory
# SERIAL_LIBRARIES - The libraries needed to use Potrace
include(FindPackageHandleStandardArgs)
find_path(SERIAL_INCLUDE_DIR SerialStream.h
/usr/include
/usr/local/include/libserial/
)
FIND_LIBRARY(SERIAL_LIBRARY NAMES serial libserial
PATHS
/usr/lib
/usr/local/lib
)
if (SERIAL_INCLUDE_DIR AND SERIAL_LIBRARY)
set(SERIAL_FOUND TRUE)
set(SERIAL_LIBRARIES ${SERIAL_LIBRARY})
else (SERIAL_INCLUDE_DIR AND SERIAL_LIBRARY)
set(SERIAL_FOUND FALSE)
endif (SERIAL_INCLUDE_DIR AND SERIAL_LIBRARY)
if (SERIAL_FOUND)
message(STATUS "Found LibSerial: ${SERIAL_LIBRARIES}")
else (SERIAL_FOUND)
message(STATUS "don't find LibSerial")
endif (SERIAL_FOUND)
MARK_AS_ADVANCED(SERIAL_INCLUDE_DIR SERIAL_LIBRARIES SERIAL_LIBRARY)
그리고나서 CMakeLists.txt 파일 상단에 다음 내용을 추가한다.
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CmakeModules")