diff --git a/source/Tutorials/Custom-ROS2-Interfaces.rst b/source/Tutorials/Custom-ROS2-Interfaces.rst index ac905a252d1..ef78d04e697 100644 --- a/source/Tutorials/Custom-ROS2-Interfaces.rst +++ b/source/Tutorials/Custom-ROS2-Interfaces.rst @@ -325,7 +325,7 @@ Subscriber: } private: - void topic_callback(const tutorial_interfaces::msg::Num::SharedPtr msg) const // CHANGE + void topic_callback(const tutorial_interfaces::msg::Num::ConstSharedPtr msg) const // CHANGE { RCLCPP_INFO_STREAM(this->get_logger(), "I heard: '" << msg->num << "'"); // CHANGE } diff --git a/source/Tutorials/FastDDS-Configuration/FastDDS-Configuration.rst b/source/Tutorials/FastDDS-Configuration/FastDDS-Configuration.rst index d1582c74dcf..f73c4db9c6f 100644 --- a/source/Tutorials/FastDDS-Configuration/FastDDS-Configuration.rst +++ b/source/Tutorials/FastDDS-Configuration/FastDDS-Configuration.rst @@ -343,7 +343,7 @@ In a new source file named ``src/sync_async_reader.cpp`` write the following con /** * Actions to run every time a new message is received */ - void topic_callback(const std_msgs::msg::String::SharedPtr msg) const + void topic_callback(const std_msgs::msg::String::ConstSharedPtr msg) const { RCLCPP_INFO(this->get_logger(), "I heard: '%s'", msg->data.c_str()); } diff --git a/source/Tutorials/Ros2bag/Recording-A-Bag-From-Your-Own-Node.rst b/source/Tutorials/Ros2bag/Recording-A-Bag-From-Your-Own-Node.rst index de5951e07cd..86c508c14d1 100644 --- a/source/Tutorials/Ros2bag/Recording-A-Bag-From-Your-Own-Node.rst +++ b/source/Tutorials/Ros2bag/Recording-A-Bag-From-Your-Own-Node.rst @@ -101,10 +101,10 @@ Inside the ``dev_ws/src/bag_recorder_nodes/src`` directory, create a new file ca { rclcpp::Time time_stamp = this->now(); - writer_->write(*msg, "chatter", "std_msgs/msg/String", time_stamp); + writer_->write(msg, "chatter", "std_msgs/msg/String", time_stamp); } - rclcpp::Subscription::SharedPtr subscription_; + rclcpp::Subscription::SharedPtr subscription_; std::unique_ptr writer_; }; @@ -171,7 +171,7 @@ This is why we pass in the topic name and the topic type. .. code-block:: C++ - writer_->write(*msg, "chatter", "std_msgs/msg/String", time_stamp); + writer_->write(msg, "chatter", "std_msgs/msg/String", time_stamp); The class contains two member variables. @@ -184,7 +184,7 @@ The class contains two member variables. .. code-block:: C++ - rclcpp::Subscription::SharedPtr subscription_; + rclcpp::Subscription::SharedPtr subscription_; std::unique_ptr writer_; The file finishes with the ``main`` function used to create an instance of the node and start ROS processing it. diff --git a/source/Tutorials/Tf2/Writing-A-Tf2-Broadcaster-Cpp.rst b/source/Tutorials/Tf2/Writing-A-Tf2-Broadcaster-Cpp.rst index 0f71e2936e0..e4d09be2153 100644 --- a/source/Tutorials/Tf2/Writing-A-Tf2-Broadcaster-Cpp.rst +++ b/source/Tutorials/Tf2/Writing-A-Tf2-Broadcaster-Cpp.rst @@ -106,7 +106,7 @@ Open the file using your preferred text editor. } private: - void handle_turtle_pose(const std::shared_ptr msg) + void handle_turtle_pose(const std::shared_ptr msg) { rclcpp::Time now = this->get_clock()->now(); geometry_msgs::msg::TransformStamped t; diff --git a/source/Tutorials/Topics/Topic-Statistics-Tutorial.rst b/source/Tutorials/Topics/Topic-Statistics-Tutorial.rst index cdba5b9a38d..3035551e3ce 100644 --- a/source/Tutorials/Topics/Topic-Statistics-Tutorial.rst +++ b/source/Tutorials/Topics/Topic-Statistics-Tutorial.rst @@ -104,7 +104,7 @@ Open the file using your preferred text editor. } private: - void topic_callback(const std_msgs::msg::String::SharedPtr msg) const + void topic_callback(const std_msgs::msg::String::ConstSharedPtr msg) const { RCLCPP_INFO(this->get_logger(), "I heard: '%s'", msg->data.c_str()); } diff --git a/source/Tutorials/Writing-A-Simple-Cpp-Publisher-And-Subscriber.rst b/source/Tutorials/Writing-A-Simple-Cpp-Publisher-And-Subscriber.rst index c4c2f4f67af..7c319a9516b 100644 --- a/source/Tutorials/Writing-A-Simple-Cpp-Publisher-And-Subscriber.rst +++ b/source/Tutorials/Writing-A-Simple-Cpp-Publisher-And-Subscriber.rst @@ -356,7 +356,7 @@ Open the ``subscriber_member_function.cpp`` with your text editor. } private: - void topic_callback(const std_msgs::msg::String::SharedPtr msg) const + void topic_callback(const std_msgs::msg::String::ConstSharedPtr msg) const { RCLCPP_INFO(this->get_logger(), "I heard: '%s'", msg->data.c_str()); } @@ -398,7 +398,7 @@ The only field declaration in this class is the subscription. .. code-block:: C++ private: - void topic_callback(const std_msgs::msg::String::SharedPtr msg) const + void topic_callback(const std_msgs::msg::String::ConstSharedPtr msg) const { RCLCPP_INFO(this->get_logger(), "I heard: '%s'", msg->data.c_str()); }