Skip to content

C++ demo nodes using inheritance#192

Merged
dhood merged 22 commits intomasterfrom
node_inherit_demos
Dec 4, 2017
Merged

C++ demo nodes using inheritance#192
dhood merged 22 commits intomasterfrom
node_inherit_demos

Conversation

@dhood
Copy link
Copy Markdown
Member

@dhood dhood commented Nov 16, 2017

I want to swap to using logging macros in #191.
Having free functions was complicating the process, but these demos should be using Node inheritance anyway.

haven't done the service demos yet

@dhood
Copy link
Copy Markdown
Member Author

dhood commented Nov 28, 2017

Ready for review. The point of this PR is to get rid of free functions so that the demo nodes are set up for using logging macros how we expect them to be used (accessing the node's logger). There are still some nodes that don't inherit from Node in this repo but not in the demo_node_cpp package, with the exception of parameter nodes that are blocked by ros2/rclcpp#409.

I left the sync client without node inheritance because there isn't really a distinction between sync and async when using a response callback function (which is required if spin has been called on the node by the main). The spin_until_future_complete usage is covered by https://github.com/ros2/examples/blob/1907bac059ba4962bbeb0a2cf8f3c5f84cdbab95/rclcpp/minimal_client/main.cpp#L39, if we want to remove the sync client from this package.

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

@mikaelarguedas mikaelarguedas added in review Waiting for review (Kanban column) and removed in progress Actively being worked on (Kanban column) labels Nov 28, 2017
@dhood
Copy link
Copy Markdown
Member Author

dhood commented Nov 30, 2017

@ros2/team waiting for review. If you notice inconsistency in the usage of rclcpp::Subscription vs rclcpp::service::Service it's related to #199 and can be addressed after ros2/rclcpp#410 is merged

timer_->cancel(); // We only want to make a single request.
this->make_request();
};
timer_ = create_wall_timer(0s, on_timer); // This will trigger once spin is called on the node.
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.

@Karsten1987 and I spoke about this and it should be fine to just call make_request straight away here (should rename the method to start_async_request or something) since both approaches just queue something for once the node gets spun on.. I'll give it a shot

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.

simplified in a010a4d @mikaelarguedas fyi (you also mentioned this was unnecessarily complicated FWIU)

request->b = 3;
private:
rclcpp::client::Client<example_interfaces::srv::AddTwoInts>::SharedPtr client_;
rclcpp::timer::TimerBase::SharedPtr timer_;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we don't need that timer_ anymore, do we?

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.

absolutely right, thanks! b9e5794

@dhood dhood force-pushed the node_inherit_demos branch from b9e5794 to 35f99d5 Compare November 30, 2017 23:33
@dhood
Copy link
Copy Markdown
Member Author

dhood commented Nov 30, 2017

If you notice inconsistency in the usage of rclcpp::Subscription vs rclcpp::service::Service it's related to #199 and can be addressed after ros2/rclcpp#410 is merged

rebased since those PRs have been merged and removed any extra namespaces so you shouldn't see e.g. rclcpp::service::Service in this PR anymore

@dhood
Copy link
Copy Markdown
Member Author

dhood commented Dec 3, 2017

CI (planning to merge when comes back green):

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

@dhood dhood merged commit 8011e5b into master Dec 4, 2017
@dhood dhood deleted the node_inherit_demos branch December 4, 2017 01:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in review Waiting for review (Kanban column)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants