Skip to content

Commit

Permalink
Corrected publish calls with shared_ptr signature, leftovers (ros2#190)
Browse files Browse the repository at this point in the history
* Corrected publish calls with shared_ptr signature, leftovers

Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>

* cpplint

Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>
Signed-off-by: Dhananjay Sathe <dhananjay.sathe@rapyuta-robotics.com>
  • Loading branch information
ivanpauno authored and dhananjaysathe committed Aug 22, 2019
1 parent 207a091 commit 6649fe4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/simple_bridge_1_to_2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include <iostream>
#include <memory>
#include <utility>

// include ROS 1
#ifdef __clang__
Expand All @@ -37,10 +38,10 @@ void chatterCallback(const std_msgs::String::ConstPtr & ros1_msg)
{
std::cout << "I heard: [" << ros1_msg->data << "]" << std::endl;

auto ros2_msg = std::make_shared<std_msgs::msg::String>();
auto ros2_msg = std::make_unique<std_msgs::msg::String>();
ros2_msg->data = ros1_msg->data;
std::cout << "Passing along: [" << ros2_msg->data << "]" << std::endl;
pub->publish(ros2_msg);
pub->publish(std::move(ros2_msg));
}

int main(int argc, char * argv[])
Expand Down

0 comments on commit 6649fe4

Please sign in to comment.