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

Make rclcpp in to a library #140

Merged
merged 7 commits into from
Nov 6, 2015
Merged

Make rclcpp in to a library #140

merged 7 commits into from
Nov 6, 2015

Conversation

wjwwood
Copy link
Member

@wjwwood wjwwood commented Oct 29, 2015

Connects to #48

This pr currently builds on #137, but I'll rebase it against master once that is merged. In the mean time you can review changes specific to this pr with this link: allocator_template...rclcpp_library

I have not reenabled the intra process manager tests because it was using a somewhat peculiar method of mocking the classes within rclcpp and I'll have to come up with an alternative approach.

On Windows this relies on the unresolved library symbols workaround. The Windows CI job will need to be updated before it can handle the new limitations this puts on Windows, see: #48 (comment)

@wjwwood wjwwood added the in progress Actively being worked on (Kanban column) label Oct 29, 2015
src/rclcpp/utilities.cpp
)
add_library(${PROJECT_NAME} SHARED ${${PROJECT_NAME}_SRCS})
ament_target_dependencies(${PROJECT_NAME} "rmw" "rcl_interfaces")
Copy link
Member

Choose a reason for hiding this comment

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

Dependencies in alphabetical order.

@dirk-thomas
Copy link
Member

For a more detailed review I will wait until the PR is rebased since the referenced diff is still difficult to read. Can I also assume that all the created .cpp files contain the exact code extracted from the .hpp files and don't need to be reviewed?

@wjwwood
Copy link
Member Author

wjwwood commented Oct 29, 2015

For a more detailed review I will wait until the PR is rebased since the referenced diff is still difficult to read.

I don't expect it will be easier to read, after the rebase, than this: allocator_template...rclcpp_library because the only thing the rebase will do is remove @jacquelinekay's commits from this pr.

Can I also assume that all the created .cpp files contain the exact code extracted from the .hpp files and don't need to be reviewed?

For the most part that is true. I can summarize the handful of cases where I had to do more:

  • I changed two functions in executor.hpp to no longer be templated so I could put them in .cpp. The wait_for_work and get_next_executable used to be templated on a chrono duration ratio, but now they just take chrono nanoseconds and the calling functions do the duration cast before passing the timeout.
  • I moved a static class member into a static global in a .cpp file in the IntraProcessManager class.
  • I also moved some functions from rclcpp.hpp into executors.hpp so they could be put into a .cpp file. The rclcpp.hpp header cannot be included by the rclcpp library, but must be included by the user, see: allocator_template...rclcpp_library#diff-690567624ee368716009118718985564R29 and the corresponding: allocator_template...rclcpp_library#diff-809285dba1df7726afedd63625b6a6ceR34

@wjwwood
Copy link
Member Author

wjwwood commented Oct 30, 2015

Rebased, but I'm still working on comments and fixing the intra process tests.

@jacquelinekay
Copy link
Contributor

Linux build was broken, I added a missing include.

@wjwwood
Copy link
Member Author

wjwwood commented Oct 30, 2015

Thanks @jacquelinekay, I've updated it with fixes for uncrustify and I fixed the intra process tests.

@wjwwood
Copy link
Member Author

wjwwood commented Oct 30, 2015

Ok, I think I've addressed all of the comments, so here is the Linux and OS X CI:

The biggest thing left to do before I think this is ready for merge is to update the Windows CI farm to do a matrix build of the different DDS vendors rather than all in one workspace. The matrix can either be just running N builds back to back in the same job or really using Jenkin's matrix build pattern. I don't know what the best option is in that case. I'll look at it tomorrow morning, but if others have ideas on how that should work, I'd be happy to have some help on that.

@wjwwood
Copy link
Member Author

wjwwood commented Oct 30, 2015

I had to fix a problem that only showed up in isolated builds, where rclcpp had an undeclared dependency on rosidl_generator_cpp.

However, there is still and issue with how we are using some of the message related symbols within rclcpp which I haven't sorted out yet. I'll try to figure that out in the morning.

@jacquelinekay
Copy link
Contributor

Why do node.hpp and node_impl.hpp need to be different files? (I'll consider consolidating them in another PR.)

@@ -122,7 +122,8 @@ class SubscriptionBase
#define Publisher mock::Publisher
#define PublisherBase mock::PublisherBase
#define SubscriptionBase mock::SubscriptionBase
#include <rclcpp/intra_process_manager.hpp>
#include "../src/rclcpp/intra_process_manager.cpp"
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah. Interesting workaround.

@wjwwood
Copy link
Member Author

wjwwood commented Oct 30, 2015

I think I have fixed the type support problems.

@jacquelinekay
Copy link
Contributor

It's interesting that the Linux CI job failed, because the isolated build actually works on my desktop... maybe I have fpermissive turned on?

@wjwwood
Copy link
Member Author

wjwwood commented Oct 30, 2015

@wjwwood
Copy link
Member Author

wjwwood commented Nov 2, 2015

I spent some time working on the Windows issues, but I've been unable to finish those changes. Instead I've just pushed some changes that should fix Linux's build.

The root of the issue on Linux was that sometimes no template functions which use rmw_* functions where used from rclcpp's headers. This resulted in a situation where librclcpp was missing rmw symbols but the user's executable or library was not. So when linked against the rmw implementation shared library, the linker discarded it even though librclcpp would have used them. By using an rmw symbol directly in rclcpp.hpp I've forced all users of the header to depend on at least one rmw symbol, and therefore avoiding the aforementioned scenario.

There's still a problem that I introduced while working on Windows which introduces an infinite recursion that I need to track down, and so I won't start new CI. I'll have to tackle that tomorrow.

@wjwwood
Copy link
Member Author

wjwwood commented Nov 2, 2015

I believe I have fixed the infinite recursion issue (it was a consequence of a Windows fix), so I'll do CI for Linux and OS X:

@wjwwood
Copy link
Member Author

wjwwood commented Nov 2, 2015

It might be that the code I conditioned on WIN32 in d6769db maybe related to the SEH errors in Windows that we were seeing (they could also be caused by infinite recursion calls). In that case we would need to find another way to do 9cad948.

@wjwwood
Copy link
Member Author

wjwwood commented Nov 2, 2015

Rebased after #142

@wjwwood
Copy link
Member Author

wjwwood commented Nov 2, 2015

I have this branch building and tests running on all three platforms now, but there are still many warnings that need to be looked at on Windows, but in the mean time new CI:

@wjwwood
Copy link
Member Author

wjwwood commented Nov 2, 2015

Ok I've fixed the linkage warnings on Windows. Now the only thing remaining is figuring out what to do about the dependency structure on Windows. That last CI job failed because rmw_opensplice_cpp was not built and installed before rclcpp:

http://ci.ros2.org/job/ros2_batch_ci_windows/556/

Strangely rmw_connext_cpp is built before, but I'm not sure why that might happen just yet. We'll probably end up having to put a dependency on the default rmw_implementations from some package that rclcpp depends on. We'll have to see what affect that has on Linux/OS X. Currently some of them build before rclcpp so I guess it shouldn't be that big of a change, e.g.:

# Topological order
[ ... ]
 - connext_cmake_module
 - opensplice_cmake_module
 - rmw
 - rmw_implementation
 - rmw_implementation_cmake
 - rosidl_cmake
 - rosidl_default_generators
 - rosidl_generator_c
 - rosidl_generator_dds_idl
 - rosidl_parser
 - rcl
 - rclc
 - rmw_connext_shared_cpp
 - rosidl_generator_cpp
 - rosidl_typesupport_connext_cpp
 - rmw_connext_cpp
 - rosidl_typesupport_introspection_cpp
 - rmw_connext_dynamic_cpp
 - rosidl_typesupport_opensplice_cpp
 - builtin_interfaces
 - example_interfaces
 - pendulum_msgs
 - rcl_interfaces
 - rclcpp
 - rmw_opensplice_cpp
[ ... ]

As you can see, both connext rmw implementations come before rclcpp, but rmw_opensplice_cpp comes just after for some reason.

@wjwwood
Copy link
Member Author

wjwwood commented Nov 2, 2015

Ok, I added a build dependency on rmw_implementation in rclcpp. I'm not convinced this is correct, but I don't have a better idea and I think it will allow the branches to build and pass on all platforms, so here is CI:

If the CI looks ok, then we can start to discuss the content of the pull request and I can make any adjustments that we think are necessary.

@wjwwood
Copy link
Member Author

wjwwood commented Nov 3, 2015

With ros2/rmw_opensplice#90 I can build Windows completely. New CI for Windows (the Linux and OS X jobs look good):

I'll start a Connext one if that one looks good (and it doesn't interfere with ros2 packaging jobs).

@wjwwood
Copy link
Member Author

wjwwood commented Nov 5, 2015

Ok I squashed and I'll try to get the connext on Windows tests going right after lunch and then it should be good to merge.

@wjwwood
Copy link
Member Author

wjwwood commented Nov 6, 2015

Ok, they're all green except the connext versions of the Windows jobs. I'm gonna merge.

wjwwood added a commit that referenced this pull request Nov 6, 2015
Make rclcpp in to a library
@wjwwood wjwwood merged commit ca64af3 into master Nov 6, 2015
@wjwwood wjwwood removed the in progress Actively being worked on (Kanban column) label Nov 6, 2015
@wjwwood wjwwood deleted the rclcpp_library branch November 6, 2015 05:01
@esteve
Copy link
Member

esteve commented Nov 6, 2015

👏 👏 👏 🎆

@tfoote
Copy link
Contributor

tfoote commented Nov 6, 2015

🎉

@dirk-thomas
Copy link
Member

This PR results in the following compiler warning: http://ci.ros2.org/view/packaging/job/packaging_linux/51/warnings17Result/package.-1174361695/

@dirk-thomas
Copy link
Member

Since the warning is only present in the packaging job but not in the CI job we should run the packaging job if we want to actually check if the patch makes a difference.

@wjwwood
Copy link
Member Author

wjwwood commented Dec 4, 2015

Thanks for looking into it @esteve, you beat me to it.

@esteve
Copy link
Member

esteve commented Dec 4, 2015

@wjwwood no problem, it's been fun to learn about (yet) another GNU extension 😄

nnmm pushed a commit to ApexAI/rclcpp that referenced this pull request Jul 9, 2022
mauropasse added a commit to mauropasse/rclcpp that referenced this pull request Feb 6, 2024
* Include node namespace in IPC Action service name
* Include node namespace in IPC Client/Service service name
---------
Co-authored-by: Mauro Passerino <mpasserino@irobot.com>
mauropasse added a commit to mauropasse/rclcpp that referenced this pull request Aug 8, 2024
* Include node namespace in IPC Action service name
* Include node namespace in IPC Client/Service service name
---------
Co-authored-by: Mauro Passerino <mpasserino@irobot.com>
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.

5 participants