Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert rct_optimizations to be a ROS-generic CMake package #42

Merged

Conversation

schornakj
Copy link
Contributor

@schornakj schornakj commented May 19, 2020

The first step at enabling #35. The work I had done previously converted the RCT packages to be ROS2 packages via Ament, which isn't an ideal strategy for us to use here, so this is a fresh take on the task.

  • Remove Catkin dependencies, macros, and functions from rct_optimizations.
  • Change minimum required CMake version from 2.8.3 to 3.5.0.
  • Add a set of CMake macros (in rct_optimizations/cmake/rct_macros.cmake) to streamline package configuration and test setup. The idea is that the other RCT packages will be able to use these too. These macros are lightly modified from the ones used in Tesseract.
  • Use a more "modern CMake" approach in rct_optimizations/CMakeLists.txt. It now provides its libraries through the rct::rct_optimizations target.
  • Move test source code to a test directory, which is added as a subdirectory if the RCT_ENABLE_RUN_TESTING flag is True.
  • Change how rct_image_tools, rct_ros_tools, and rct_examples find and link against rct_optimizations to accommodate the fact that it is no longer a ROS package.

TODOs:

  • Questions for @marip8: Do the changes I made to the way tests are structured still allow CI to build and run tests? Do we have to add RCT_ENABLE_RUN_TESTING to .github_actions.yml?

Copy link
Collaborator

@marip8 marip8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall. It didn't appear that any of the tests were run, and I think you are right about the CI config file needing an update. It looks like you can add CMake arguments to industrial-ci using the CMAKE_ARGS environment variable per its detailed documentation

A couple other comments:

  1. We should target against Eigen per their documentation. I was hesitant to suggest this for Fix eigen build issue #39 since it required a CMake min version increase; since we're doing that in this PR, though, we should target against Eigen the "right" way
  2. @Levi-Armstrong mentioned moving the Tesseract CMake macros into a standalone repository. I assume we replace the rct macros with those once their available. If not, would it make sense to put those macros in a different place now so they can also be used by rct_image_tools when the time comes to make it pure CMake?

rct_optimizations/CMakeLists.txt Outdated Show resolved Hide resolved
rct_optimizations/test/CMakeLists.txt Outdated Show resolved Hide resolved
@schornakj
Copy link
Contributor Author

I've made some changes which I will push up once I get tests running through CI again:

  • I added a rct_common package, which now contains CMake macros and the GTest external package.
  • I changed the CMake arguments for building and running tests. Setting RCT_BUILD_TESTS=True will build the tests, and setting RCT_RUN_TESTS=True will cause them to be run using make test after they're built.

@schornakj
Copy link
Contributor Author

CI currently fails with the error below, which I think is because the environment used in the Github Action doesn't have git installed.

Errors     << rct_common:cmake /root/target_ws/logs/rct_common/build.cmake.000.log
  CMake Error at /usr/share/cmake-3.5/Modules/ExternalProject.cmake:1757 (message):
  
error: could not find git for clone of GTest

@marip8
Copy link
Collaborator

marip8 commented May 19, 2020

That seems odd. Doesn't the Docker use git to clone the repository it's building as well as packages from .rosinstall files?

You can specify that additional packages be installed before running the build using the ADDITIONAL_DEBS environment variable with industrial_ci. Maybe try that with git?

@schornakj
Copy link
Contributor Author

schornakj commented May 19, 2020

You're right, I didn't understand it quite correctly and git is already installed at the top level.

e: I think that the Docker container set up by industrial_ci doesn't have git installed. The source repositories are cloned before the container is initialized and then copied in afterwards.

change other packages so they treat rct_optimizations as a pure CMake package

Fix erroneously commented-out Eigen3 dependency

remove pattern matching filter from include install

Add rct_common package, move macros and GTest infrastructure to it

rename RCT_ENABLE_RUN_TESTING to RCT_RUN_TESTS

Add flags to build and run tests in CI

install git in CI env

add git to ADDITIONAL_DEBS for industrial_ci docker image

Remove RCT_RUN_TESTS flag from CI config

link rct_examples test against GTest
@schornakj schornakj force-pushed the feature/35-rct-optimizations-pure-cmake branch from 231f6bf to 4739d98 Compare May 22, 2020 00:30
@schornakj
Copy link
Contributor Author

schornakj commented May 22, 2020

@marip8 I rebased onto the latest master branch and fixed the issue with linking to GTest on the xenial job.

I think that the rct_optimizations tests are being, with two caveats:

  • Setting RCT_RUN_TESTS=True makes the tests run both when building and during the run_tests step, which makes the CI process take longer.
  • The run_tests step doesn't appear to report that the rct_optimizations tests ran and succeeded.

rct_optimizations doesn't directly link against Eigen (which is instead brought in by Ceres), so I'll address your comment about the Eigen target in a separate (and imminent!) PR for the other packages.

@schornakj schornakj changed the title WIP: Convert rct_optimizations to be a ROS-generic CMake package Convert rct_optimizations to be a ROS-generic CMake package May 22, 2020
@marip8 marip8 merged commit 9ec1c9d into Jmeyer1292:master May 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants