Skip to content

Commit

Permalink
Migrate to ROS2 Humble with ROS Action support (#27)
Browse files Browse the repository at this point in the history
<!-- Thanks for the contribution, this is awesome. -->

# PR Details
## Description
This PR brings our fork up to date with the ros2 repo that allows the
ros1_bridge to build with all the autoware and carma messages.
This PR also merges ROS action support from here
https://github.com/smith-doug/ros1_bridge/tree/action_bridge_humble
This PR also updates all github action versions and removes
`required-ros-distributions: "noetic rolling"` which is intended to
install the ROS versions from distribution because ROS1 noetic is not
available on 22.04 anymore. By removing it, the `setup-ros` action
installs it from source.
<!--- Describe your changes in detail -->

## Related GitHub Issue
NA
<!--- This project only accepts pull requests related to open GitHub
issues or Jira Keys -->
<!--- If suggesting a new feature or change, please discuss it in an
issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps
to reproduce -->
<!--- Please DO NOT name partially fixed issues, instead open an issue
specific to this fix -->
<!--- Please link to the issue here: -->

## Related Jira Key
[ARC-156](https://usdot-carma.atlassian.net/browse/ARC-156)
<!-- e.g. CAR-123 -->

## Motivation and Context
Upgrade to ROS2 Humble
<!--- Why is this change required? What problem does it solve? -->

## How Has This Been Tested?
Built using dockerhub using carma-msgs Dockerifle in
usdot-fhwa-stol/carma-msgs#248
And tested in cdasim xil carma cloud use case 
<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->

## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->

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

## Checklist:

<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

- [X] I have added any new packages to the sonar-scanner.properties file
- [X] My change requires a change to the documentation.
- [X] 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.
- [X] I have added tests to cover my changes.
- [X] All new and existing tests passed.


[ARC-156]:
https://usdot-carma.atlassian.net/browse/ARC-156?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

---------

Signed-off-by: Jorge Perez <jjperez@ekumenlabs.com>
Signed-off-by: Marco Bassa <marco@robotcloud.eu>
Signed-off-by: Tim Clephas <tim.clephas@nobleo.nl>
Signed-off-by: Geoffrey Biggs <gbiggs@killbots.net>
Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
Signed-off-by: Michael Carroll <michael@openrobotics.org>
Signed-off-by: methylDragon <methylDragon@gmail.com>
Signed-off-by: quarkytale <dharini@openrobotics.org>
Signed-off-by: Dharini Dutia <dharini@openrobotics.org>
Signed-off-by: Andrej Orsula <orsula.andrej@gmail.com>
Signed-off-by: Derek King <derek.king@zebra.com>
Signed-off-by: Loy van Beek <loy.vanbeek@mojin-robotics.de>
Signed-off-by: Nicholas Sims <nicholas.d.sims@gmail.com>
Signed-off-by: Harsh Deshpande <harshavardhan.deshpande@ipa.fraunhofer.de>
Signed-off-by: Victor Lopez <victor.lopez@pal-robotics.com>
Signed-off-by: Olivier Kermorgant <olivier_kermorgant@yahoo.fr>
Signed-off-by: Douglas Smith <douglas.smith@swri.org>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Jorge Perez <jjperez@ekumenlabs.com>
Co-authored-by: Marco Bassa <bassamarco91@gmail.com>
Co-authored-by: Tim Clephas <tim.clephas@nobleo.nl>
Co-authored-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
Co-authored-by: Cem Karan <ckaran@users.noreply.github.com>
Co-authored-by: Geoffrey Biggs <gbiggs@killbots.net>
Co-authored-by: Chris Lalancette <clalancette@openrobotics.org>
Co-authored-by: Michael Carroll <michael@openrobotics.org>
Co-authored-by: methylDragon <methylDragon@gmail.com>
Co-authored-by: quarkytale <dharini@openrobotics.org>
Co-authored-by: xlla <xlla@users.noreply.github.com>
Co-authored-by: Loy van Beek <LoyVanBeek@users.noreply.github.com>
Co-authored-by: Andrej Orsula <orsula.andrej@gmail.com>
Co-authored-by: Derek <derek.king@zebra.com>
Co-authored-by: Audrow Nash <audrow@openrobotics.org>
Co-authored-by: Nick Sims <n.sims@unsw.edu.au>
Co-authored-by: Harsh Deshpande <harshavardhan.deshpande@ipa.fraunhofer.de>
Co-authored-by: Victor Lopez <victor.lopez@pal-robotics.com>
Co-authored-by: Victor Lopez <3469405+v-lopez@users.noreply.github.com>
Co-authored-by: Olivier Kermorgant <olivier_kermorgant@yahoo.fr>
Co-authored-by: Douglas Smith <douglas.smith@swri.org>
Co-authored-by: Felipe Inostroza <pepeinostroza@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 8519970 commit 9d38490
Show file tree
Hide file tree
Showing 27 changed files with 4,273 additions and 406 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@ jobs:
ros1_bridge:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ros-tooling/setup-ros@v0.2
with:
required-ros-distributions: "noetic rolling"
- uses: actions/checkout@v3.1.0
- uses: ros-tooling/setup-ros@v0.6
- name: Build and test ros1-bridge
uses: ros-tooling/action-ros-ci@v0.2
uses: ros-tooling/action-ros-ci@v0.3
with:
package-name: ros1_bridge
target-ros1-distro: noetic
target-ros2-distro: rolling

target-ros2-distro: humble
31 changes: 31 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,32 @@

# Python Caching
__pycache__

# ROS2 Build Folders
build/
_build/
log/
install/

# Editors
.vscode
.idea
.#*
.project
.cproject

*~

# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
Changelog for package ros1_bridge
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0.10.3 (2022-03-29)
-------------------
* Cleanup of README.md (`#342 <https://github.com/ros2/ros1_bridge/issues/342>`_)
* Parametrizing service execution timeout (`#340 <https://github.com/ros2/ros1_bridge/issues/340>`_)
* Fix cpplint error (`#341 <https://github.com/ros2/ros1_bridge/issues/341>`_)
* Update package maintainers (`#335 <https://github.com/ros2/ros1_bridge/issues/335>`_)
* Contributors: Cem Karan, Geoffrey Biggs, Jorge Perez, Marco Bassa, Tim Clephas, Tomoya Fujita

0.10.2 (2021-11-05)
-------------------
* Example for `parameter_bridge` (`#330 <https://github.com/ros2/ros1_bridge/issues/330>`_)
Expand Down
66 changes: 63 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,21 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra)
endif()


set(ACTION_GOAL_RESPONSE_CB_CONST_list "humble;iron")
if("$ENV{ROS_DISTRO}" IN_LIST ACTION_GOAL_RESPONSE_CB_CONST_list)
#set(ACTION_GOAL_RESPONSE_CB_CONST ON)
add_definitions("-DACTION_GOAL_RESPONSE_CB_CONST")
message("Using ACTION_GOAL_RESPONSE_CB_CONST")
endif()

find_package(rmw REQUIRED)

find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rmw_implementation_cmake REQUIRED)
find_package(std_msgs REQUIRED)
find_package(xmlrpcpp REQUIRED)
find_package(rclcpp_action REQUIRED)

# find ROS 1 packages
set(cmake_extras_files cmake/find_ros1_package.cmake cmake/find_ros1_interface_packages.cmake)
Expand All @@ -32,7 +40,10 @@ endif()

find_ros1_package(roscpp)
if(NOT ros1_roscpp_FOUND)
message(WARNING "Failed to find ROS 1 roscpp, skipping...")
if(NOT ROS1_PACKAGES_UNAVAILABLE)
# Only warn if ROS1 packages were expected to be available
message(WARNING "Failed to find ROS 1 roscpp, skipping...")
endif()
# call ament_package() to avoid ament_tools treating this as a plain CMake pkg
ament_package(
CONFIG_EXTRAS ${cmake_extras_files}
Expand All @@ -41,6 +52,11 @@ if(NOT ros1_roscpp_FOUND)
endif()

find_ros1_package(std_msgs REQUIRED)
find_ros1_package(actionlib REQUIRED)

# Dependency that we should only look for if ROS 1 is installed (it's not present on a ROS 2
# system; see https://github.com/ros2/ros1_bridge/pull/331#issuecomment-1188111510)
find_package(xmlrpcpp REQUIRED)

# find ROS 1 packages with messages / services
include(cmake/find_ros1_interface_packages.cmake)
Expand Down Expand Up @@ -74,6 +90,42 @@ if(BUILD_TESTING)
endif()
set(TEST_ROS1_BRIDGE TRUE)
endif()

find_package(ament_cmake_gtest REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(std_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_ros1_package(geometry_msgs)
find_ros1_package(std_msgs)
find_ros1_package(sensor_msgs)
if(ros1_geometry_msgs_FOUND AND ros1_sensor_msgs_FOUND AND ros1_std_msgs_FOUND)
ament_add_gtest(test_convert_generic test/test_convert_generic.cpp)
ament_target_dependencies(test_convert_generic
"geometry_msgs"
"rclcpp"
"ros1_roscpp"
"ros1_sensor_msgs"
"ros1_std_msgs"
"ros1_geometry_msgs"
"sensor_msgs"
"std_msgs"
)
target_link_libraries(test_convert_generic ${PROJECT_NAME})

ament_add_gtest(test_ros2_to_ros1_serialization test/test_ros2_to_ros1_serialization.cpp)
ament_target_dependencies(test_ros2_to_ros1_serialization
"geometry_msgs"
"rclcpp"
"ros1_roscpp"
"ros1_sensor_msgs"
"ros1_std_msgs"
"ros1_geometry_msgs"
"sensor_msgs"
"std_msgs"
)
target_link_libraries(test_ros2_to_ros1_serialization ${PROJECT_NAME})
endif()

endif()

ament_export_include_directories(include)
Expand Down Expand Up @@ -104,7 +156,7 @@ foreach(package_name ${ros2_interface_packages})
file(TO_CMAKE_PATH "${interface_file}" interface_name)
get_filename_component(interface_basename "${interface_name}" NAME_WE)
# skipping actions and request and response messages of services
if(NOT "${interface_name}" MATCHES "^(msg|srv)/" OR "${interface_basename}" MATCHES "_(Request|Response)$")
if(NOT "${interface_name}" MATCHES "^(msg|srv|action)/" OR "${interface_basename}" MATCHES "_(Request|Response)$")
continue()
endif()
string(REPLACE "/" "__" interface_name "${interface_name}")
Expand Down Expand Up @@ -184,6 +236,7 @@ ament_target_dependencies(${PROJECT_NAME}
${prefixed_ros1_message_packages}
${ros2_interface_packages}
"rclcpp"
"rclcpp_action"
"ros1_roscpp"
"ros1_std_msgs")

Expand All @@ -199,6 +252,13 @@ custom_executable(static_bridge
target_link_libraries(static_bridge
${PROJECT_NAME})

custom_executable(action_bridge
"src/action_bridge.cpp"
ROS1_DEPENDENCIES
TARGET_DEPENDENCIES ${ros2_interface_packages})
target_link_libraries(action_bridge
${PROJECT_NAME})

custom_executable(parameter_bridge
"src/parameter_bridge.cpp"
ROS1_DEPENDENCIES
Expand Down
Loading

0 comments on commit 9d38490

Please sign in to comment.