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

Port tf2_kdl #90

Merged
merged 36 commits into from
May 10, 2019
Merged

Port tf2_kdl #90

merged 36 commits into from
May 10, 2019

Conversation

vmayoral
Copy link
Member

@vmayoral vmayoral commented Feb 3, 2019

No description provided.

@tfoote tfoote added the in review Waiting for review (Kanban column) label Feb 3, 2019
@tfoote tfoote self-requested a review February 6, 2019 08:48
Copy link
Contributor

@tfoote tfoote left a comment

Choose a reason for hiding this comment

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

This would be great to have. Before merging this I'd like to see the unit tests ported too. They use a launch file in ROS1 but in ROS2 there's no master so that's not necessary for unit tests so everything can just be a unit test. The launch file only launches a single executable at a time anyway.

tf2_kdl/package.xml Show resolved Hide resolved
@mlautman
Copy link

mlautman commented Mar 18, 2019

This port is still incomplete. Here are some issues that remain:

tf2_kdl/CMakeLists.txt Outdated Show resolved Hide resolved

catkin_python_setup()

Choose a reason for hiding this comment

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

python libs need to be exported with

ament_python_install_package(${PROJECT_NAME}
    PACKAGE_DIR src/${PROJECT_NAME})

endif()

endif()
# if(BUILD_TESTING)

Choose a reason for hiding this comment

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

Don't just comment out tests. This port still needs work which gets hidden because the tests are disabled.

@jacobperron jacobperron added in progress Actively being worked on (Kanban column) and removed in review Waiting for review (Kanban column) labels Apr 25, 2019
@jacobperron
Copy link
Member

@vmayoral I'm moved this back to "in progress", let me know if/when it's ready for another round of review.

@vmayoral
Copy link
Member Author

Sure @jacobperron, will do.

@vmayoral
Copy link
Member Author

@ahcorde cherry-picked your commits here. Please review.

@vmayoral
Copy link
Member Author

@jacobperron, after @ahcorde's review, it should be ready to go from our side.

@jacobperron jacobperron added in review Waiting for review (Kanban column) and removed in progress Actively being worked on (Kanban column) labels Apr 29, 2019
Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

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

There are a few things to fixup here, but nothing major.

// auto node = rclcpp::Node::make_shared("test");
rclcpp::init(argc, argv);
rclcpp::Clock::SharedPtr clock = std::make_shared<rclcpp::Clock>(RCL_SYSTEM_TIME);
tf_buffer = new tf2_ros::Buffer(clock);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this would be better as a std::unique_ptr. Then we would make sure not to leak memory below.

#include "tf2_ros/buffer.h"

#include <tf2/convert.h>

tf2_ros::Buffer* tf_buffer;
Copy link
Contributor

Choose a reason for hiding this comment

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

See comment below about making this a std::unique_ptr.

* \return The TimePoint conversion.
*/
inline
tf2::TimePoint timePointFromTime(const builtin_interfaces::msg::Time& t)
Copy link
Contributor

Choose a reason for hiding this comment

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

We already have versions of this and timeFromTimePoint in https://github.com/ros2/geometry2/blob/ros2/tf2_ros/include/tf2_ros/buffer_interface.h#L46 ; is there any reason we can't use those?

Copy link
Contributor

Choose a reason for hiding this comment

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

Done, But I was wondering if this methods should go into tf2/time.h. inside tf2_ros/buffer_interface.h it's not very intuitive

Copy link
Contributor

Choose a reason for hiding this comment

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

Done, But I was wondering if this methods should go into tf2/time.h. inside tf2_ros/buffer_interface.h it's not very intuitive

The reason for that is that tf2 itself is meant to be ROS-agnostic; you'll notice that there are no includes of ROS header files anywhere directly in tf2. The interface between tf2 and ROS comes via the tf2_ros package.

That being said, I agree that it is not very intuitive that the time functions are in tf2_ros/buffer_interface.h. I'd be in favor of making a new file tf2_ros/time.h where these methods would go, but I'll suggest we do that in a separate PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure! I like tf2_ros/time.h

Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

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

One more minor change, then this is good to go from me. I'll run CI on it in the meantime.

t.header.frame_id = "A";
t.child_frame_id = "B";
tf_buffer->setTransform(t, "test");

int retval = RUN_ALL_TESTS();
delete tf_buffer;
tf_buffer.reset();
Copy link
Contributor

Choose a reason for hiding this comment

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

With the change to a unique_ptr, this shouldn't be necessary; it will be destroyed as it goes out of scope. So you can just remove this.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is still unresolved in the latest patches.

Copy link
Contributor

Choose a reason for hiding this comment

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

Done

@clalancette
Copy link
Contributor

CI:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@vmayoral
Copy link
Member Author

@clalancette could you please consider #93 as well (required for moveit2 as well)

@clalancette
Copy link
Contributor

It looks like Windows is upset for two different reasons:

15:19:18 C:\J\workspace\ci_windows\ws\src\ros2\geometry2\tf2_kdl\test\test_tf2_kdl.cpp(45): error C2065: 'M_PI': undeclared identifier [C:\J\workspace\ci_windows\ws\build\tf2_kdl\test_kdl.vcxproj]
15:19:18 C:\J\workspace\ci_windows\ws\src\ros2\geometry2\tf2_kdl\test\test_tf2_kdl.cpp(120): warning C4244: '=': conversion from 'double' to 'builtin_interfaces::msg::Time_<std::allocator<void>>::_sec_type', possible loss of data [C:\J\workspace\ci_windows\ws\build\tf2_kdl\test_kdl.vcxproj]
15:19:18 C:\J\workspace\ci_windows\ws\src\ros2\geometry2\tf2_kdl\test\test_tf2_kdl.cpp(121): warning C4244: '=': conversion from 'double' to 'builtin_interfaces::msg::Time_<std::allocator<void>>::_nanosec_type', possible loss of data [C:\J\workspace\ci_windows\ws\build\tf2_kdl\test_kdl.vcxproj]

The M_PI thing we've dealt with before, but I can't exactly remember how; @tfoote , do you remember? The loss of precision thing is actually true, so we either need to explicitly cast it or do something smarter there.

tf2_eigen/include/tf2_eigen/tf2_eigen.h Outdated Show resolved Hide resolved
tf2_kdl/test/test_tf2_kdl.cpp Show resolved Hide resolved
tf2_eigen/include/tf2_eigen/tf2_eigen.h Outdated Show resolved Hide resolved
@clalancette
Copy link
Contributor

Actually, before I run CI again, there hasn't been any change for the Windows loss of precision, so @ahcorde will need to do something about that before moving forward.

@ahcorde
Copy link
Contributor

ahcorde commented May 1, 2019

can you try the CI with this last commit?

header.stamp contains:

int32 sec
uint32 nanosec

I was assigning a double. Probably the sizeof(double) and the sizeof(int32) (or sizeof(uint32)) is different and that's why it's failing.

@clalancette
Copy link
Contributor

Rebuild of just Windows: Build Status

If this succeeds, I'll do one more CI run of everything.

@clalancette
Copy link
Contributor

All right, Windows is happy, here is the whole lot:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

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

One last nitpick, then I'm happy to approve.

tf2_kdl/include/tf2_kdl/tf2_kdl.h Outdated Show resolved Hide resolved
@clalancette
Copy link
Contributor

Is there any chance to revisit this PR #99 and merge it? otherwise this Python test is not going to work

Sorry for being quiet here. After a bit of discussion with @tfoote , I think we've determined that for now it will be fine to just not build and install the python stuff, and leave that as a TODO for later. So we can forget about #99 in terms of this PR; I'll open an issue on this repository to finish that porting.

Towards getting things finished, I've taken the liberty of rebasing this PR and doing some cleanup in the CMakeLists.txt and package.xml to get things moving again. Take a look at what I've done in ec63e8b, and let me know what you think.

I'm also going to run CI on this shortly.

@clalancette
Copy link
Contributor

@vmayoral Apologies, we had a collision with 3bbfee5 and my rebase. I'll restore your changes in a few minutes.

@clalancette
Copy link
Contributor

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@clalancette
Copy link
Contributor

And issue for python port opened in #110

@clalancette
Copy link
Contributor

All right, CI is all green and things seem happy. I'm going to give this 24 hours for any further objections, then I'll merge it.

@ahcorde
Copy link
Contributor

ahcorde commented May 10, 2019

@clalancette Thanks for reviewing it 👍

@ros-discourse
Copy link

This pull request has been mentioned on ROS Discourse. There might be relevant details there:

https://discourse.ros.org/t/the-moveit-2-journey-part-1-porting-and-understanding-moveit-core/8718/1

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.

None yet

9 participants