Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/Tutorials/Custom-ROS2-Interfaces.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<rclcpp::SerializedMessage>::SharedPtr subscription_;
rclcpp::Subscription<std_msgs::msg::String>::SharedPtr subscription_;
std::unique_ptr<rosbag2_cpp::Writer> writer_;
};

Expand Down Expand Up @@ -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.

Expand All @@ -184,7 +184,7 @@ The class contains two member variables.

.. code-block:: C++

rclcpp::Subscription<rclcpp::SerializedMessage>::SharedPtr subscription_;
rclcpp::Subscription<std_msgs::msg::String>::SharedPtr subscription_;
std::unique_ptr<rosbag2_cpp::Writer> writer_;

The file finishes with the ``main`` function used to create an instance of the node and start ROS processing it.
Expand Down
2 changes: 1 addition & 1 deletion source/Tutorials/Tf2/Writing-A-Tf2-Broadcaster-Cpp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ Open the file using your preferred text editor.
}

private:
void handle_turtle_pose(const std::shared_ptr<turtlesim::msg::Pose> msg)
void handle_turtle_pose(const std::shared_ptr<const turtlesim::msg::Pose> msg)
{
rclcpp::Time now = this->get_clock()->now();
geometry_msgs::msg::TransformStamped t;
Expand Down
2 changes: 1 addition & 1 deletion source/Tutorials/Topics/Topic-Statistics-Tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down Expand Up @@ -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());
}
Expand Down