Skip to content

Commit

Permalink
modifying pacmod3 ros2 driver to work with pacmod2 (#22)
Browse files Browse the repository at this point in the history
* modifying pacmod3 ros2 driver to work with pacmod2

* delete unused code, increment version number, change pub_thread_ to unique_ptr

* remove accidentally added namespace

* foxy update

* fix cpplint stuff

* fix uncrustify stuff

* add CONTRIBUTING.md
  • Loading branch information
cullenstoneAS authored Apr 26, 2023
1 parent d623176 commit f930c78
Show file tree
Hide file tree
Showing 19 changed files with 2,077 additions and 2,436 deletions.
38 changes: 23 additions & 15 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,43 @@
version: 2
jobs:
noetic:
docker:
- image: autonomoustuff/docker-builds:noetic-ros-base
version: 2.1

commands:
ros_build:
steps:
- checkout
- run:
name: Set Up Container
command: |
apt-get update -qq
mkdir $CIRCLE_PROJECT_REPONAME
mv `find -maxdepth 1 -not -name . -not -name $CIRCLE_PROJECT_REPONAME` $CIRCLE_PROJECT_REPONAME/
- run:
name: Install Dependencies
command: |
source /opt/ros/*/setup.bash
rosdep update && rosdep install --from-paths . --ignore-src -y
cd ..
catkin init
catkin config --extend /opt/ros/$ROS_DISTRO
apt update
rosdep update
rosdep install --from-paths . --ignore-src -y
- run:
name: Build
command: |
source /opt/ros/*/setup.bash
cd ..
catkin build
colcon build
- run:
name: Run Tests
command: |
source /opt/ros/*/setup.bash
cd ..
catkin run_tests
catkin_test_results
colcon test --packages-select $CIRCLE_PROJECT_REPONAME
colcon test-result --verbose
jobs:
foxy:
docker:
- image: autonomoustuff/docker-builds:foxy-ros-base
steps:
- ros_build
working_directory: ~/src

workflows:
version: 2
ros_build:
jobs:
- noetic
- foxy
112 changes: 73 additions & 39 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,59 +1,93 @@
cmake_minimum_required(VERSION 2.8.3)
cmake_minimum_required(VERSION 3.5)
project(pacmod2)

## Add support for C++11, supported in ROS Kinetic and newer
# For PACMod, this must be enabled to use mutexes.
add_definitions(-std=c++11)
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()

find_package(catkin REQUIRED COMPONENTS
roscpp
std_msgs
pacmod_msgs
can_msgs
roslint
)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

catkin_package()
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rclcpp_components REQUIRED)
find_package(rclcpp_lifecycle REQUIRED)
find_package(can_msgs REQUIRED)
find_package(pacmod2_msgs REQUIRED)
find_package(std_msgs REQUIRED)

## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
include/
${catkin_INCLUDE_DIRS}
)

## Declare a C++ executable
add_executable(${PROJECT_NAME}
src/pacmod_ros_msg_handler.cpp
src/pacmod_node.cpp
src/pacmod_core.cpp
add_library(
${PROJECT_NAME}_node SHARED
src/pacmod2_ros_msg_handler.cpp
src/pacmod2_core.cpp
src/pacmod2_node.cpp
)

## Add cmake target dependencies of the executable
## same as for the library above
add_dependencies(${PROJECT_NAME}
${${PROJECT_NAME}_EXPORTED_TARGETS}
${catkin_EXPORTED_TARGETS}
target_compile_definitions(
${PROJECT_NAME}_node
PRIVATE "COMPOSITION_BUILDING_DLL"
)
ament_target_dependencies(
${PROJECT_NAME}_node
"rclcpp"
"rclcpp_components"
"rclcpp_lifecycle"
"can_msgs"
"pacmod2_msgs"
"std_msgs"
)
rclcpp_components_register_nodes(
${PROJECT_NAME}_node
"pacmod2::PACMod2Node"
)

## Specify libraries to link a library or executable target against
target_link_libraries(${PROJECT_NAME}
${catkin_LIBRARIES}
add_executable(
${PROJECT_NAME}_driver
src/pacmod2_driver.cpp
)
ament_target_dependencies(
${PROJECT_NAME}_driver
"rclcpp"
"lifecycle_msgs"
)
target_link_libraries(
${PROJECT_NAME}_driver
${PROJECT_NAME}_node
)

set(ROSLINT_CPP_OPTS "--filter=-build/namespaces,-build/c++11")
roslint_cpp()
ament_export_include_directories(include)
ament_export_targets(export_${PROJECT_NAME}_node HAS_LIBRARY_TARGET)
ament_export_libraries(${PROJECT_NAME}_node)

if(CATKIN_ENABLE_TESTING)
roslint_add_test()
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
endif()

install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
install(
TARGETS ${PROJECT_NAME}_node
EXPORT export_${PROJECT_NAME}_node
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)

install(
TARGETS ${PROJECT_NAME}_driver
DESTINATION lib/${PROJECT_NAME}
)

install(DIRECTORY launch/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch
install(
DIRECTORY include/
DESTINATION include
)

install(DIRECTORY launch
DESTINATION share/${PROJECT_NAME}/
)

ament_package()
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Any contribution that you make to this repository will
be under the MIT license, as dictated by that
[license](https://opensource.org/licenses/MIT).
Loading

0 comments on commit f930c78

Please sign in to comment.