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

add examples_ prefix to package names to avoid future collisions #137

Merged
merged 5 commits into from
Nov 30, 2016

Conversation

codebot
Copy link
Member

@codebot codebot commented Nov 22, 2016

Some of the package names we're coming up with in the examples repo are pretty generic. Prefixing them with examples_ will reduce the likelihood of colliding with other package names.

@codebot codebot added the in progress Actively being worked on (Kanban column) label Nov 22, 2016
@mikaelarguedas
Copy link
Member

should the generated targets be prefixed as well ?

@codebot
Copy link
Member Author

codebot commented Nov 22, 2016

That's a good question. Probably. It will make typing them a bit longer, but I suppose talker_timer_lambda and talker_timer_member_function are pretty generic names to be throwing into bin and they may collide with the rclpy examples. I'll play around with a few options.

@codebot
Copy link
Member Author

codebot commented Nov 22, 2016

also, what do you think of renaming talker to minimal_publisher ? The names talker and listener are sort of in our vocabulary because we've been using them forever, but they aren't super descriptive.

@mikaelarguedas
Copy link
Member

yeah I agree, we use publisher/subscriber and requester/replier in a lot of places maybe it would make sense to update the vocabulary everywhere.

@codebot
Copy link
Member Author

codebot commented Nov 22, 2016

OK I'll change the package and executable names. Brace for impact.

@codebot
Copy link
Member Author

codebot commented Nov 23, 2016

OK it looks somewhat decent now. The build products are all prefixed by examples_rclcpp_ which is kind of nice.

@codebot codebot added in review Waiting for review (Kanban column) and removed in progress Actively being worked on (Kanban column) labels Nov 23, 2016
@codebot codebot self-assigned this Nov 23, 2016
{
subscription_ = this->create_subscription<std_msgs::msg::String>("chatter",
subscription_ = this->create_subscription<std_msgs::msg::String>("topic",
Copy link
Member

Choose a reason for hiding this comment

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

nicktip: I think we encourage to wrap after the parenthesis
same below

Copy link
Member

@mikaelarguedas mikaelarguedas left a comment

Choose a reason for hiding this comment

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

Changes look good to me.
Is it on purpose that you create structs that inherit from rclcpp::Node rather than classes ?

@codebot
Copy link
Member Author

codebot commented Nov 29, 2016

I did struct instead of class just because that's what was going on in the previous examples. I think it just lets you avoid wasting a line for public:

install(TARGETS ${PROJECT_NAME}_lambda
${PROJECT_NAME}_member_function
${PROJECT_NAME}_not_composable
DESTINATION bin)
Copy link
Member

Choose a reason for hiding this comment

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

Please avoid aligned indentation.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK. For posterity, I'll add some text to the style guide which makes this more clear.

find_package(std_msgs REQUIRED)
if (NOT WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra")
endif()
Copy link
Member

Choose a reason for hiding this comment

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

I would suggest moving the C++ flags above the find_package (as it is done in all other packages) since the CMake config files could already try to use them.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks. I don't think it's done in all other packages though; I started this CMakeLists.txt file by copying from somewhere else. But I can't figure out now where I copied it from. Anyway I'll keep looking for other instances as well.

{
publisher_ = this->create_publisher<std_msgs::msg::String>("chatter");
publisher_ = this->create_publisher<std_msgs::msg::String>("topic");
Copy link
Member

Choose a reason for hiding this comment

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

Why change the topic name? This will make the code incompatible with the ROS 1 equivalents.

Copy link
Member Author

Choose a reason for hiding this comment

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

That is true, but the ROS 1 equivalent has moved to http://github.com/ros2/tutorials where it will (eventually) have lots of inline comments and narrative documentation like in the ROS 1 code. The idea for this repository is to have lots of short copy-paste friendly examples that are as unambiguous as possible. Hence the name change from talker to minimal_publisher, etc.

@dirk-thomas
Copy link
Member

Since the packages (intentionally) don't contain any automatic linting did you run all linters on the example code?

@codebot
Copy link
Member Author

codebot commented Nov 29, 2016

I'm trying to figure out how to run the linters manually. When I figure that out, I'll document it in the style guide or somewhere else.

@dirk-thomas
Copy link
Member

For each linter you will find the way to invoke it in its documentation (e.g. https://github.com/ament/ament_lint/blob/master/ament_pep8/doc/index.rst).

@codebot
Copy link
Member Author

codebot commented Nov 29, 2016

OK everything is now using class instead of struct and the style checks and linters seem to be all passing now. Anything else before this merges?

@dirk-thomas
Copy link
Member

Are additional rclcpp examples planned for a future PR? The ones in this PR look fine to me.

@codebot
Copy link
Member Author

codebot commented Nov 29, 2016

Yeah, I'm working on cleaning up some services examples which I'll put in a different PR.

@dirk-thomas
Copy link
Member

Maybe we should also have examples how we recommend users to write their nodes in the future, inheriting from node and creating a library.

@codebot
Copy link
Member Author

codebot commented Nov 29, 2016

Yes that's a great idea. I'll make an issue for that on this repo.

@codebot codebot merged commit 46adb61 into master Nov 30, 2016
@codebot codebot removed the in review Waiting for review (Kanban column) label Nov 30, 2016
@codebot codebot deleted the prefix_package_names branch November 30, 2016 01:32
@dirk-thomas
Copy link
Member

Please squash your commits before / during the merge.

@codebot
Copy link
Member Author

codebot commented Nov 30, 2016 via email

@wjwwood
Copy link
Member

wjwwood commented Nov 30, 2016

Technically no, but we shouldn't make a habit of force pushing to master. I'd say just leave it and try to remember in the future 😄.

@codebot
Copy link
Member Author

codebot commented Nov 30, 2016 via email

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.

4 participants