Skip to content

Commit

Permalink
update ros2 wrapper build
Browse files Browse the repository at this point in the history
  • Loading branch information
admercs committed Mar 7, 2024
1 parent 8a30a77 commit beba3c4
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/test_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,4 @@ jobs:
- name: "Build ROS2 Wrapper"
# if: ${{ matrix.os == 'ubuntu-20.04' }}
shell: bash
run: |
bash ./scripts/install_ros2_deps.sh
source /opt/ros/*/setup.bash
cd ./ros2
colcon build --cmake-args -DCMAKE_C_COMPILER=gcc-11 --cmake-args -DCMAKE_CXX_COMPILER=g++-11
run: bash ./scripts/build_ros2.sh
2 changes: 1 addition & 1 deletion docs/ros_pkgs.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ catkin build; # or catkin_make
If your default `gcc` version is less than 8 (see `gcc --version` output), compilation will fail. In that case, use `gcc-11` explicitly as follows:

```shell
catkin build -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11
catkin build -DCMAKE_C_COMPILER=/usr/bin/gcc-11 -DCMAKE_CXX_COMPILER=/usr/bin/g++-11
```

## Running `autonomysim_ros_pkgs`
Expand Down
2 changes: 1 addition & 1 deletion docs/ros_pkgs_tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ catkin build autonomysim_tutorial_pkgs
If your default `gcc` is less than or equal to version 8 (see `gcc --version` output), compilation will fail. In that case, use `gcc-11` explicitly as follows:

```shell
catkin build autonomysim_tutorial_pkgs -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11
catkin build autonomysim_tutorial_pkgs -DCMAKE_C_COMPILER=/usr/bin/gcc-11 -DCMAKE_CXX_COMPILER=/usr/bin/g++-11
```

!!! note
Expand Down
17 changes: 16 additions & 1 deletion scripts/install_ros2_deps.sh → scripts/build_ros2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ set -x

# DISTRO="$(lsb_release -sc)"
ARCH="$(dpkg --print-architecture)"
GCC_VERSION='11'
source /etc/os-release # UBUNTU_CODENAME

###
Expand Down Expand Up @@ -50,7 +51,21 @@ sudo apt-get install -y "ros-${ROS_DISTRO}-vision-opencv" "ros-${ROS_DISTRO}-ima
sudo apt-get install -y "ros-${ROS_DISTRO}-tf2-sensor-msgs" "ros-${ROS_DISTRO}-tf2-geometry-msgs" "ros-${ROS_DISTRO}-mavros*"
sudo apt-get install -y python3-pip python3-yaml python3-setuptools python3-colcon-common-extensions

echo 'Adding ROS2 initialization to BASH RC file...'
echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> ~/.bashrc
source "/opt/ros/${ROS_DISTRO}/setup.bash"

echo 'Success: ROS2 dependencies installed.'
echo '-------------------------------------------------------------------------------'
echo 'Success: AutonomySim ROS2 wrapper dependencies installed.'
echo '-------------------------------------------------------------------------------'
echo ''
echo 'Building AutonomySim ROS2 Wrapper...'

source "/opt/ros/${ROS_DISTRO}/setup.bash"
pushd ./ros2
colcon build --cmake-args "-DCMAKE_C_COMPILER=/usr/bin/gcc-${GCC_VERSION}" --cmake-args "-DCMAKE_CXX_COMPILER=/usr/bin/g++-${GCC_VERSION}"
popd

echo '-------------------------------------------------------------------------------'
echo 'Success: AutonomySim ROS2 wrapper built.'
echo '-------------------------------------------------------------------------------'

0 comments on commit beba3c4

Please # to comment.