Skip to content

Commit

Permalink
revert from installation for foxy distro on ubuntu 20
Browse files Browse the repository at this point in the history
  • Loading branch information
SamerKhshiboun committed Apr 3, 2024
1 parent 1443278 commit fb4da86
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 24 deletions.
36 changes: 29 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@ jobs:
strategy:
fail-fast: false
matrix:
ros_distro: [rolling, iron, humble]
ros_distro: [rolling, iron, humble, foxy]
include:
- ros_distro: 'rolling'
os: ubuntu-22.04
- ros_distro: 'iron'
os: ubuntu-22.04
- ros_distro: 'humble'
os: ubuntu-22.04
- ros_distro: 'foxy'
os: ubuntu-20.04

steps:

Expand All @@ -50,13 +52,27 @@ jobs:
cd ${{github.workspace}}/ros2/src/realsense-ros/scripts
./pr_check.sh
- name: build ROS2
# setup-ros@v0.6 is the last version supporting foxy (EOL)
# setup-ros@v0.7 is needed to support humble/iron/rolling
# so, seperating steps with if conditions
- name: build ROS2 for foxy
if: ${{ matrix.ros_distro == 'foxy' }}
uses: ros-tooling/setup-ros@v0.6
with:
required-ros-distributions: ${{ matrix.ros_distro }}
- name: build ROS2 for humble/iron/rolling
if: ${{ matrix.ros_distro != 'foxy' }}
uses: ros-tooling/setup-ros@v0.7
with:
required-ros-distributions: ${{ matrix.ros_distro }}

- name: Build RealSense SDK 2.0 from source
- name: Build RealSense SDK 2.0 (development branch) from source
run: |
# libusb-1.0-0-dev is needed for librealsense build in ubuntu 20.04
# This apt install command will be ignored in ubuntu 22.04 as libusb-1.0-0-dev already installed there
sudo apt install -y libusb-1.0-0-dev
cd ${{github.workspace}}
git clone https://github.com/IntelRealSense/librealsense.git -b development
cd librealsense
Expand All @@ -68,13 +84,13 @@ jobs:
sudo make -j10
sudo make install
- name: Build RealSense ROS2 Wrapper
run: |
- name: Build RealSense ROS2 Wrapper from source
run: |
echo "source /opt/ros/${{ matrix.ros_distro }}/setup.bash" >> ${{github.workspace}}/.bashrc
source ${{github.workspace}}/.bashrc
cd ${{github.workspace}}/ros2
echo "================= ROSDEP UPDATE ====================="
rosdep update --rosdistro ${{ matrix.ros_distro }}
rosdep update --rosdistro ${{ matrix.ros_distro }} --include-eol-distros
echo "================= ROSDEP INSTALL ===================="
rosdep install -i --reinstall --from-path src --rosdistro ${{ matrix.ros_distro }} --skip-keys=librealsense2 -y
echo "================== COLCON BUILD ======================"
Expand Down Expand Up @@ -103,10 +119,16 @@ jobs:
cd ${{github.workspace}}/ros2
source ${{github.workspace}}/.bashrc
. install/local_setup.bash
# the next command might be needed for foxy distro, since this package is not installed
# by default in ubuntu 20.04. For other distro, the apt install command will be ignored.
sudo apt install -y ros-${{matrix.ros_distro}}-sensor-msgs-py
python3 src/realsense-ros/realsense2_camera/scripts/rs2_test.py non_existent_file
# don't run integration tests for foxy since some testing dependecies packages like
# tf_ros_py are not avaialble
# TODO: check when we can run integration tests on rolling
- name: Run integration tests
if: ${{ matrix.ros_distro != 'rolling'}}
if: ${{ matrix.ros_distro != 'rolling' && matrix.ros_distro != 'foxy' }}
run: |
cd ${{github.workspace}}/ros2
source ${{github.workspace}}/.bashrc
Expand Down
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
[![rolling][rolling-badge]][rolling]
[![iron][iron-badge]][iron]
[![humble][humble-badge]][humble]
[![foxy][foxy-badge]][foxy]
[![ubuntu22][ubuntu22-badge]][ubuntu22]
[![ubuntu20][ubuntu20-badge]][ubuntu20]

Expand Down Expand Up @@ -90,6 +91,8 @@
- #### Ubuntu 22.04:
- [ROS2 Iron](https://docs.ros.org/en/iron/Installation/Ubuntu-Install-Debians.html)
- [ROS2 Humble](https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html)
#### Ubuntu 20.04
- [ROS2 Foxy](https://docs.ros.org/en/foxy/Installation/Ubuntu-Install-Debians.html)
</details>

<details>
Expand All @@ -103,7 +106,7 @@
- Otherwise, install from [Linux Debian Installation Guide](https://github.com/IntelRealSense/librealsense/blob/master/doc/distribution_linux.md#installing-the-packages)
- In this case treat yourself as a developer: make sure to follow the instructions to also install librealsense2-dev and librealsense2-dkms packages

- #### Option 2: Install librealsense2 (without graphical tools and examples) debian package from ROS servers:
- #### Option 2: Install librealsense2 (without graphical tools and examples) debian package from ROS servers. (Foxy EOL distro is not supported by this option)
- [Configure](http://wiki.ros.org/Installation/Ubuntu/Sources) your Ubuntu repositories
- Install all realsense ROS packages by ```sudo apt install ros-<ROS_DISTRO>-librealsense2*```
- For example, for Humble distro: ```sudo apt install ros-humble-librealsense2*```
Expand All @@ -119,7 +122,7 @@
Step 3: Install Intel&reg; RealSense&trade; ROS2 wrapper
</summary>

#### Option 1: Install debian package from ROS servers
#### Option 1: Install debian package from ROS servers (Foxy EOL distro is not supported by this option)
- [Configure](http://wiki.ros.org/Installation/Ubuntu/Sources) your Ubuntu repositories
- Install all realsense ROS packages by ```sudo apt install ros-<ROS_DISTRO>-realsense2-*```
- For example, for Humble distro: ```sudo apt install ros-humble-realsense2-*```
Expand Down Expand Up @@ -153,7 +156,7 @@

- Source environment
```bash
ROS_DISTRO=<YOUR_SYSTEM_ROS_DISTRO> # set your ROS_DISTRO: iron, humble
ROS_DISTRO=<YOUR_SYSTEM_ROS_DISTRO> # set your ROS_DISTRO: iron, humble, foxy
source /opt/ros/$ROS_DISTRO/setup.bash
cd ~/ros2_ws
. install/local_setup.bash
Expand All @@ -176,10 +179,11 @@
- Manual install from ROS2 formal documentation:
- [ROS2 Iron](https://docs.ros.org/en/iron/Installation/Windows-Install-Binary.html)
- [ROS2 Humble](https://docs.ros.org/en/humble/Installation/Windows-Install-Binary.html)
- [ROS2 Foxy](https://docs.ros.org/en/foxy/Installation/Windows-Install-Binary.html)
- Microsoft IOT binary installation:
- https://ms-iot.github.io/ROSOnWindows/GettingStarted/SetupRos2.html
- Pay attention that the examples of install are for Foxy distro (which is not supported anymore by RealSense ROS2 Wrapper)
- Please replace the word "Foxy" with Humble or Iron, as you choose
- Please replace the word "Foxy" with Humble or Iron, depends on the chosen distro.
</details>

<details>
Expand Down Expand Up @@ -676,6 +680,8 @@ ros2 launch realsense2_camera rs_intra_process_demo_launch.py intra_process_comm

[rolling-badge]: https://img.shields.io/badge/-ROLLING-orange?style=flat-square&logo=ros
[rolling]: https://docs.ros.org/en/rolling/index.html
[foxy-badge]: https://img.shields.io/badge/-foxy-orange?style=flat-square&logo=ros
[foxy]: https://docs.ros.org/en/foxy/index.html
[humble-badge]: https://img.shields.io/badge/-HUMBLE-orange?style=flat-square&logo=ros
[humble]: https://docs.ros.org/en/humble/index.html
[iron-badge]: https://img.shields.io/badge/-IRON-orange?style=flat-square&logo=ros
Expand Down
6 changes: 5 additions & 1 deletion realsense2_camera/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,11 @@ endif()
if(NOT DEFINED ENV{ROS_DISTRO})
message(FATAL_ERROR "ROS_DISTRO is not defined." )
endif()
if("$ENV{ROS_DISTRO}" STREQUAL "humble")
if("$ENV{ROS_DISTRO}" STREQUAL "foxy")
message(STATUS "Build for ROS2 Foxy")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DFOXY")
set(SOURCES "${SOURCES}" src/ros_param_backend.cpp)
elseif("$ENV{ROS_DISTRO}" STREQUAL "humble")
message(STATUS "Build for ROS2 Humble")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHUMBLE")
set(SOURCES "${SOURCES}" src/ros_param_backend.cpp)
Expand Down
22 changes: 11 additions & 11 deletions realsense2_camera/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@
<depend>tf2</depend>
<depend>tf2_ros</depend>
<depend>diagnostic_updater</depend>
<test_depend>ament_cmake_gtest</test_depend>
<test_depend>launch_testing</test_depend>
<test_depend>ament_cmake_pytest</test_depend>
<test_depend>launch_pytest</test_depend>
<test_depend>sensor_msgs_py</test_depend>
<test_depend>python3-numpy</test_depend>
<test_depend>python3-tqdm</test_depend>
<test_depend>sensor_msgs_py</test_depend>
<test_depend>python3-requests</test_depend>
<test_depend>tf2_ros_py</test_depend>
<test_depend>ros2topic</test_depend>
<test_depend condition="$ROS_DISTRO != foxy">ament_cmake_gtest</test_depend>
<test_depend condition="$ROS_DISTRO != foxy">launch_testing</test_depend>
<test_depend condition="$ROS_DISTRO != foxy">ament_cmake_pytest</test_depend>
<test_depend condition="$ROS_DISTRO != foxy">launch_pytest</test_depend>
<test_depend condition="$ROS_DISTRO != foxy">sensor_msgs_py</test_depend>
<test_depend condition="$ROS_DISTRO != foxy">python3-numpy</test_depend>
<test_depend condition="$ROS_DISTRO != foxy">python3-tqdm</test_depend>
<test_depend condition="$ROS_DISTRO != foxy">sensor_msgs_py</test_depend>
<test_depend condition="$ROS_DISTRO != foxy">python3-requests</test_depend>
<test_depend condition="$ROS_DISTRO != foxy">tf2_ros_py</test_depend>
<test_depend condition="$ROS_DISTRO != foxy">ros2topic</test_depend>

<exec_depend>launch_ros</exec_depend>
<build_depend>ros_environment</build_depend>
Expand Down
7 changes: 7 additions & 0 deletions realsense2_camera/src/base_realsense_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,14 @@ rclcpp::Time BaseRealSenseNode::frameSystemTimeSec(rs2::frame frame)
{
double elapsed_camera_ns = millisecondsToNanoseconds(timestamp_ms - _camera_time_base);

/*
Fixing deprecated-declarations compilation error for EOL distro (foxy)
*/
#if defined(FOXY)
auto duration = rclcpp::Duration(elapsed_camera_ns);
#else
auto duration = rclcpp::Duration::from_nanoseconds(elapsed_camera_ns);
#endif

return rclcpp::Time(_ros_time_base + duration);
}
Expand Down
6 changes: 5 additions & 1 deletion realsense2_camera/src/dynamic_params.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,11 @@ namespace realsense2_camera
try
{
ROS_DEBUG_STREAM("setParam::Setting parameter: " << param_name);
descriptor.dynamic_typing=true; // Without this, undeclare_parameter() throws error.
#if defined(FOXY)
//do nothing for old versions (foxy)
#else
descriptor.dynamic_typing=true;
#endif
if (!_node.get_parameter(param_name, result_value))
{
result_value = _node.declare_parameter(param_name, initial_value, descriptor);
Expand Down

0 comments on commit fb4da86

Please sign in to comment.