EasyManua.ls Logo

CLEARPATH Turtlebot4 - Page 102

Default Icon
153 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
ROS2 topic information
Test Create® 3 Button 1
Now that we are subscribed, lets test out our node by printing a message every time button 1 is
pressed.
Edit the interface_buttons_callback function to look like this:
// Interface buttons subscription callback
void interface_buttons_callback(
const irobot_create_msgs::msg::InterfaceButtons::SharedPtr create3_buttons_msg)
{
// Button 1 is pressed
if (create3_buttons_msg->button_1.is_pressed) {
RCLCPP_INFO(this->get_logger(), "Button 1 Pressed!");
}
}