From 2d42206b82267010e03b508ddb969b0a02a46ffc Mon Sep 17 00:00:00 2001 From: John Chrosniak Date: Mon, 18 Nov 2024 12:25:27 -0500 Subject: [PATCH] Arc 160 ros2 humble (#275) * 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 --- .github/workflows/dockerhub.yml | 3 +- Dockerfile | 3 +- .../visualization/visualization.hpp | 6 +-- .../visualization.cpp | 6 +-- common/lanelet2_extension/CMakeLists.txt | 6 +-- common/map_file_ros2/package.xml | 1 + .../include/ekf_localizer/ekf_localizer.hpp | 4 +- .../lidar_localizer_ros2/CMakeLists.txt | 2 +- .../include/ndt_matching.hpp | 5 +-- .../lidar_localizer_ros2/package.xml | 2 +- core_perception/ndt_cpu/CMakeLists.txt | 5 +-- docker/install.sh | 45 +------------------ .../cmake/FindCython.cmake | 2 +- .../cmake/Modules/CatkinMockForConan.cmake | 2 +- .../cmake/Modules/FindBoostPython.cmake | 4 +- .../cmake/Modules/GatherDeps.cmake | 2 +- .../cmake/Modules/MrtTesting.cmake | 8 ++-- .../cmake/Templates/python_api_install.py.in | 2 +- .../cmake/mrt_cmake_modules-macros.cmake | 10 ++--- 19 files changed, 39 insertions(+), 79 deletions(-) diff --git a/.github/workflows/dockerhub.yml b/.github/workflows/dockerhub.yml index 685dd514e48..97bff9b4880 100644 --- a/.github/workflows/dockerhub.yml +++ b/.github/workflows/dockerhub.yml @@ -4,6 +4,7 @@ on: push: branches: - carma-develop + - develop-humble - carma-master - "release/*" tags: @@ -16,4 +17,4 @@ jobs: DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} GH_PAT: ${{ secrets.GH_PAT }} with: - context: . \ No newline at end of file + context: . diff --git a/Dockerfile b/Dockerfile index 85fe2447fc3..b0dd1e4eb25 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 @@ -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 diff --git a/common/autoware_lanelet2_ros_interface/include/autoware_lanelet2_ros2_interface/visualization/visualization.hpp b/common/autoware_lanelet2_ros_interface/include/autoware_lanelet2_ros2_interface/visualization/visualization.hpp index e2a9ad17bb0..fcd8e2b1868 100644 --- a/common/autoware_lanelet2_ros_interface/include/autoware_lanelet2_ros2_interface/visualization/visualization.hpp +++ b/common/autoware_lanelet2_ros_interface/include/autoware_lanelet2_ros2_interface/visualization/visualization.hpp @@ -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 @@ -135,7 +135,7 @@ visualization_msgs::msg::MarkerArray lineStringsAsMarkerArray(const std::vector< */ visualization_msgs::msg::MarkerArray autowareTrafficLightsAsMarkerArray( const std::vector 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 @@ -147,7 +147,7 @@ visualization_msgs::msg::MarkerArray autowareTrafficLightsAsMarkerArray( */ visualization_msgs::msg::MarkerArray trafficLightsAsTriangleMarkerArray( const std::vector 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 diff --git a/common/autoware_lanelet2_ros_interface/lib/autoware_lanelet2_ros2_interface/visualization.cpp b/common/autoware_lanelet2_ros_interface/lib/autoware_lanelet2_ros2_interface/visualization.cpp index 46050a735c8..b433d97232a 100644 --- a/common/autoware_lanelet2_ros_interface/lib/autoware_lanelet2_ros2_interface/visualization.cpp +++ b/common/autoware_lanelet2_ros_interface/lib/autoware_lanelet2_ros2_interface/visualization.cpp @@ -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, @@ -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(); @@ -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(); diff --git a/common/lanelet2_extension/CMakeLists.txt b/common/lanelet2_extension/CMakeLists.txt index db3152cd96b..fcc6c6a7b70 100644 --- a/common/lanelet2_extension/CMakeLists.txt +++ b/common/lanelet2_extension/CMakeLists.txt @@ -33,7 +33,7 @@ find_path(PUGIXML_INCLUDE_DIRS PATH_SUFFIXES pugixml ) -find_package(PROJ4 REQUIRED) +find_package(PROJ REQUIRED) find_package(Boost REQUIRED) @@ -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} @@ -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} ) diff --git a/common/map_file_ros2/package.xml b/common/map_file_ros2/package.xml index a8639acdce6..5b176e3bff4 100644 --- a/common/map_file_ros2/package.xml +++ b/common/map_file_ros2/package.xml @@ -41,6 +41,7 @@ lanelet2_extension carma_ros2_utils autoware_lanelet2_ros_interface + pcl_conversions ament_lint_auto diff --git a/core_perception/ekf_localizer/include/ekf_localizer/ekf_localizer.hpp b/core_perception/ekf_localizer/include/ekf_localizer/ekf_localizer.hpp index a09132b7be5..cebb53fc97a 100644 --- a/core_perception/ekf_localizer/include/ekf_localizer/ekf_localizer.hpp +++ b/core_perception/ekf_localizer/include/ekf_localizer/ekf_localizer.hpp @@ -32,6 +32,8 @@ #include #include #include +#include +#include #include "amathutils_lib_ros2/kalman_filter.hpp" #include "amathutils_lib_ros2/time_delay_kalman_filter.hpp" @@ -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 \ No newline at end of file +} //namespace ekf_localizer diff --git a/core_perception/lidar_localizer_ros2/CMakeLists.txt b/core_perception/lidar_localizer_ros2/CMakeLists.txt index a9f0636b982..12451e755d9 100644 --- a/core_perception/lidar_localizer_ros2/CMakeLists.txt +++ b/core_perception/lidar_localizer_ros2/CMakeLists.txt @@ -72,4 +72,4 @@ ${PCL_LIBRARIES} ament_auto_package( INSTALL_TO_SHARE launch -) \ No newline at end of file +) diff --git a/core_perception/lidar_localizer_ros2/include/ndt_matching.hpp b/core_perception/lidar_localizer_ros2/include/ndt_matching.hpp index f4fcb4f7771..43e098f538a 100644 --- a/core_perception/lidar_localizer_ros2/include/ndt_matching.hpp +++ b/core_perception/lidar_localizer_ros2/include/ndt_matching.hpp @@ -30,17 +30,16 @@ #include #include #include -#include #include #include "tf2_ros/transform_broadcaster.h" #include #include -#include "tf2_geometry_msgs/tf2_geometry_msgs.h" +#include "tf2_geometry_msgs/tf2_geometry_msgs.hpp" #include #include -#include +#include #include #include #include diff --git a/core_perception/lidar_localizer_ros2/package.xml b/core_perception/lidar_localizer_ros2/package.xml index d4953b1d49e..9ee687c8ec8 100644 --- a/core_perception/lidar_localizer_ros2/package.xml +++ b/core_perception/lidar_localizer_ros2/package.xml @@ -42,7 +42,7 @@ tf2 tf2_ros pcl - velodyne_pointcloud + tf2_geometry_msgs ament_lint_auto ament_cmake_gtest diff --git a/core_perception/ndt_cpu/CMakeLists.txt b/core_perception/ndt_cpu/CMakeLists.txt index 4eea5ec3b82..ade0eb746b7 100644 --- a/core_perception/ndt_cpu/CMakeLists.txt +++ b/core_perception/ndt_cpu/CMakeLists.txt @@ -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) @@ -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 @@ -135,4 +134,4 @@ else() #ROS2 ament_auto_package() -endif() \ No newline at end of file +endif() diff --git a/docker/install.sh b/docker/install.sh index 52654c6db11..09fb2e93173 100755 --- a/docker/install.sh +++ b/docker/install.sh @@ -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 @@ -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 diff --git a/jsk_recognition/jsk_recognition_utils/cmake/FindCython.cmake b/jsk_recognition/jsk_recognition_utils/cmake/FindCython.cmake index f44f1f707d5..4327c95b219 100644 --- a/jsk_recognition/jsk_recognition_utils/cmake/FindCython.cmake +++ b/jsk_recognition/jsk_recognition_utils/cmake/FindCython.cmake @@ -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} diff --git a/mrt_cmake_modules/cmake/Modules/CatkinMockForConan.cmake b/mrt_cmake_modules/cmake/Modules/CatkinMockForConan.cmake index 24c3bd5b2fb..92b3beb2ec2 100644 --- a/mrt_cmake_modules/cmake/Modules/CatkinMockForConan.cmake +++ b/mrt_cmake_modules/cmake/Modules/CatkinMockForConan.cmake @@ -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}) diff --git a/mrt_cmake_modules/cmake/Modules/FindBoostPython.cmake b/mrt_cmake_modules/cmake/Modules/FindBoostPython.cmake index aa0fbbe3eef..3fcfd76a22e 100644 --- a/mrt_cmake_modules/cmake/Modules/FindBoostPython.cmake +++ b/mrt_cmake_modules/cmake/Modules/FindBoostPython.cmake @@ -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() diff --git a/mrt_cmake_modules/cmake/Modules/GatherDeps.cmake b/mrt_cmake_modules/cmake/Modules/GatherDeps.cmake index 7dae89f4d5f..54152176ca9 100644 --- a/mrt_cmake_modules/cmake/Modules/GatherDeps.cmake +++ b/mrt_cmake_modules/cmake/Modules/GatherDeps.cmake @@ -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( diff --git a/mrt_cmake_modules/cmake/Modules/MrtTesting.cmake b/mrt_cmake_modules/cmake/Modules/MrtTesting.cmake index 2284ab870f2..f09247258a0 100644 --- a/mrt_cmake_modules/cmake/Modules/MrtTesting.cmake +++ b/mrt_cmake_modules/cmake/Modules/MrtTesting.cmake @@ -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} @@ -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} @@ -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} @@ -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}) diff --git a/mrt_cmake_modules/cmake/Templates/python_api_install.py.in b/mrt_cmake_modules/cmake/Templates/python_api_install.py.in index e4e5060ecec..7bf4f3139bd 100755 --- a/mrt_cmake_modules/cmake/Templates/python_api_install.py.in +++ b/mrt_cmake_modules/cmake/Templates/python_api_install.py.in @@ -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" diff --git a/mrt_cmake_modules/cmake/mrt_cmake_modules-macros.cmake b/mrt_cmake_modules/cmake/mrt_cmake_modules-macros.cmake index 9c00a3ab5a0..d126b3ceb86 100644 --- a/mrt_cmake_modules/cmake/mrt_cmake_modules-macros.cmake +++ b/mrt_cmake_modules/cmake/mrt_cmake_modules-macros.cmake @@ -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} @@ -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) @@ -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) @@ -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() @@ -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")