Skip to content

Commit

Permalink
fix demo codes pod_loaded_msg by sample codes (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
mickeyouyou authored Jan 12, 2022
1 parent 6848fe6 commit b48e453
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ For a fully working implementation, please have a look at [this demo node](https
```c++
auto pub = node->create_publisher<std_msgs::msg::String>("/chatter", 1);
// Ask the publisher to loan a String message
auto loaned_msg = pub_->borrow_loaned_message();
auto pod_loaned_msg = pub_->borrow_loaned_message();
pod_loaned_msg.get().data = "Hello World";
// Return ownership of that string message
pod_pub_->publish(std::move(pod_loaned_msg));
Expand All @@ -114,7 +114,7 @@ Thus, in order to make our demo work with zero copy, we can alternatively send a
```c++
auto pub = node->create_publisher<std_msgs::msg::Float64>("/float", 1);
// Ask the publisher to loan a Float64 message
auto loaned_msg = pub_->borrow_loaned_message();
auto pod_loaned_msg = pub_->borrow_loaned_message();
pod_loaned_msg.get().data = 123.456f;
// Return ownership of that Float64 message
pod_pub_->publish(std::move(pod_loaned_msg));
Expand Down

0 comments on commit b48e453

Please sign in to comment.