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

[ROS2] Port kindr_ros and kindr_msgs #26

Open
wants to merge 8 commits into
base: ros2
Choose a base branch
from

Conversation

SivertHavso
Copy link

@SivertHavso SivertHavso commented Feb 19, 2022

Summary of non-ROS2 specific changes. These could potentially be cherry picked into the ROS1 branch to avoid future merge conflicts:

  • Using tf2 instead of tf (f022c41)
  • Linted all files in kindr_msgs and kindr_ros with cppcheck, cpplint, lint_cmake, xmllint, and uncrustify (af5667c, 51b18ec)
  • Removed what looks to be unnecessary variables that triggered unused-but-set-variable warnings (250f0e0)

ROS2 specific changes:

  • Updated the package.xml format
  • Replaced catkin with ament_cmake
  • Changed geometry_msgs include paths, and namespace to the new ROS2 convention.

All 18 gtests run and pass for me. I've targeted ROS2 Galactic, but I see not reason why it shouldn't work with ROS2 Foxy.

The rviz plugins haven't been ported yet.

Partly resolves #22

Copy link
Member

@remod remod left a comment

Choose a reason for hiding this comment

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

Very nice, thank you!

Comment on lines +54 to +58
# TODO(SivertHavso): add back code coverage:
# find_package(cmake_code_coverage QUIET)
# if(cmake_code_coverage_FOUND)
# add_gtest_coverage(TEST_BUILD_TARGETS ${PROJECT_NAME}-test)
# endif()
Copy link
Member

Choose a reason for hiding this comment

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

Is this something you intended to do before merging the MR?

Copy link
Author

Choose a reason for hiding this comment

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

It will have to wait until I've finished porting the elevation_mapping package. I'd say merge it now since it "only" affects quality assurance and not the API or ABI. The tests themself still run and there shouldn't be a notable difference in code coverage between the ROS1 and ROS2 branch for now.

Copy link
Member

Choose a reason for hiding this comment

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

Out of curiosity, why is this a dependency of the porting of elevation_mapping? This is a downstream dependency, right?

@remod
Copy link
Member

remod commented Feb 23, 2022

@SivertHavso We internally discussed the matter of formatting of code: As we are using this style for most of our closed source and open source code, we decided that it would make sense to use it also on the ROS2 branches.

Would you mind adopting it after merging this PR?

@SivertHavso
Copy link
Author

@remod Sure, in the process of doing it now. On my ROS2 working branch I've got it set to run clang-format, cppcheck, gtest, lint_cmake, and xmllint automatically (through the corresponding ament_cmake packages) as part of testing now, and have disabled the cpplint and uncrustify linters because they expect a different style. I'm getting a lot of failures from clang_format with your style though.

For example clang-format wants:

template <typename PrimType_>
inline static void convertFromRosGeometryMsg(const geometry_msgs::msg::Point& geometryPointMsg, kindr::Position<PrimType_, 3>& position) {
  position.x() = static_cast<PrimType_>(geometryPointMsg.x);
  position.y() = static_cast<PrimType_>(geometryPointMsg.y);
  position.z() = static_cast<PrimType_>(geometryPointMsg.z);
}

instead of the current:

template <typename PrimType_>
inline static void convertFromRosGeometryMsg(
const geometry_msgs::Point& geometryPointMsg,
kindr::Position<PrimType_, 3>& position)
{
position.x() = static_cast<PrimType_>(geometryPointMsg.x);
position.y() = static_cast<PrimType_>(geometryPointMsg.y);
position.z() = static_cast<PrimType_>(geometryPointMsg.z);
}

I get the same results running ament_clang_format or clang-format directly for both the master branch and my ROS2 working branch, "12 files with 218 code style divergences".

I'm quite sure it's loading your custom configuration because settings such as PointerAlignment: Left to PointerAlignment: Right increases the amount of failures.

Can you confirm whether the master branch is formatted correctly according to your style please?

@remod
Copy link
Member

remod commented Feb 25, 2022

Can you confirm whether the master branch is formatted correctly according to your style please?

No you are right, this package is not formatted according to our guidelines yet. I'll do that today!

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