Skip to content

Commit

Permalink
Arc 160 ros2 humble (#275)
Browse files Browse the repository at this point in the history
* migrated common packages to humble

* migrated core_perception to ros2 humble

* migrated mrt_cmake_module

* fixed ci

* fixed Dockerfile

* fixed python cmake integration

* added command to ignore parking_planner and parking_planner_nodes

* removed ros1 build steps

* fixed install.sh

* removed install_ros2 copy since this is now in install

* addressed comments

* removed unneeded dependency that causes build error
  • Loading branch information
john-chrosniak authored Nov 18, 2024
1 parent de27b7c commit 2d42206
Show file tree
Hide file tree
Showing 19 changed files with 39 additions and 79 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/dockerhub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- carma-develop
- develop-humble
- carma-master
- "release/*"
tags:
Expand All @@ -16,4 +17,4 @@ jobs:
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
GH_PAT: ${{ secrets.GH_PAT }}
with:
context: .
context: .
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ENV ROS2_PACKAGES=${ROS2_PACKAGES}

COPY --chown=carma . /home/carma/autoware.ai
RUN /home/carma/autoware.ai/docker/checkout.bash -b ${GIT_BRANCH}
RUN ./home/carma/autoware.ai/docker/install.sh
RUN /home/carma/autoware.ai/docker/install.sh

FROM base_image

Expand All @@ -30,4 +30,3 @@ LABEL org.label-schema.vcs-ref=${VCS_REF}
LABEL org.label-schema.build-date=${BUILD_DATE}

COPY --chown=carma --from=build /opt/autoware.ai/ros/install /opt/autoware.ai/ros/install
COPY --chown=carma --from=build /opt/autoware.ai/ros/install_ros2 /opt/autoware.ai/ros/install_ros2
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void lineString2Marker(const lanelet::ConstLineString3d ls, visualization_msgs::
*/
void trafficLight2TriangleMarker(const lanelet::ConstLineString3d ls, visualization_msgs::msg::Marker* marker,
const std::string ns, const std_msgs::msg::ColorRGBA cl,
const rclcpp::Duration duration = rclcpp::Duration(0.0), const double scale = 1.0);
const rclcpp::Duration duration = rclcpp::Duration::from_seconds(0.0), const double scale = 1.0);

/**
* [laneletsBoundaryAsMarkerArray create marker array to visualize shape of
Expand Down Expand Up @@ -135,7 +135,7 @@ visualization_msgs::msg::MarkerArray lineStringsAsMarkerArray(const std::vector<
*/
visualization_msgs::msg::MarkerArray autowareTrafficLightsAsMarkerArray(
const std::vector<lanelet::AutowareTrafficLightConstPtr> tl_reg_elems, const std_msgs::msg::ColorRGBA c,
const rclcpp::Duration duration = rclcpp::Duration(0.0), const double scale = 1.0);
const rclcpp::Duration duration = rclcpp::Duration::from_seconds(0.0), const double scale = 1.0);

/**
* [trafficLightsAsTriangleMarkerArray creates marker array to visualize shape
Expand All @@ -147,7 +147,7 @@ visualization_msgs::msg::MarkerArray autowareTrafficLightsAsMarkerArray(
*/
visualization_msgs::msg::MarkerArray trafficLightsAsTriangleMarkerArray(
const std::vector<lanelet::TrafficLightConstPtr> tl_reg_elems, const std_msgs::msg::ColorRGBA c,
const rclcpp::Duration duration = rclcpp::Duration(0.0), const double scale = 1.0);
const rclcpp::Duration duration = rclcpp::Duration::from_seconds(0.0), const double scale = 1.0);

} // namespace visualization
} // namespace lanelet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ void lightAsMarker(lanelet::ConstPoint3d p, visualization_msgs::msg::Marker* mar
marker->color.g = 1.0f;
marker->color.b = 1.0f;
}
marker->lifetime = rclcpp::Duration(0.0);
marker->lifetime = rclcpp::Duration::from_seconds(0.0);
}

void laneletDirectionAsMarker(const lanelet::ConstLanelet ll, visualization_msgs::msg::Marker* marker, const int id,
Expand Down Expand Up @@ -152,7 +152,7 @@ void laneletDirectionAsMarker(const lanelet::ConstLanelet ll, visualization_msgs
lanelet::ConstLineString3d center_ls = ll.centerline();
float s = 1.0;

marker->lifetime = rclcpp::Duration(0.0);
marker->lifetime = rclcpp::Duration::from_seconds(0.0);

marker->pose.position.x = 0.0; // p.x();
marker->pose.position.y = 0.0; // p.y();
Expand Down Expand Up @@ -533,7 +533,7 @@ visualization_msgs::msg::MarkerArray visualization::laneletsAsTriangleMarkerArra
marker.ns = ns;
marker.id = 0;
marker.type = visualization_msgs::msg::Marker::TRIANGLE_LIST;
marker.lifetime = rclcpp::Duration(0.0);
marker.lifetime = rclcpp::Duration::from_seconds(0.0);
marker.pose.position.x = 0.0; // p.x();
marker.pose.position.y = 0.0; // p.y();
marker.pose.position.z = 0.0; // p.z();
Expand Down
6 changes: 3 additions & 3 deletions common/lanelet2_extension/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ find_path(PUGIXML_INCLUDE_DIRS
PATH_SUFFIXES pugixml
)

find_package(PROJ4 REQUIRED)
find_package(PROJ REQUIRED)
find_package(Boost REQUIRED)


Expand Down Expand Up @@ -132,7 +132,7 @@ if(${ROS_VERSION} EQUAL 2)
include
${GeographicLib_INCLUDE_DIRS}
${PUGIXML_INCLUDE_DIRS}
${PROJ4_INCLUDE_DIRS}
${PROJ_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${${LOGGER_DEP}_INCLUDE_DIRS}
${hardcoded_params_INCLUDE_DIRS}
Expand All @@ -150,7 +150,7 @@ if(${ROS_VERSION} EQUAL 2)

target_link_libraries(lanelet2_extension_lib
${GeographicLib_LIBRARIES}
${PROJ4_LIBRARIES}
${PROJ_LIBRARIES}
${Boost_LIBRARIES}
${${LOGGER_DEP}_LIBRARIES}
)
Expand Down
1 change: 1 addition & 0 deletions common/map_file_ros2/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<depend>lanelet2_extension</depend>
<depend>carma_ros2_utils</depend>
<depend>autoware_lanelet2_ros_interface</depend>
<depend>pcl_conversions</depend>


<test_depend>ament_lint_auto</test_depend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
#include <tf2/LinearMath/Quaternion.h>
#include <tf2_ros/transform_listener.h>
#include <tf2_ros/transform_broadcaster.h>
#include <tf2_geometry_msgs/tf2_geometry_msgs.hpp>
#include <tf2_ros/buffer.h>

#include "amathutils_lib_ros2/kalman_filter.hpp"
#include "amathutils_lib_ros2/time_delay_kalman_filter.hpp"
Expand Down Expand Up @@ -235,4 +237,4 @@ class EKFLocalizer: public carma_ros2_utils::CarmaLifecycleNode
carma_ros2_utils::CallbackReturn handle_on_configure(const rclcpp_lifecycle::State &);
};

} //namespace ekf_localizer
} //namespace ekf_localizer
2 changes: 1 addition & 1 deletion core_perception/lidar_localizer_ros2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ ${PCL_LIBRARIES}

ament_auto_package(
INSTALL_TO_SHARE launch
)
)
5 changes: 2 additions & 3 deletions core_perception/lidar_localizer_ros2/include/ndt_matching.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,16 @@
#include <std_msgs/msg/bool.hpp>
#include <std_msgs/msg/float32.hpp>
#include <std_msgs/msg/string.hpp>
#include <velodyne_pointcloud/rawdata.hpp>

#include <tf2_ros/static_transform_broadcaster.h>
#include "tf2_ros/transform_broadcaster.h"
#include <tf2_ros/transform_listener.h>
#include <tf2_ros/buffer.h>
#include "tf2_geometry_msgs/tf2_geometry_msgs.h"
#include "tf2_geometry_msgs/tf2_geometry_msgs.hpp"

#include <geometry_msgs/msg/pose_stamped.hpp>
#include <geometry_msgs/msg/vector3_stamped.hpp>
#include <pcl/io/io.h>
#include <pcl/common/io.h>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl_conversions/pcl_conversions.h>
Expand Down
2 changes: 1 addition & 1 deletion core_perception/lidar_localizer_ros2/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<depend>tf2</depend>
<depend>tf2_ros</depend>
<depend>pcl</depend>
<depend>velodyne_pointcloud</depend>
<depend>tf2_geometry_msgs</depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_cmake_gtest</test_depend>
Expand Down
5 changes: 2 additions & 3 deletions core_perception/ndt_cpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ find_package(ros_environment REQUIRED)
set(ROS_VERSION $ENV{ROS_VERSION})

find_package(PCL COMPONENTS REQUIRED)
find_package(catkin REQUIRED)
find_package(Eigen3 QUIET)

if(NOT EIGEN3_FOUND)
Expand All @@ -21,7 +20,7 @@ else()
endif()

if(${ROS_VERSION} EQUAL 1)

find_package(catkin REQUIRED)
catkin_package(
INCLUDE_DIRS include
LIBRARIES ndt_cpu #The exported libraries from the project
Expand Down Expand Up @@ -135,4 +134,4 @@ else() #ROS2

ament_auto_package()

endif()
endif()
45 changes: 2 additions & 43 deletions docker/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
# License for the specific language governing permissions and limitations under
# the License.


###
# ROS 1 Build
###
# Source environment variables
if [[ ! -z "$ROS1_PACKAGES$ROS2_PACKAGES" ]]; then
echo "Sourcing previous build for incremental build start point..."
source /opt/autoware.ai/ros/install/setup.bash
Expand All @@ -30,57 +25,21 @@ fi
# Enter source directory
cd /home/carma/autoware.ai

# Build with CUDA
echo "ROS 1 Build with CUDA"
sudo mkdir /opt/autoware.ai # Create install directory
sudo chown carma /opt/autoware.ai # Set owner to expose permissions for build
sudo chgrp carma /opt/autoware.ai # Set group to expose permissions for build

if [[ ! -z "$ROS1_PACKAGES$ROS2_PACKAGES" ]]; then
if [[ ! -z "$ROS1_PACKAGES" ]]; then
echo "Incrementally building ROS1 packages: $ROS1_PACKAGES"
AUTOWARE_COMPILE_WITH_CUDA=1 colcon build --build-base build_ros1 --install-base /opt/autoware.ai/ros/install --cmake-args -DCMAKE_BUILD_TYPE=Release -DCMAKE_LIBRARY_PATH=/usr/local/cuda/lib64/stubs -DCMAKE_CXX_FLAGS=-Wall -DCMAKE_C_FLAGS=-Wall --packages-above $ROS1_PACKAGES --allow-overriding $ROS1_PACKAGES
else
echo "Build type is incremental but no ROS1 packages specified, skipping ROS1 build..."
fi
else
echo "Building all ROS1 Autoware.AI Components"
AUTOWARE_COMPILE_WITH_CUDA=1 colcon build --build-base build_ros1 --install-base /opt/autoware.ai/ros/install --cmake-args -DCMAKE_BUILD_TYPE=Release -DCMAKE_LIBRARY_PATH=/usr/local/cuda/lib64/stubs -DCMAKE_CXX_FLAGS=-Wall -DCMAKE_C_FLAGS=-Wall
fi

# Get the exit code from the ROS1 build so we can skip the ROS2 build if the ROS1 build failed
status=$?

if [[ $status -ne 0 ]]; then
echo "Autoware.ai build failed."
exit $status
fi
echo "Build of ROS1 Autoware.AI Components Complete"


###
# ROS 2 Build
###
source /opt/ros/foxy/setup.bash
if [[ ! -z "$ROS1_PACKAGES$ROS2_PACKAGES" ]]; then
echo "Sourcing previous build for incremental build start point..."
source /opt/autoware.ai/ros/install_ros2/setup.bash
else
echo "Sourcing base image for full build..."
source /home/carma/catkin/setup.bash
fi

echo "ROS 2 Build"
if [[ ! -z "$ROS1_PACKAGES$ROS2_PACKAGES" ]]; then
if [[ ! -z "$ROS2_PACKAGES" ]]; then
echo "Incrementally building ROS2 packages: $ROS1_PACKAGES"
# Build with CUDA compile option
AUTOWARE_COMPILE_WITH_CUDA=1 colcon build --install-base /opt/autoware.ai/ros/install_ros2 --build-base build_ros2 --cmake-args -DCMAKE_BUILD_TYPE=Release --packages-above $ROS2_PACKAGES --allow-overriding $ROS2_PACKAGES
AUTOWARE_COMPILE_WITH_CUDA=1 colcon build --install-base /opt/autoware.ai/ros/install --build-base build --cmake-args -DCMAKE_BUILD_TYPE=Release --packages-above $ROS2_PACKAGES --allow-overriding $ROS2_PACKAGES --packages-ignore parking_planner parking_planner_nodes
else
echo "Build type is incremental but no ROS2 packages specified, skipping ROS2 build..."
fi
else
echo "Building all ROS2 Autoware.AI Components"
# Build with CUDA compile option
AUTOWARE_COMPILE_WITH_CUDA=1 colcon build --install-base /opt/autoware.ai/ros/install_ros2 --build-base build_ros2 --cmake-args -DCMAKE_BUILD_TYPE=Release
AUTOWARE_COMPILE_WITH_CUDA=1 colcon build --install-base /opt/autoware.ai/ros/install --build-base build --cmake-args -DCMAKE_BUILD_TYPE=Release --packages-ignore parking_planner parking_planner_nodes
fi
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# if it is a local installation.
find_package( PythonInterp )
if( PYTHONINTERP_FOUND )
get_filename_component( _python_path ${PYTHON_EXECUTABLE} PATH )
get_filename_component( _python_path ${Python3_EXECUTABLE} PATH )
find_program( CYTHON_EXECUTABLE
NAMES cython cython.bat cython3
HINTS ${_python_path}
Expand Down
2 changes: 1 addition & 1 deletion mrt_cmake_modules/cmake/Modules/CatkinMockForConan.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ conan_define_targets()
target_link_libraries(${PROJECT_NAME}::auto_deps_export INTERFACE ${CONAN_TARGETS})
if(CONAN_USER_PYTHON_DEV_CONFIG_python_exec)
set(PYTHON_VERSION ${CONAN_USER_PYTHON_DEV_CONFIG_python_version})
set(PYTHON_EXECUTABLE ${CONAN_USER_PYTHON_DEV_CONFIG_python_exec})
set(Python3_EXECUTABLE ${CONAN_USER_PYTHON_DEV_CONFIG_python_exec})
endif()

set(CATKIN_DEVEL_PREFIX ${CMAKE_CURRENT_BINARY_DIR})
Expand Down
4 changes: 2 additions & 2 deletions mrt_cmake_modules/cmake/Modules/FindBoostPython.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# BoostPython_INCLUDE_DIRS - the include directory for boost+python
# BoostPython_LIBRARIES - the needed libs for boost+python

if(PYTHON_VERSION)
set(_python_version ${PYTHON_VERSION})
if(Python3_VERSION)
set(_python_version ${Python3_VERSION})
else()
set(_python_version 2.7)
endif()
Expand Down
2 changes: 1 addition & 1 deletion mrt_cmake_modules/cmake/Modules/GatherDeps.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/package.xml"
#variable set. This is used, because the python script is calling some ros tools to distinguish
#between catkin and non catkin packages.
set(_gather_cmd
${MRT_CMAKE_ENV} ${PYTHON_EXECUTABLE} ${MRT_CMAKE_MODULES_ROOT_PATH}/scripts/generate_cmake_dependency_file.py
${MRT_CMAKE_ENV} ${Python3_EXECUTABLE} ${MRT_CMAKE_MODULES_ROOT_PATH}/scripts/generate_cmake_dependency_file.py
"${CMAKE_CURRENT_SOURCE_DIR}/package.xml" "${MRT_CMAKE_MODULES_ROOT_PATH}/yaml/cmake.yaml"
"${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/auto_dep_vars.cmake")
execute_process(
Expand Down
8 changes: 4 additions & 4 deletions mrt_cmake_modules/cmake/Modules/MrtTesting.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function(mrt_init_testing)
endif()
if(NOT TARGET init_tests)
set(pre_test_cmd
${PYTHON_EXECUTABLE}
${Python3_EXECUTABLE}
${MRT_CMAKE_MODULES_ROOT_PATH}/scripts/init_coverage.py
${PROJECT_NAME}
${CMAKE_BINARY_DIR}
Expand All @@ -61,7 +61,7 @@ function(mrt_init_testing)
set(show_result "--show")
endif()
set(post_test_cmd
${PYTHON_EXECUTABLE}
${Python3_EXECUTABLE}
${MRT_CMAKE_MODULES_ROOT_PATH}/scripts/eval_coverage.py
${CMAKE_SOURCE_DIR}
${CMAKE_BINARY_DIR}
Expand Down Expand Up @@ -115,7 +115,7 @@ function(_mrt_run_test target_name working_dir result_xml_path)

set(run_test_cmd
${CATKIN_ENV}
${PYTHON_EXECUTABLE}
${Python3_EXECUTABLE}
${MRT_CMAKE_MODULES_ROOT_PATH}/scripts/run_test.py
${result_xml_path}
${working_dir_arg}
Expand Down Expand Up @@ -205,7 +205,7 @@ function(mrt_add_rostest target launch_file)
message(FATAL_ERROR "rostest not found! Aborting...")
endif()
set(cmd
"${PYTHON_EXECUTABLE} ${ROSTEST_EXE} --pkgdir=${PROJECT_SOURCE_DIR} --package=${PROJECT_NAME} --results-filename ${test_name}.xml --results-base-dir \"${MRT_TEST_RESULTS_DIR}\" ${CMAKE_CURRENT_LIST_DIR}/${launch_file}"
"${Python3_EXECUTABLE} ${ROSTEST_EXE} --pkgdir=${PROJECT_SOURCE_DIR} --package=${PROJECT_NAME} --results-filename ${test_name}.xml --results-base-dir \"${MRT_TEST_RESULTS_DIR}\" ${CMAKE_CURRENT_LIST_DIR}/${launch_file}"
)
if(MRT_ENABLE_COVERAGE)
set(coverage_arg COVERAGE_DIR ${MRT_COVERAGE_DIR}/${target})
Expand Down
2 changes: 1 addition & 1 deletion mrt_cmake_modules/cmake/Templates/python_api_install.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import os
import sys
import subprocess

python_interpreter = "@PYTHON_EXECUTABLE@"
python_interpreter = "@Python3_EXECUTABLE@"
if not python_interpreter:
python_interpreter = "python"

Expand Down
10 changes: 5 additions & 5 deletions mrt_cmake_modules/cmake/mrt_cmake_modules-macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ if(DEFINED ENV{ROS_VERSION})
set(ROS_VERSION $ENV{ROS_VERSION})
endif()

# make sure catkin/ament are found so that PYTHON_EXECUTABLE (and CATKIN_ENV) is set.
# make sure catkin/ament are found so that Python3_EXECUTABLE (and CATKIN_ENV) is set.
if(NOT PYTHON_VERSION AND DEFINED $ENV{ROS_PYTHON_VERSION})
set(PYTHON_VERSION
$ENV{ROS_PYTHON_VERSION}
Expand Down Expand Up @@ -394,7 +394,7 @@ function(_mrt_get_python_destination output_var)
"print(os.path.relpath(get_python_lib(prefix='${CMAKE_INSTALL_PREFIX}'), start='${CMAKE_INSTALL_PREFIX}').replace(os.sep, '/'))"
)
execute_process(
COMMAND "${PYTHON_EXECUTABLE}" "-c" "${_python_code}"
COMMAND "${Python3_EXECUTABLE}" "-c" "${_python_code}"
OUTPUT_VARIABLE _output
RESULT_VARIABLE _result
OUTPUT_STRIP_TRAILING_WHITESPACE)
Expand Down Expand Up @@ -604,7 +604,7 @@ function(mrt_python_module_setup)
install(
CODE "execute_process(
COMMAND
\"${PYTHON_EXECUTABLE}\" \"-m\" \"compileall\"
\"${Python3_EXECUTABLE}\" \"-m\" \"compileall\"
\"${CMAKE_INSTALL_PREFIX}/${python_destination}/${PROJECT_NAME}\"
)")
if(ROS_VERSION EQUAL 2)
Expand Down Expand Up @@ -727,7 +727,7 @@ function(mrt_add_python_api modulename)
configure_file(${MCM_TEMPLATE_DIR}/setup.py.in "${CMAKE_CURRENT_BINARY_DIR}/setup.py" @ONLY)
configure_file(${MCM_TEMPLATE_DIR}/python_api_install.py.in "${CMAKE_CURRENT_BINARY_DIR}/python_api_install.py"
@ONLY)
install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/python_api_install.py)")
install(CODE "execute_process(COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/python_api_install.py)")
else()
if(ROS_VERSION EQUAL 2)
_mrt_register_ament_python_hook()
Expand Down Expand Up @@ -1353,7 +1353,7 @@ function(_mrt_install_python source_file destination)
string(SUBSTRING "${data}" 0 ${length} prefix)
if("${shebang_line}" STREQUAL "${prefix}")
# write modified file with modified shebang line
get_filename_component(python_name ${PYTHON_EXECUTABLE} NAME)
get_filename_component(python_name ${Python3_EXECUTABLE} NAME)
string(REGEX REPLACE "${regex}" "#!/\\1/env ${python_name}\\2" data "${data}")
get_filename_component(filename ${source_file} NAME)
set(rewritten_file "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/python_files")
Expand Down

0 comments on commit 2d42206

Please sign in to comment.