Skip to content

add composition use cases#84

Merged
dirk-thomas merged 2 commits intomasterfrom
composition
Nov 15, 2016
Merged

add composition use cases#84
dirk-thomas merged 2 commits intomasterfrom
composition

Conversation

@dirk-thomas
Copy link
Copy Markdown
Member

@dirk-thomas dirk-thomas commented Oct 28, 2016

This package contains multiple different ways how multiple nodes can be composed into a single process. The talker and listener nodes are compiled into shared libraries in all cases.

  • manual_composition:
    • custom written main uses the headers of the nodes and instantiates concrete nodes
    • executable links against node libraries
  • linktime_composition:
    • the nodes in each library are registered using class_loader
    • "generic" main using class_loader (on the library "")
    • executable links against node libraries with -Wl,--no-as-needed (since it doesn't directly require any symbols from the libraries)
  • dlopen_composition:
    • the nodes in each library are registered using class_loader
    • "generic" main using class_loader to load the shared libraries
    • executable not linked against node libraries, but gets shared library paths as command line arguments

--

  • Linux Build Status
  • OS X Build Status
  • Windows Build Status

@dirk-thomas dirk-thomas added the in progress Actively being worked on (Kanban column) label Oct 28, 2016
@dirk-thomas dirk-thomas self-assigned this Oct 28, 2016
@dirk-thomas dirk-thomas force-pushed the composition branch 5 times, most recently from edf4451 to b6dfd2d Compare November 1, 2016 17:01
@dirk-thomas dirk-thomas force-pushed the composition branch 4 times, most recently from f1817aa to efeb6dc Compare November 4, 2016 01:01
def test_linktime_composition():
if os.name == 'nt':
print('The link time registration of classes does not work on Windows')
return
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The classes exported in libraries which are linked by the linker are not registered in class_loader on Windows. Therefore this test is being skipped on Windows.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You can mark the test as skipped with something like this:

from unittest.case import SkipTest

# ...

def test_linktime_composition():
    if os.name == 'nt':
        print('The link time registration of classes does not work on Windows')
        raise SkipTest

It looks something like this:

...............................S
----------------------------------------------------------------------
Ran 32 tests in 0.537s

OK (SKIP=1)

I think you can also import it from nose but it's just a forward to this exception.

Copy link
Copy Markdown
Member Author

@dirk-thomas dirk-thomas Nov 14, 2016

Choose a reason for hiding this comment

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

Since I don't see an easy way to address this that sounds like a good idea. Done: http://ci.ros2.org/job/ci_windows/1857/testReport/(root)/test_composition__rmw_fastrtps_cpp_Release/

@dirk-thomas dirk-thomas force-pushed the composition branch 16 times, most recently from 8f79990 to fe14590 Compare November 10, 2016 01:18
@dirk-thomas dirk-thomas force-pushed the composition branch 8 times, most recently from 1ffdd9b to 78d3c36 Compare November 10, 2016 21:59
@dirk-thomas
Copy link
Copy Markdown
Member Author

I have added the following:

  • api_composition:
    • the nodes in each library are registered using class_loader
    • a generic container providing a ROS service to load node plugins using the ament resource index
    • api_composition_cli can be used to call the service using command line arguments

Ready for review 🎉

  • Linux Build Status
  • OS X Build Status
  • Windows Build Status

@dirk-thomas dirk-thomas added in review Waiting for review (Kanban column) and removed in progress Actively being worked on (Kanban column) labels Nov 10, 2016
Copy link
Copy Markdown
Member

@wjwwood wjwwood left a comment

Choose a reason for hiding this comment

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

lgtm

I would like to see an example of a "header less" component. I recognize that the talker and listener components you have here need headers so that you can make the manual_composition.cpp demo work. However, if I think about the minimal equivalent to my_node.cpp with it's own main, then it would be a class that is defined and implemented in place without a header. This should work for all cases except manual composition, but I expect that "manual composition" to be a quite rare pattern for normal users. And many will likely choose to forego the header if possible. Those users will likely take the idea that a header is required (even if it is not true) as a drawback to this approach.

def test_linktime_composition():
if os.name == 'nt':
print('The link time registration of classes does not work on Windows')
return
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You can mark the test as skipped with something like this:

from unittest.case import SkipTest

# ...

def test_linktime_composition():
    if os.name == 'nt':
        print('The link time registration of classes does not work on Windows')
        raise SkipTest

It looks something like this:

...............................S
----------------------------------------------------------------------
Ran 32 tests in 0.537s

OK (SKIP=1)

I think you can also import it from nose but it's just a forward to this exception.

@dirk-thomas
Copy link
Copy Markdown
Member Author

I would rather not duplicate the talker / listener code just to make it header less. Our other demos / examples also lack the ability to serve as a copy-n-paste template at the moment. Therefore I would not aim for that goal in this PR.

@wjwwood
Copy link
Copy Markdown
Member

wjwwood commented Nov 14, 2016

I don't desire a copy and paste template, I was just suggesting that this is something else that could be demonstrated. Which is something we have duplicated code for in other demos, where appropriate.

I don't think it's necessary so long as you are sure a headerless node works in the non manual composition cases. Though I think it would be nice to have.

@dirk-thomas
Copy link
Copy Markdown
Member Author

I will merge the current state. I further examples are desired they can be added in a new PR.

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