Skip to content

Commit

Permalink
ARC 157 Remove ROS2 Foxy Specific Code (#240)
Browse files Browse the repository at this point in the history
# PR Details
## Description

This PR removes code that was specific to ROS2 Foxy since we plan to
only support Humble in future releases.

## Related GitHub Issue

NA

## Related Jira Key

[ARC-157](https://usdot-carma.atlassian.net/browse/ARC-157)

## Motivation and Context

Part of our migration towards ROS2 Humble.

## How Has This Been Tested?

Code was built inside of the ROS2 Humble carma-base docker image.

## Types of changes

- [ ] Defect fix (non-breaking change that fixes an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [x] Breaking change (fix or feature that cause existing functionality
to change)

## Checklist:

- [ ] I have added any new packages to the sonar-scanner.properties file
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [x] I have read the
[**CONTRIBUTING**](https://github.com/usdot-fhwa-stol/carma-platform/blob/develop/Contributing.md)
document.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.


[ARC-157]:
https://usdot-carma.atlassian.net/browse/ARC-157?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
  • Loading branch information
john-chrosniak authored Oct 22, 2024
2 parents 0746703 + b407b05 commit 016bac0
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 387 deletions.
27 changes: 2 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
branches:
- develop
- develop-humble
- master
- "release/*"
pull_request:
Expand All @@ -27,7 +28,7 @@ jobs:
image: ${{ needs.determine_docker_org_and_tag.outputs.docker_organization }}/carma-base:${{ needs.determine_docker_org_and_tag.outputs.docker_image_tag }}
env:
INIT_ENV: "/home/carma/.base-image/init-env.sh"
ROS_2_ENV: "/opt/ros/foxy/setup.bash"
ROS_2_ENV: "/opt/ros/humble/setup.bash"
TERM: xterm
options: "--user root"
steps:
Expand All @@ -50,26 +51,6 @@ jobs:
run: |
source "$INIT_ENV"
git clone -b ${{ steps.determine-base-branch.outputs.git_branch }} --depth 1 https://github.com/usdot-fhwa-stol/carma-msgs.git src/CARMAMsgs
- name: Build ROS1
run: |
source "$INIT_ENV"
PACKAGES=$(find . -maxdepth 2 -type f -name package.xml | sed 's/\.\///' | cut -d/ -f1)
sed -i '/colcon build/ s/$/ --parallel-workers 4 --packages-up-to $PACKAGES/' /home/carma/.ci-image/engineering_tools/code_coverage/make_with_coverage.bash
make_with_coverage.bash -m -e /opt/carma/ -o ./coverage_reports/gcov
- name: Run ROS1 C++ Tests
continue-on-error: true
run: |
source "$INIT_ENV"
sed -i '/colcon test/ s/$/ --parallel-workers 4 --packages-above $PACKAGES/' /home/carma/.ci-image/engineering_tools/code_coverage/make_with_coverage.bash
make_with_coverage.bash -t -e /opt/carma/ -o ./coverage_reports/gcov
- name: Backup ROS1 compile_commands.json
run: |
mv /opt/carma/build/compile_commands.json /opt/carma/compile_commands.ros1.json
- name: Cleanup before ROS 2 build
# Clear the build and install folders before building ROS 2
run: |
rm -rf /opt/carma/install
rm -rf /opt/carma/build
- name: Build ROS2
run: |
source "$INIT_ENV"
Expand All @@ -84,10 +65,6 @@ jobs:
source "$ROS_2_ENV"
sed -i '/colcon test/ s/$/ --parallel-workers 4 --packages-above $PACKAGES/' /home/carma/.ci-image/engineering_tools/code_coverage/make_with_coverage.bash
make_with_coverage.bash -t -e /opt/carma/ -o ./coverage_reports/gcov
- name: Combine ROS1 and ROS2 compile_commands.json files
run: |
mv /opt/carma/build/compile_commands.json /opt/carma/compile_commands.ros2.json
jq -s add /opt/carma/compile_commands.ros1.json /opt/carma/compile_commands.ros2.json > /opt/carma/build/compile_commands.json
- name: Run SonarScanner
uses: usdot-fhwa-stol/actions/sonar-scanner@main
with:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The primary CARMAPlatform repository can be found [here](https://github.com/usdo
github organization. Documentation on how the CARMAPlatform functions, how it will evolve over time, and how you can contribute can be found at the above links as well

## Current Status of ROS 1 and ROS 2 Packages
The current CARMA Platform system operates as a hybrid of ROS 1 Noetic and ROS 2 Foxy components. While nearly all components have been upgraded to ROS 2 Foxy, a small amount of ROS 1 Noetic content still exists within the system, including some packages in this repository. For more information, please see the relevant documentation in the [carma-config](https://github.com/usdot-fhwa-stol/carma-config?tab=readme-ov-file#current-status-of-hybrid-ros-1ros-2-system) repository.
The current CARMA Platform system operates as a hybrid of ROS 1 Noetic and ROS 2 Humble components. While nearly all components have been upgraded to ROS 2 Humble, a small amount of ROS 1 Noetic content still exists within the system, including some packages in this repository. For more information, please see the relevant documentation in the [carma-config](https://github.com/usdot-fhwa-stol/carma-config?tab=readme-ov-file#current-status-of-hybrid-ros-1ros-2-system) repository.

## Contribution
Welcome to the CARMA contributing guide. Please read this guide to learn about our development process, how to propose pull requests and improvements, and how to build and test your changes to this project. [CARMA Contributing Guide](https://github.com/usdot-fhwa-stol/carma-platform/blob/develop/Contributing.md)
Expand Down
27 changes: 0 additions & 27 deletions carma_ros2_utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,6 @@ include(dependencies.cmake)

carma_package()

# TODO(CAR-6017): Remove when we drop support for Foxy
# rclcpp_lifecycle has breaking API changes starting with Humble
if(("$ENV{ROS_DISTRO}" STREQUAL "foxy") OR ("$ENV{ROS_DISTRO}" STREQUAL "galactic"))
set(carma_ros2_utils_LIFECYCLE_PUBLISHER_INTERFACE_TYPE
rclcpp_lifecycle::LifecyclePublisherInterface
)
else()
set(carma_ros2_utils_LIFECYCLE_PUBLISHER_INTERFACE_TYPE
rclcpp_lifecycle::ManagedEntityInterface
)
endif()

configure_file(
src/carma_lifecycle_node.hpp.in
carma_ros2_utils/carma_lifecycle_node.hpp
)

ament_auto_add_library(carma_ros2_utils SHARED
src/carma_lifecycle_node.cpp
)
Expand All @@ -50,11 +33,6 @@ target_include_directories(carma_ros2_utils

include(GNUInstallDirs)

INSTALL(FILES ${PROJECT_BINARY_DIR}/carma_ros2_utils/carma_lifecycle_node.hpp
DESTINATION
${CMAKE_INSTALL_INCLUDEDIR}/carma_ros2_utils
)

ament_auto_add_library(carma_ros2_utils_timers SHARED
src/timers/testing/TestTimer.cpp
src/timers/testing/TestTimerFactory.cpp
Expand Down Expand Up @@ -88,11 +66,6 @@ ament_auto_add_executable(carma_component_container_mt
)

if(BUILD_TESTING)
# These CMake commands were added to ament_cmake_auto in ROS 2 Humble. Until
# CARMA supports ROS 2 Humble, we will use package-local copies.
include(cmake/ament_auto_find_test_dependencies.cmake)
include(cmake/ament_auto_add_gtest.cmake)

ament_auto_add_executable(test_carma_lifecycle_node
test/test_node.cpp
)
Expand Down
112 changes: 0 additions & 112 deletions carma_ros2_utils/cmake/ament_auto_add_gtest.cmake

This file was deleted.

41 changes: 0 additions & 41 deletions carma_ros2_utils/cmake/ament_auto_find_test_dependencies.cmake

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,6 @@
* the License.
*/

/*
* TODO(CAR-6017): When we drop support for Foxy:
* - replace CMake substitution strings with rclcpp::ManagedEntityInterface
* - drop the .in filename suffix
* - relocate file to include/ directory
*/

/**
* This file is loosely based on the reference architecture developed by OSRF for Leidos located here
* https://github.com/mjeronimo/carma2/blob/master/carma_utils/carma_utils/include/carma_utils/carma_lifecycle_node.hpp
Expand Down Expand Up @@ -107,16 +100,16 @@ namespace carma_ros2_utils
virtual ~CarmaLifecycleNode();

/**
* \brief Overrides: See https://github.com/ros2/rclcpp/blob/foxy/rclcpp_lifecycle/include/rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp for their details
* \brief Overrides: See https://github.com/ros2/rclcpp/blob/humble/rclcpp_lifecycle/include/rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp for their details
* NOTE: These methods are NOT meant to be used by extending classes. Instead the corresponding handle_<method> methods should be used
* to ensure the full CARMALifecycleNode functionality is employed.
*/
carma_ros2_utils::CallbackReturn on_configure(const rclcpp_lifecycle::State &prev_state) override;
carma_ros2_utils::CallbackReturn on_activate(const rclcpp_lifecycle::State &prev_state) override;
carma_ros2_utils::CallbackReturn on_deactivate(const rclcpp_lifecycle::State &prev_state) override;
carma_ros2_utils::CallbackReturn on_cleanup(const rclcpp_lifecycle::State &prev_state) override;
carma_ros2_utils::CallbackReturn on_error(const rclcpp_lifecycle::State &prev_state) override;
carma_ros2_utils::CallbackReturn on_shutdown(const rclcpp_lifecycle::State &prev_state) override;
carma_ros2_utils::CallbackReturn on_configure(const rclcpp_lifecycle::State &prev_state) override final;
carma_ros2_utils::CallbackReturn on_activate(const rclcpp_lifecycle::State &prev_state) override final;
carma_ros2_utils::CallbackReturn on_deactivate(const rclcpp_lifecycle::State &prev_state) override final;
carma_ros2_utils::CallbackReturn on_cleanup(const rclcpp_lifecycle::State &prev_state) override final;
carma_ros2_utils::CallbackReturn on_error(const rclcpp_lifecycle::State &prev_state) override final;
carma_ros2_utils::CallbackReturn on_shutdown(const rclcpp_lifecycle::State &prev_state) override final;

/**
* \brief Callback triggered when transitioning from UNCONFIGURED to INACTIVE due to the configure signal.
Expand Down Expand Up @@ -274,7 +267,7 @@ namespace carma_ros2_utils
/**
* \brief Method to create a timer whose lifecycle can be managed by this node.
*
* NOTE: In foxy the LifecycleNode api is slightly out of sync with the node api so there is not a create_timer method there. We use rclcpp directly here
* NOTE: In humble the LifecycleNode api is slightly out of sync with the node api so there is not a create_timer method there. We use rclcpp directly here
*
* \param clock The underlying clock to use for the timer.
* \param period The period of trigger of the timer.
Expand All @@ -299,8 +292,6 @@ namespace carma_ros2_utils
* \brief Override of rclcpp method. See descriptive comments here:
* https://github.com/ros2/rclcpp/blob/4859c4e43576d0c6fe626679b2c2604a9a8b336c/rclcpp_lifecycle/include/rclcpp_lifecycle/lifecycle_node.hpp#L271
*
* NOTE: In foxy the LifecycleNode api is slightly out of sync with the node api so there is not a create_service method there. We use rclcpp directly here
*
* NOTE: The function object passed to this method will be moved using std::move.
* The user should therefore assume ownership of this function object has been relinquished
*/
Expand Down Expand Up @@ -409,12 +400,8 @@ namespace carma_ros2_utils
std::shared_ptr<rclcpp_lifecycle::LifecyclePublisher<carma_msgs::msg::SystemAlert>>
system_alert_pub_;

/*
* TODO(CAR-6017): Refactor when we transition to Humble.
* LifecyclePublisherInterface was replaced with ManagedEntityInterface in Humble
*/
//! A list of lifecycle publishers produced from this node whose lifetimes can be managed
std::vector<std::shared_ptr<@carma_ros2_utils_LIFECYCLE_PUBLISHER_INTERFACE_TYPE@>> lifecycle_publishers_;
std::vector<std::shared_ptr<rclcpp_lifecycle::ManagedEntityInterface>> lifecycle_publishers_;

//! A list of timers produced from this node whose lifetimes can be managed
std::vector<std::shared_ptr<rclcpp::TimerBase>> timers_;
Expand Down
5 changes: 0 additions & 5 deletions ros2_lifecycle_manager/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ ament_auto_add_library(ros2_lifecycle_manager SHARED
)

if(BUILD_TESTING)
# These CMake commands were added to ament_cmake_auto in ROS 2 Humble. Until
# CARMA supports ROS 2 Humble, we will use package-local copies.
include(cmake/ament_auto_find_test_dependencies.cmake)
include(cmake/ament_auto_add_gtest.cmake)

ament_auto_add_executable(test_lifecycle_node
test/test_node.cpp
)
Expand Down
Loading

0 comments on commit 016bac0

Please sign in to comment.