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 rmw_implementation a meta rmw implementation #17

Merged
merged 1 commit into from
Jan 5, 2017

Conversation

dirk-thomas
Copy link
Member

@dirk-thomas dirk-thomas commented Jan 4, 2017

This patch makes rmw_implementation an actual rmw implementation. If only a single rmw impl. is available or Poco is unavailable it simply redirects to the default rmw implementation. Otherwise it acts a dynamic dispatch to any rmw implementation selected by the environment variable RMW_IMPLEMENTATION (similar as rosidl_typesupport_c|cpp).

The next step after this has been merged will be to remove all rmw specific targets and only build targets against this "meta" rmw implementation (see ros2/ros2#302).

  • Linux Build Status
  • Mac OS Build Status
  • Windows Build Status

Ready for review.

@dirk-thomas dirk-thomas self-assigned this Jan 4, 2017
@dirk-thomas dirk-thomas added in progress Actively being worked on (Kanban column) in review Waiting for review (Kanban column) and removed in progress Actively being worked on (Kanban column) labels Jan 4, 2017
Copy link
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.

Changes lgtm, I didn't try it out locally though.

I think we should consider moving some of these utilities functions which are used here and in the components stuff to a common place, maybe in rmw for now, so that they're not duplicated everywhere, e.g. split and perhaps others.

@@ -16,38 +16,63 @@

find_package(rmw_implementation_cmake REQUIRED)
set(default_rmw_implementation "@RMW_IMPLEMENTATION@")
set(available_rmw_implementation "@RMW_IMPLEMENTATIONS@")
Copy link
Member

Choose a reason for hiding this comment

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

available_rmw_implementations?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed: 16e7240

message(FATAL_ERROR
"The RMW implementation has been specified as "
"'${requested_rmw_implementation}' through CMake, "
"however the RMW implementation should be "
Copy link
Member

Choose a reason for hiding this comment

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

"however the RMW implementation was already set as "? I you want to further imply that what was specified via cmake should match this could say:

"however this needs to match the RMW implementation which was already set as "
"'${default_rmw_implementation}', "
"when the 'rmw_implementation' package was built.")

Copy link
Member Author

Choose a reason for hiding this comment

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

I replaced line 36 and 60 with however this needs to match the RMW implementation to make it more clear: see 4ba229d

free(value);
#endif
}
// printf("get_env_var(%s) = %s\n", env_var, value_str.c_str());
Copy link
Member

Choose a reason for hiding this comment

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

Should be removed?

Copy link
Member

Choose a reason for hiding this comment

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

(also several below)

Copy link
Member Author

Choose a reason for hiding this comment

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

I would keep them since they they make it easier to debug the code when necessary. These functions might be removed in the future anyway when being available from a single location for reuse.

Copy link
Member

Choose a reason for hiding this comment

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

Ok.


#include "rmw/rmw.h"

std::string get_env_var(const char * env_var)
Copy link
Member

Choose a reason for hiding this comment

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

I'd recommend we try to do ros2/rmw#87 (and related pr's) to avoid duplicating this function around.

Copy link
Member Author

Choose a reason for hiding this comment

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

We can for sure use functions from a single location once they are available. I would rather not wait for that to happen for this PR though. Also I don't think rmw is a good location for those since it has nothing to do with the ROS middleware interface.

Copy link
Member

Choose a reason for hiding this comment

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

That's fine, but we should not continue to do this otherwise replacing all instances is just going to get harder and harder.

Also I don't think rmw is a good location for those since it has nothing to do with the ROS middleware interface.

Well, it does have something to do with it, so far as in the functions are used by many of the rmw implementations (like this meta one). By the same logic, the utilities in rclcpp (like scoped exit) should be in a separate library because it doesn't have anything to do with rclcpp. While that's technically true, it's not very practical.

#define CALL_SYMBOL(symbol_name, ReturnType, error_value, ArgTypes, arg_values) \
void * symbol = get_symbol(symbol_name); \
if (!symbol) { \
return error_value; \
Copy link
Member

Choose a reason for hiding this comment

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

Should this set an appropriate error message?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point. I added rmw error messages for two cases and also a try / catch block around the library loading: see 12e12f1

@dirk-thomas dirk-thomas merged commit fb80721 into master Jan 5, 2017
@dirk-thomas dirk-thomas deleted the meta_rmw_impl branch January 5, 2017 05:40
@dirk-thomas dirk-thomas removed the in review Waiting for review (Kanban column) label Jan 5, 2017
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