Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ROS 2 support #27

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:
- {ROS_DISTRO: melodic, ROS_REPO: main}
- {ROS_DISTRO: noetic, ROS_REPO: testing}
- {ROS_DISTRO: noetic, ROS_REPO: main}
# - {ROS_DISTRO: dashing, ROS_REPO: testing}
# - {ROS_DISTRO: dashing, ROS_REPO: main}
# - {ROS_DISTRO: eloquent, ROS_REPO: testing}
# - {ROS_DISTRO: eloquent, ROS_REPO: main}
# - {ROS_DISTRO: foxy, ROS_REPO: testing}
# - {ROS_DISTRO: foxy, ROS_REPO: main}
- {ROS_DISTRO: dashing, ROS_REPO: testing}
- {ROS_DISTRO: dashing, ROS_REPO: main}
- {ROS_DISTRO: eloquent, ROS_REPO: testing}
- {ROS_DISTRO: eloquent, ROS_REPO: main}
- {ROS_DISTRO: foxy, ROS_REPO: testing}
- {ROS_DISTRO: foxy, ROS_REPO: main}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.idea/
cmake-build-*/
venv/
162 changes: 107 additions & 55 deletions swri_profiler/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,71 +1,123 @@
cmake_minimum_required(VERSION 2.8.3)
cmake_minimum_required(VERSION 3.5)
project(swri_profiler)

set(BUILD_DEPS
diagnostic_updater
roscpp
rospy
std_msgs
swri_profiler_msgs
)
find_package(Boost REQUIRED COMPONENTS thread)

set(RUNTIME_DEPS
diagnostic_updater
roscpp
rospy
std_msgs
swri_profiler_msgs
)


### Catkin ###
find_package(catkin REQUIRED COMPONENTS ${BUILD_DEPS})
if ($ENV{ROS_VERSION} EQUAL 1)
set(BUILD_DEPS
diagnostic_updater
std_msgs
swri_profiler_msgs
roscpp
)

include_directories(include
${catkin_INCLUDE_DIRS})
### Catkin ###
find_package(catkin REQUIRED COMPONENTS ${BUILD_DEPS})

catkin_package(CATKIN_DEPENDS ${RUNTIME_DEPS}
INCLUDE_DIRS include
LIBRARIES ${PROJECT_NAME})
include_directories(include
${catkin_INCLUDE_DIRS})
catkin_package(CATKIN_DEPENDS ${BUILD_DEPS} rospy
INCLUDE_DIRS include
LIBRARIES ${PROJECT_NAME}
)

add_library(${PROJECT_NAME}
src/profiler.cpp
)
target_link_libraries(${PROJECT_NAME}
${catkin_LIBRARIES}
Boost::thread
)
set_target_properties(${PROJECT_NAME} PROPERTIES
COMPILE_FLAGS "-std=c++11"
)

add_library(${PROJECT_NAME}
src/profiler.cpp
add_executable(basic_profiler_example_node src/nodes/basic_profiler_example_node.cpp)
target_link_libraries(basic_profiler_example_node ${PROJECT_NAME})
set_target_properties(basic_profiler_example_node PROPERTIES
COMPILE_FLAGS "-std=c++11"
)
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES})
set_target_properties(${PROJECT_NAME} PROPERTIES
COMPILE_FLAGS "-std=c++11"
)

add_executable(basic_profiler_example_node src/nodes/basic_profiler_example_node.cpp)
target_link_libraries(basic_profiler_example_node ${PROJECT_NAME})
set_target_properties(basic_profiler_example_node PROPERTIES
COMPILE_FLAGS "-std=c++11"
)
add_dependencies(${PROJECT_NAME} swri_profiler_msgs_generate_messages_cpp)

add_dependencies(${PROJECT_NAME} swri_profiler_msgs_generate_messages_cpp)
### Install Test Node and Headers ###
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
)

### Install Test Node and Headers ###
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
)
install(TARGETS ${PROJECT_NAME}
basic_profiler_example_node
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
)

install(TARGETS ${PROJECT_NAME}
basic_profiler_example_node
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
)
catkin_install_python(PROGRAMS scripts/record_profiler_data scripts/profiler_server
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

catkin_install_python(PROGRAMS scripts/record_profiler_data scripts/profiler_server
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
install(DIRECTORY launch
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)

install(DIRECTORY launch
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
install(DIRECTORY html/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/html
)
else()
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()

find_package(ament_cmake REQUIRED)
find_package(diagnostic_updater REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
find_package(swri_profiler_msgs REQUIRED)

add_library(${PROJECT_NAME}
src/profiler.cpp
)
target_compile_definitions(${PROJECT_NAME}
PUBLIC "-DROS2_BUILD"
)
target_include_directories(${PROJECT_NAME}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
target_link_libraries(${PROJECT_NAME}
PUBLIC
Boost::thread
)
ament_target_dependencies(${PROJECT_NAME}
PUBLIC
diagnostic_updater
rclcpp
std_msgs
swri_profiler_msgs
)

install(DIRECTORY html/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/html
)
add_executable(basic_profiler_example_node src/nodes/basic_profiler_example_node.cpp)
target_link_libraries(basic_profiler_example_node
${PROJECT_NAME}
)

install(DIRECTORY include/
DESTINATION include
)
install(DIRECTORY launch
DESTINATION share/${PROJECT_NAME}
FILES_MATCHING PATTERN "*.py" PATTERN "*.launch"
)
install(TARGETS ${PROJECT_NAME} basic_profiler_example_node
RUNTIME DESTINATION lib/${PROJECT_NAME}
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
install(PROGRAMS scripts/profiler_server scripts/record_profiler_data
DESTINATION lib/${PROJECT_NAME}
)
ament_export_include_directories(include)
ament_export_libraries(${PROJECT_NAME})
ament_package()
endif()
Loading