diff --git a/.gitignore b/.gitignore index 5de18ad9..ba25189e 100644 --- a/.gitignore +++ b/.gitignore @@ -4,10 +4,15 @@ # SPDX-License-Identifier: MIT # +logs/ +build/ +install/ + .vscode *.code-workspace tags + # Swap [._]*.s[a-v][a-z] !*.svg # comment out if you don't need vector files @@ -32,4 +37,7 @@ tags # to ignore generated code -driver_sim/include/protobuf/* \ No newline at end of file +driver_sim/include/protobuf/* + +# COLCON custom files +COLCON_IGNORE \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 78a5b301..9524a041 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM ubuntu:18.04 ENV HOSTNAME sim-device -ENV ROS_DISTRO=dashing +ENV ROS_DISTRO=foxy RUN apt update && apt upgrade -q -y && \ apt install -q -y locales curl gnupg2 lsb-release && \ @@ -17,8 +17,8 @@ RUN sh -c 'echo "deb [arch=$(dpkg --print-architecture)] http://packages.ros.org RUN export DEBIAN_FRONTEND=noninteractive && \ apt update && \ - apt install -y ros-${ROS_DISTRO}-ros-base git python3-colcon-common-extensions && \ - apt install -y python3-websocket libzmq3-dev libprotobuf-dev protobuf-compiler ros-${ROS_DISTRO}-camera-info-manager && \ + apt install -y ros-${ROS_DISTRO}-ros-base git python3-colcon-common-extensions g++ && \ + apt install -y python3-websocket libzmq3-dev libprotobuf-dev protobuf-compiler ros-${ROS_DISTRO}-image-transport-plugins ros-${ROS_DISTRO}-camera-info-manager && \ apt autoclean && rm -rf /var/lib/apt/lists/* RUN mkdir -p /opt/lge-ros2/src diff --git a/camera_driver_sim/CMakeLists.txt b/camera_driver_sim/CMakeLists.txt index 3d0317ee..a586c0cf 100644 --- a/camera_driver_sim/CMakeLists.txt +++ b/camera_driver_sim/CMakeLists.txt @@ -20,62 +20,49 @@ find_package(rclcpp REQUIRED) find_package(sensor_msgs REQUIRED) find_package(camera_info_manager REQUIRED) find_package(image_transport REQUIRED) -find_package(sim_bridge REQUIRED) find_package(driver_sim REQUIRED) -################################################################################ -# Build -################################################################################ -include_directories(include) - -add_library(${PROJECT_NAME} SHARED - src/CameraDriverSim.cpp -) - -ament_target_dependencies(${PROJECT_NAME} +set(dependencies rclcpp sensor_msgs camera_info_manager image_transport - sim_bridge - driver_sim) - - -add_executable(${PROJECT_NAME}-bin - src/main.cpp + driver_sim ) -target_link_libraries(${PROJECT_NAME}-bin ${PROJECT_NAME}) - -ament_target_dependencies(${PROJECT_NAME}-bin - rclcpp - sim_bridge - driver_sim) - ################################################################################ -# Install (Execution) +# Build ################################################################################ -install(TARGETS ${PROJECT_NAME}-bin DESTINATION lib/${PROJECT_NAME}) -set_target_properties(${PROJECT_NAME}-bin PROPERTIES OUTPUT_NAME ${PROJECT_NAME}) +add_library(${PROJECT_NAME} SHARED + src/main.cpp + src/CameraDriverSim.cpp +) -################################################################################ -# Install (Library) -################################################################################ -ament_export_interfaces(export_${PROJECT_NAME} HAS_LIBRARY_TARGET) -ament_export_include_directories(include) -ament_export_libraries(${PROJECT_NAME} ${dependencies}) +target_include_directories(${PROJECT_NAME} PUBLIC + $ + $ +) -install( - DIRECTORY include/ - DESTINATION include +ament_target_dependencies(${PROJECT_NAME} + ${dependencies} ) -install( - TARGETS ${PROJECT_NAME} - EXPORT export_${PROJECT_NAME} +################################################################################ +# Install +################################################################################ +install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION lib ARCHIVE DESTINATION lib + RUNTIME DESTINATION lib/${PROJECT_NAME} INCLUDES DESTINATION include ) +install(DIRECTORY include/ + DESTINATION include +) + +ament_export_include_directories(include) +ament_export_libraries(${PROJECT_NAME}) +ament_export_dependencies(${dependencies}) + ament_package() \ No newline at end of file diff --git a/camera_driver_sim/include/camera_driver_sim/CameraDriverSim.hpp b/camera_driver_sim/include/camera_driver_sim/CameraDriverSim.hpp index 3293a7c2..7c33b4a2 100644 --- a/camera_driver_sim/include/camera_driver_sim/CameraDriverSim.hpp +++ b/camera_driver_sim/include/camera_driver_sim/CameraDriverSim.hpp @@ -15,8 +15,8 @@ #define _CameraDriverSim_H_ #include -#include -#include +#include +#include #include #include #include diff --git a/depth_camera_driver_sim/CMakeLists.txt b/depth_camera_driver_sim/CMakeLists.txt index 5cc54dd7..0e017316 100644 --- a/depth_camera_driver_sim/CMakeLists.txt +++ b/depth_camera_driver_sim/CMakeLists.txt @@ -17,13 +17,13 @@ endif() ################################################################################ find_package(ament_cmake REQUIRED) find_package(rclcpp REQUIRED) -find_package(sensor_msgs REQUIRED) -find_package(camera_info_manager REQUIRED) -find_package(image_transport REQUIRED) -find_package(sim_bridge REQUIRED) -find_package(driver_sim REQUIRED) find_package(camera_driver_sim REQUIRED) +set(dependencies + rclcpp + camera_driver_sim +) + ################################################################################ # Build ################################################################################ @@ -35,17 +35,14 @@ add_executable(${PROJECT_NAME} ) ament_target_dependencies(${PROJECT_NAME} - rclcpp - sensor_msgs - camera_info_manager - image_transport - sim_bridge - driver_sim - camera_driver_sim) + ${dependencies} +) ################################################################################ # Install ################################################################################ -install(TARGETS ${PROJECT_NAME} DESTINATION lib/${PROJECT_NAME}) +install(TARGETS ${PROJECT_NAME} + RUNTIME DESTINATION lib/${PROJECT_NAME} +) ament_package() diff --git a/driver_sim/CMakeLists.txt b/driver_sim/CMakeLists.txt index e48ec84c..e8b49d48 100644 --- a/driver_sim/CMakeLists.txt +++ b/driver_sim/CMakeLists.txt @@ -16,47 +16,53 @@ endif() find_package(ament_cmake REQUIRED) find_package(rclcpp REQUIRED) -find_package(geometry_msgs REQUIRED) +find_package(tf2_geometry_msgs REQUIRED) find_package(tf2_ros REQUIRED) find_package(sim_bridge REQUIRED) +file(GLOB protobuf_msg_srcs + ./include/protobuf/*.pb.cc +) + +set(dependencies + rclcpp + tf2_geometry_msgs + tf2_ros + sim_bridge +) + ################################################################################ # Build ################################################################################ -include_directories(include) - -FILE(GLOB PROTOBUF_MSG_SRCS - ./include/protobuf/*.pb.cc) - add_library(${PROJECT_NAME} SHARED src/driver_sim.cpp - ${PROTOBUF_MSG_SRCS}) + ${protobuf_msg_srcs} +) + +target_include_directories(${PROJECT_NAME} PRIVATE + $ + $ +) ament_target_dependencies(${PROJECT_NAME} - rclcpp - geometry_msgs - tf2_ros - sim_bridge) + ${dependencies} +) ################################################################################ # Install ################################################################################ -ament_export_interfaces(export_${PROJECT_NAME} HAS_LIBRARY_TARGET) -ament_export_libraries(${PROJECT_NAME} ${dependencies}) -ament_export_include_directories(include) - -install( - DIRECTORY include/ - DESTINATION include -) - -install( - TARGETS ${PROJECT_NAME} - EXPORT export_${PROJECT_NAME} +install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION lib ARCHIVE DESTINATION lib - RUNTIME DESTINATION bin INCLUDES DESTINATION include ) +install(DIRECTORY include/ + DESTINATION include +) + +ament_export_dependencies(${dependencies}) +ament_export_include_directories(include) +ament_export_libraries(${PROJECT_NAME}) + ament_package() \ No newline at end of file diff --git a/driver_sim/src/driver_sim.cpp b/driver_sim/src/driver_sim.cpp index eb6615d5..0dc9132d 100644 --- a/driver_sim/src/driver_sim.cpp +++ b/driver_sim/src/driver_sim.cpp @@ -108,7 +108,7 @@ SimBridge* DriverSim::GetSimBridge(const uint bridge_index) { if (bridge_index >= m_simBridgeList.capacity()) { - DBG_SIM_WRN("Wrong bridge index(%d) / total sim bridges(%d)", bridge_index, m_simBridgeList.capacity()); + DBG_SIM_WRN("Wrong bridge index(%d) / total sim bridges(%lu)", bridge_index, m_simBridgeList.capacity()); return nullptr; } diff --git a/elevator_system_sim/CMakeLists.txt b/elevator_system_sim/CMakeLists.txt index 577f813b..88c63dbe 100644 --- a/elevator_system_sim/CMakeLists.txt +++ b/elevator_system_sim/CMakeLists.txt @@ -16,12 +16,17 @@ endif() # Find colcon packages and libraries for colcon and system dependencies ################################################################################ find_package(ament_cmake REQUIRED) -find_package(rclcpp REQUIRED) find_package(rclcpp_lifecycle REQUIRED) find_package(driver_sim REQUIRED) -find_package(sim_bridge REQUIRED) find_package(elevator_system_msgs REQUIRED) +set(dependencies + rclcpp_lifecycle + rosgraph_msgs + elevator_system_msgs + driver_sim +) + ################################################################################ # Build ################################################################################ @@ -32,20 +37,14 @@ add_executable(${PROJECT_NAME} src/main.cpp) ament_target_dependencies(${PROJECT_NAME} - rclcpp - rclcpp_lifecycle - rosgraph_msgs - elevator_system_msgs - driver_sim - sim_bridge) + ${dependencies} +) ################################################################################ # Install ################################################################################ -install(TARGETS ${PROJECT_NAME} DESTINATION lib/${PROJECT_NAME}) - -################################################################################ -# Test -################################################################################ +install(TARGETS ${PROJECT_NAME} + RUNTIME DESTINATION lib/${PROJECT_NAME} +) ament_package() diff --git a/gps_driver_sim/CMakeLists.txt b/gps_driver_sim/CMakeLists.txt index 77a5c155..3194d6bc 100644 --- a/gps_driver_sim/CMakeLists.txt +++ b/gps_driver_sim/CMakeLists.txt @@ -22,6 +22,13 @@ find_package(geometry_msgs REQUIRED) find_package(sim_bridge REQUIRED) find_package(driver_sim REQUIRED) +set(dependencies + rclcpp + sensor_msgs + geometry_msgs + driver_sim +) + ################################################################################ # Build ################################################################################ @@ -32,19 +39,14 @@ add_executable(${PROJECT_NAME} src/GPSDriverSim.cpp) ament_target_dependencies(${PROJECT_NAME} - rclcpp - sensor_msgs - geometry_msgs - sim_bridge - driver_sim) + ${dependencies} +) ################################################################################ # Install ################################################################################ -install(TARGETS ${PROJECT_NAME} DESTINATION lib/${PROJECT_NAME}) - -################################################################################ -# Test -################################################################################ +install(TARGETS ${PROJECT_NAME} + RUNTIME DESTINATION lib/${PROJECT_NAME} +) ament_package() \ No newline at end of file diff --git a/lidar_driver_sim/CMakeLists.txt b/lidar_driver_sim/CMakeLists.txt index 1e9afbe7..84197f85 100644 --- a/lidar_driver_sim/CMakeLists.txt +++ b/lidar_driver_sim/CMakeLists.txt @@ -19,9 +19,15 @@ find_package(ament_cmake REQUIRED) find_package(rclcpp REQUIRED) find_package(sensor_msgs REQUIRED) find_package(geometry_msgs REQUIRED) -find_package(sim_bridge REQUIRED) find_package(driver_sim REQUIRED) +set(dependencies + rclcpp + sensor_msgs + geometry_msgs + driver_sim +) + ################################################################################ # Build ################################################################################ @@ -32,19 +38,14 @@ add_executable(${PROJECT_NAME} src/LidarDriverSim.cpp) ament_target_dependencies(${PROJECT_NAME} - rclcpp - sensor_msgs - geometry_msgs - sim_bridge - driver_sim) + ${dependencies} +) ################################################################################ # Install ################################################################################ -install(TARGETS ${PROJECT_NAME} DESTINATION lib/${PROJECT_NAME}) - -################################################################################ -# Test -################################################################################ +install(TARGETS ${PROJECT_NAME} + RUNTIME DESTINATION lib/${PROJECT_NAME} +) ament_package() \ No newline at end of file diff --git a/micom_driver_sim/CMakeLists.txt b/micom_driver_sim/CMakeLists.txt index c31806b8..2f072ce3 100644 --- a/micom_driver_sim/CMakeLists.txt +++ b/micom_driver_sim/CMakeLists.txt @@ -20,9 +20,16 @@ find_package(rclcpp REQUIRED) find_package(sensor_msgs REQUIRED) find_package(geometry_msgs REQUIRED) find_package(nav_msgs REQUIRED) -find_package(sim_bridge REQUIRED) find_package(driver_sim REQUIRED) +set(dependencies + rclcpp + sensor_msgs + geometry_msgs + nav_msgs + driver_sim +) + ################################################################################ # Build ################################################################################ @@ -33,21 +40,14 @@ add_executable(${PROJECT_NAME} src/MicomDriverSim.cpp) ament_target_dependencies(${PROJECT_NAME} - rclcpp - std_msgs/ - sensor_msgs - geometry_msgs - nav_msgs - sim_bridge - driver_sim) + ${dependencies} +) ################################################################################ # Install ################################################################################ -install(TARGETS ${PROJECT_NAME} DESTINATION lib/${PROJECT_NAME}) - -################################################################################ -# Test -################################################################################ +install(TARGETS ${PROJECT_NAME} + RUNTIME DESTINATION lib/${PROJECT_NAME} +) ament_package() \ No newline at end of file diff --git a/multi_camera_driver_sim/CMakeLists.txt b/multi_camera_driver_sim/CMakeLists.txt index 2b8d8aae..b95f8e9d 100644 --- a/multi_camera_driver_sim/CMakeLists.txt +++ b/multi_camera_driver_sim/CMakeLists.txt @@ -21,7 +21,14 @@ find_package(sensor_msgs REQUIRED) find_package(camera_info_manager REQUIRED) find_package(image_transport REQUIRED) find_package(driver_sim REQUIRED) -find_package(sim_bridge REQUIRED) + +set(dependencies + rclcpp + sensor_msgs + camera_info_manager + image_transport + driver_sim +) ################################################################################ # Build @@ -34,20 +41,14 @@ add_executable(${PROJECT_NAME} ) ament_target_dependencies(${PROJECT_NAME} - rclcpp - sensor_msgs - camera_info_manager - image_transport - driver_sim - sim_bridge) + ${dependencies} +) ################################################################################ # Install ################################################################################ -install(TARGETS ${PROJECT_NAME} DESTINATION lib/${PROJECT_NAME}) - -################################################################################ -# Test -################################################################################ +install(TARGETS ${PROJECT_NAME} + RUNTIME DESTINATION lib/${PROJECT_NAME} +) -ament_package() +ament_package() \ No newline at end of file diff --git a/multi_camera_driver_sim/include/multi_camera_driver_sim/MultiCameraDriverSim.hpp b/multi_camera_driver_sim/include/multi_camera_driver_sim/MultiCameraDriverSim.hpp index 92851ab6..cc0f8b7e 100644 --- a/multi_camera_driver_sim/include/multi_camera_driver_sim/MultiCameraDriverSim.hpp +++ b/multi_camera_driver_sim/include/multi_camera_driver_sim/MultiCameraDriverSim.hpp @@ -15,8 +15,8 @@ #define _MultiCameraDriverSim_H_ #include -#include -#include +#include +#include #include #include #include diff --git a/realsense_driver_sim/CMakeLists.txt b/realsense_driver_sim/CMakeLists.txt index 325966c0..6937bd03 100644 --- a/realsense_driver_sim/CMakeLists.txt +++ b/realsense_driver_sim/CMakeLists.txt @@ -20,9 +20,16 @@ find_package(rclcpp REQUIRED) find_package(sensor_msgs REQUIRED) find_package(camera_info_manager REQUIRED) find_package(image_transport REQUIRED) -find_package(sim_bridge REQUIRED) find_package(driver_sim REQUIRED) +set(dependencies + rclcpp + sensor_msgs + camera_info_manager + image_transport + driver_sim +) + ################################################################################ # Build ################################################################################ @@ -34,16 +41,14 @@ add_executable(${PROJECT_NAME} ) ament_target_dependencies(${PROJECT_NAME} - rclcpp - sensor_msgs - camera_info_manager - image_transport - sim_bridge - driver_sim) + ${dependencies} +) ################################################################################ # Install ################################################################################ -install(TARGETS ${PROJECT_NAME} DESTINATION lib/${PROJECT_NAME}) +install(TARGETS ${PROJECT_NAME} + RUNTIME DESTINATION lib/${PROJECT_NAME} +) -ament_package() +ament_package() \ No newline at end of file diff --git a/realsense_driver_sim/include/realsense_driver_sim/RealSenseDriverSim.hpp b/realsense_driver_sim/include/realsense_driver_sim/RealSenseDriverSim.hpp index 0689f391..e34d487b 100644 --- a/realsense_driver_sim/include/realsense_driver_sim/RealSenseDriverSim.hpp +++ b/realsense_driver_sim/include/realsense_driver_sim/RealSenseDriverSim.hpp @@ -15,8 +15,8 @@ #define _RealSenseDriverSim_H_ #include -#include -#include +#include +#include #include #include #include diff --git a/sim_bridge/CMakeLists.txt b/sim_bridge/CMakeLists.txt index ad1ebdab..94f973c3 100644 --- a/sim_bridge/CMakeLists.txt +++ b/sim_bridge/CMakeLists.txt @@ -14,41 +14,41 @@ endif() find_package(ament_cmake REQUIRED) -################################################################################ -# Build -################################################################################ -include_directories(include) - set(dependencies zmq - protobuf) + protobuf +) +################################################################################ +# Build +################################################################################ add_library(${PROJECT_NAME} SHARED - src/sim_bridge.cpp) + src/sim_bridge.cpp +) + +target_include_directories(${PROJECT_NAME} PRIVATE + $ + $ +) target_link_libraries(${PROJECT_NAME} PUBLIC - ${dependencies}) + ${dependencies} +) ################################################################################ # Install ################################################################################ -ament_export_interfaces(export_${PROJECT_NAME} HAS_LIBRARY_TARGET) -# ament_export_dependencies(${dependencies}) -ament_export_include_directories(include) -ament_export_libraries(${PROJECT_NAME} ${dependencies}) - -install( - DIRECTORY include/ - DESTINATION include -) - -install( - TARGETS ${PROJECT_NAME} - EXPORT export_${PROJECT_NAME} +install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION lib ARCHIVE DESTINATION lib - # RUNTIME DESTINATION bin INCLUDES DESTINATION include ) +install(DIRECTORY include/ + DESTINATION include +) + +ament_export_include_directories(include) +ament_export_libraries(${PROJECT_NAME} ${dependencies}) + ament_package() \ No newline at end of file diff --git a/sim_bridge/include/sim_bridge/debug_log.h b/sim_bridge/include/sim_bridge/debug_log.h index 77cc80eb..d0b162c0 100644 --- a/sim_bridge/include/sim_bridge/debug_log.h +++ b/sim_bridge/include/sim_bridge/debug_log.h @@ -15,7 +15,7 @@ #ifndef _DEBUG_LOG_H_ #define _DEBUG_LOG_H_ -#include "sim_bridge/term_color.h" +#include "term_color.h" #pragma GCC system_header diff --git a/sim_bridge/include/sim_bridge/sim_bridge.hpp b/sim_bridge/include/sim_bridge/sim_bridge.hpp index 78fa99ff..41c4dbcb 100644 --- a/sim_bridge/include/sim_bridge/sim_bridge.hpp +++ b/sim_bridge/include/sim_bridge/sim_bridge.hpp @@ -16,7 +16,7 @@ #ifndef _SIM_BRIDGE_H_ #define _SIM_BRIDGE_H_ -#include "sim_bridge/debug_log.h" +#include "debug_log.h" #include #include diff --git a/sim_bridge/src/sim_bridge.cpp b/sim_bridge/src/sim_bridge.cpp index 96c338ec..b0232ad5 100644 --- a/sim_bridge/src/sim_bridge.cpp +++ b/sim_bridge/src/sim_bridge.cpp @@ -13,7 +13,7 @@ * SPDX-License-Identifier: MIT */ -#include +#include "sim_bridge/sim_bridge.hpp" #include #include @@ -433,7 +433,7 @@ bool SimBridge::Receive(void** buffer, int& bufferLength, bool isNonBlockingMode { if (&m_msgRx == nullptr || pSockRx_ == nullptr) { - DBG_SIM_ERR("Cannot Receive data due to uninitialized pointer m_msgRx(%p) or pSockRx_(%p)", &m_msgRx, pSockRx_); + DBG_SIM_ERR("Cannot Receive data due to uninitialized pointer m_msgRx(%p) or pSockRx_(%p)", (void*)&m_msgRx, pSockRx_); return false; } @@ -461,7 +461,7 @@ bool SimBridge::Send(const void* buffer, const int bufferLength, bool isNonBlock zmq_msg_t msg; if (pSockTx_ == nullptr || zmq_msg_init_size(&msg, tagSize + bufferLength) < 0) { - DBG_SIM_ERR("Cannot Send data due to uninitialized pointer msg(%p) or pSockTx_(%p)", &msg, pSockTx_); + DBG_SIM_ERR("Cannot Send data due to uninitialized pointer msg(%p) or pSockTx_(%p)", (void*)&msg, pSockTx_); return false; } diff --git a/unity_ros/CMakeLists.txt b/unity_ros/CMakeLists.txt index 25274d88..f98598c0 100644 --- a/unity_ros/CMakeLists.txt +++ b/unity_ros/CMakeLists.txt @@ -12,7 +12,6 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options(-Wall -Wextra -Wpedantic -fstack-protector -O2) endif() - ################################################################################ # Find colcon packages and libraries for colcon and system dependencies ################################################################################ @@ -20,7 +19,12 @@ find_package(ament_cmake REQUIRED) find_package(rclcpp REQUIRED) find_package(rosgraph_msgs REQUIRED) find_package(driver_sim REQUIRED) -find_package(sim_bridge REQUIRED) + +set(dependencies + rclcpp + rosgraph_msgs + driver_sim +) ################################################################################ # Build @@ -29,21 +33,18 @@ include_directories(include) add_executable(${PROJECT_NAME} src/main.cpp - src/unity_ros_init.cpp) + src/unity_ros_init.cpp +) ament_target_dependencies(${PROJECT_NAME} - rclcpp - rosgraph_msgs - driver_sim - sim_bridge) + ${dependencies} +) ################################################################################ # Install ################################################################################ -install(TARGETS ${PROJECT_NAME} DESTINATION lib/${PROJECT_NAME}) - -################################################################################ -# Test -################################################################################ +install(TARGETS ${PROJECT_NAME} + RUNTIME DESTINATION lib/${PROJECT_NAME} +) ament_package() \ No newline at end of file