Skip to content

Commit

Permalink
ARC 162 CARMA Messenger Core in ROS2 Humble (#238)
Browse files Browse the repository at this point in the history
# PR Details
## Description

This PR contains changes needed to have carma-messenger-core build with
ROS2 humble.

## Related GitHub Issue

NA

## Related Jira Key

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

## Motivation and Context

Towards ROS2 Humble migration

## How Has This Been Tested?

Build tested locally and confirmed to work with CI changes. CARMA
Messenger starts up as expected when using the
`carma-messenger-config/develop` configuration.

## 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.
- [x] All new and existing tests passed.


[ARC-162]:
https://usdot-carma.atlassian.net/browse/ARC-162?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
  • Loading branch information
john-chrosniak authored Nov 1, 2024
1 parent f0596e2 commit 481c0e6
Show file tree
Hide file tree
Showing 19 changed files with 139 additions and 293 deletions.
28 changes: 2 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
push:
branches:
- develop
- develop-humble
- master
- "release/*"
jobs:
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 @@ -49,26 +50,6 @@ jobs:
- name: Checkout dependencies
run: |
./src/${{ github.event.repository.name }}/carma-messenger-core/docker/checkout.bash -r /opt/carma/ -b ${{ steps.determine-base-branch.outputs.git_branch }}
- 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 @@ -83,11 +64,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
continue-on-error: true
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
13 changes: 12 additions & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,16 @@ on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
determine_docker_org_and_tag:
runs-on: ubuntu-latest
outputs:
docker_organization: ${{ steps.docker-org-and-tag.outputs.docker_organization }}
docker_image_tag: ${{ steps.docker-org-and-tag.outputs.docker_image_tag }}
steps:
- id: docker-org-and-tag
uses: usdot-fhwa-stol/actions/docker-org-and-tag@main
build:
needs: determine_docker_org_and_tag
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -24,7 +33,9 @@ jobs:
with:
context: ./carma-messenger-core/
build-args: |
BRANCH=${{ github.base_ref }}
GIT_BRANCH=${{ github.base_ref }}
DOCKER_TAG=${{ needs.determine_docker_org_and_tag.outputs.docker_image_tag }}
DOCKER_ORG=${{ needs.determine_docker_org_and_tag.outputs.docker_organization }}
- name: Build and Push chevrolet_tahoe_2018 Docker Image
uses: docker/build-push-action@v5
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/dockerhub.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/*"
tags:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Additional documentation can be found on the [Doxygen Source Code Documentation

## System Configuration and Installation

The carma-messenger system is meant to be run using docker. The configuration of carma-messanger is similar, though not identical, to configuring the CARMA Platform following the process described in the document [CARMA Platform Detailed Design - Parameter and Launch Standards for Different Vehicle Configurations.docx](https://usdot-carma.atlassian.net/wiki/spaces/CRMPLT/pages/196182019/CARMA3+Detailed+Design+Documentation). At the moment, the user does not need to configure any folders on the host vehicle except ensuring that the logging directories ```/opt/carma/logs``` and ```/opt/carma/.ros``` exist and are writeable. In addition, the user should utilize the [carma script](https://github.com/usdot-fhwa-stol/CARMAPlatform/blob/master/engineering_tools/carma) and [__carma_autocomplete file](https://github.com/usdot-fhwa-stol/CARMAPlatform/blob/master/engineering_tools/__carma_autocomplete) to launch and manage the system. The carma script can be placed under ```/usr/bin``` and the autocomplete file under ```/etc/bash_completion.d/``` (Ubuntu 16.04).
The carma-messenger system is meant to be run using docker. The configuration of carma-messanger is similar, though not identical, to configuring the CARMA Platform following the process described in the document [CARMA Platform Detailed Design - Parameter and Launch Standards for Different Vehicle Configurations.docx](https://usdot-carma.atlassian.net/wiki/spaces/CRMPLT/pages/196182019/CARMA3+Detailed+Design+Documentation). At the moment, the user does not need to configure any folders on the host vehicle except ensuring that the logging directories ```/opt/carma/logs``` and ```/opt/carma/.ros``` exist and are writeable. In addition, the user should utilize the [carma script](https://github.com/usdot-fhwa-stol/CARMAPlatform/blob/master/engineering_tools/carma) and [__carma_autocomplete file](https://github.com/usdot-fhwa-stol/CARMAPlatform/blob/master/engineering_tools/__carma_autocomplete) to launch and manage the system. The carma script can be placed under ```/usr/bin``` and the autocomplete file under ```/etc/bash_completion.d/```.

```
sudo curl -o /usr/bin/carma -L https://raw.githubusercontent.com/usdot-fhwa-stol/carma-platform/develop/engineering_tools/carma
Expand Down
14 changes: 0 additions & 14 deletions carma-messenger-config/chevrolet_tahoe_2018/bridge.yml

This file was deleted.

This file was deleted.

43 changes: 1 addition & 42 deletions carma-messenger-config/chevrolet_tahoe_2018/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,47 +14,6 @@

# Docker Compose Spec Version
services:
roscore:
image: ${DOCKER_ORG}/carma-base:${DOCKER_TAG}
network_mode: host
container_name: roscore
volumes_from:
- container:carma-config:ro
environment:
- ROS_IP=192.168.0.51
volumes:
- /opt/carma/.ros:/opt/carma/.ros
restart: always
command: roscore

ros1_bridge:
image: ${DOCKER_ORG}/carma-msgs:${DOCKER_TAG}
network_mode: host
container_name: ros1_bridge
volumes_from:
- container:carma-config:ro
environment:
- ROS_IP=192.168.0.51
- ROS_MASTER_URI=http://localhost:11311
volumes:
- /opt/carma/logs:/opt/carma/logs
- /opt/carma/.ros:/home/carma/.ros
# Use the dynamic_bridge instead of the parameter bridge as the number of topics is small enough to pose less of a latency issue
command: bash -c 'wait-for-it.sh localhost:11311 -- rosparam load /opt/carma/vehicle/config/bridge.yml && source ~/.base-image/workspace/install/setup.bash && ros2 run ros1_bridge dynamic_bridge --multi-threads'

messenger:
image: ${DOCKER_ORG}/carma-messenger-core:${DOCKER_TAG}
network_mode: host
container_name: carma-messenger-core
volumes_from:
- container:carma-config:ro
environment:
- ROS_IP=192.168.0.51
volumes:
- /opt/carma/logs:/opt/carma/logs
- /opt/carma/.ros:/opt/carma/.ros
command: wait-for-it.sh localhost:11311 -- roslaunch /opt/carma/vehicle/config/carma-messenger-docker.launch

messenger_ros2:
image: ${DOCKER_ORG}/carma-messenger-core:${DOCKER_TAG}
network_mode: host
Expand All @@ -68,7 +27,7 @@ services:
- /opt/carma/.ros:/home/carma/.ros
- /opt/carma/routes:/opt/carma/routes
- /opt/carma/vehicle:/opt/carma/vehicle
command: bash -c 'source /opt/carma/install_ros2/setup.bash && ros2 launch /opt/carma/vehicle/config/carma-messenger-docker.launch.py'
command: bash -c 'source /opt/carma/install/setup.bash && ros2 launch /opt/carma/vehicle/config/carma-messenger-docker.launch.py'

cohda_dsrc_driver:
image: ${DOCKER_ORG}/carma-cohda-dsrc-driver:${DOCKER_TAG}
Expand Down
14 changes: 0 additions & 14 deletions carma-messenger-config/development/bridge.yml

This file was deleted.

34 changes: 0 additions & 34 deletions carma-messenger-config/development/carma-messenger-docker.launch

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ def generate_launch_description():
"""
Launch CARMA Messenger System.
"""
# Declare record rosbag launch argument
use_rosbag = LaunchConfiguration('use_rosbag')
declare_use_rosbag = DeclareLaunchArgument(
name = 'use_rosbag',
default_value = 'true',
description = "Record a ROS2 bag"
)

# Declare the route file folder launch argument
route_file_folder = LaunchConfiguration('route_file_folder')
Expand All @@ -36,11 +43,13 @@ def generate_launch_description():
core_launch = IncludeLaunchDescription(
PythonLaunchDescriptionSource([ get_package_share_directory('carma-messenger'), '/launch/carma-messenger.launch.py']),
launch_arguments = {
'route_file_folder' : route_file_folder
'route_file_folder' : route_file_folder,
'use_rosbag' : use_rosbag,
}.items()
)

return LaunchDescription([
declare_use_rosbag,
declare_route_file_folder,
core_launch
])
39 changes: 1 addition & 38 deletions carma-messenger-config/development/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,43 +14,6 @@

# Docker Compose Spec Version
services:
roscore:
image: ${DOCKER_ORG}/carma-base:${DOCKER_TAG}
network_mode: host
container_name: roscore
volumes_from:
- container:carma-config:ro
volumes:
- /opt/carma/.ros:/opt/carma/.ros
restart: always
command: roscore

ros1_bridge:
image: ${DOCKER_ORG}/carma-msgs:${DOCKER_TAG}
network_mode: host
container_name: ros1_bridge
volumes_from:
- container:carma-config:ro
environment:
- ROS_MASTER_URI=http://localhost:11311
volumes:
- /opt/carma/logs:/opt/carma/logs
- /opt/carma/.ros:/home/carma/.ros
# Use the dynamic_bridge instead of the parameter bridge as the number of topics is small enough to pose less of a latency issue
command: bash -c 'wait-for-it.sh localhost:11311 -- rosparam load /opt/carma/vehicle/config/bridge.yml && source ~/.base-image/workspace/install/setup.bash && ros2 run ros1_bridge dynamic_bridge --multi-threads'

messenger:
image: ${DOCKER_ORG}/carma-messenger-core:${DOCKER_TAG}
network_mode: host
container_name: carma-messenger-core
volumes_from:
- container:carma-config:ro
volumes:
- /opt/carma/logs:/opt/carma/logs
- /opt/carma/.ros:/opt/carma/.ros
- /opt/carma/vehicle:/opt/carma/vehicle
command: wait-for-it.sh localhost:11311 -- roslaunch /opt/carma/vehicle/config/carma-messenger-docker.launch

messenger_ros2:
image: ${DOCKER_ORG}/carma-messenger-core:${DOCKER_TAG}
network_mode: host
Expand All @@ -62,7 +25,7 @@ services:
- /opt/carma/.ros:/home/carma/.ros
- /opt/carma/routes:/opt/carma/routes
- /opt/carma/vehicle:/opt/carma/vehicle
command: bash -c 'source /opt/carma/install_ros2/setup.bash && ros2 launch /opt/carma/vehicle/config/carma-messenger-docker.launch.py'
command: bash -c 'source /opt/carma/install/setup.bash && ros2 launch /opt/carma/vehicle/config/carma-messenger-docker.launch.py'

cohda_dsrc_driver:
image: ${DOCKER_ORG}/carma-cohda-dsrc-driver:${DOCKER_TAG}
Expand Down
4 changes: 1 addition & 3 deletions carma-messenger-core/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ LABEL org.label-schema.vcs-ref=${VCS_REF}
LABEL org.label-schema.build-date=${BUILD_DATE}

COPY --from=setup /opt/carma/install /opt/carma/install
COPY --from=setup /opt/carma/install_ros2 /opt/carma/install_ros2
RUN sudo chmod -R +x /opt/carma/install

RUN pip install future

CMD [ "wait-for-it.sh", "localhost:11311", "--", "roslaunch", "carma-messenger", "carma-messenger.launch"]
CMD [ "source", "/opt/carma/install/setup.bash", "&&", "ros2", "launch", "carma-messenger", "carma-messenger.launch.py"]
Loading

0 comments on commit 481c0e6

Please sign in to comment.