From b48e4531c4f3132d77b0e9404955cdb6cde3a923 Mon Sep 17 00:00:00 2001 From: Zongbao Feng Date: Wed, 12 Jan 2022 18:30:48 +0800 Subject: [PATCH] fix demo codes pod_loaded_msg by sample codes (#44) https://github.com/ros2/demos/blob/master/demo_nodes_cpp/src/topics/talker_loaned_message.cpp Signed-off-by: zongbao feng --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5ab8a1b..88a5573 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,7 @@ For a fully working implementation, please have a look at [this demo node](https ```c++ auto pub = node->create_publisher("/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)); @@ -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("/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));