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
# Interface buttons subscription callback
def interface_buttons_callback(self, create3_buttons_msg: InterfaceButtons):
# Button 1 is pressed
if create3_buttons_msg.button_1.is_pressed:
self.get_logger().info('Button 1
Now every time we receive a message the one
is pressed, and if it is then the node will print a message.
To test this out, we will need to build our package using colcon:
cd
~/turtlebot4_ws
colcon build --symlink-install
source
install/local_setup.bash
ROS2 topic information
function to look like this:
Pressed!')
/interface_buttons
--packages-select
turtlebot4_python_tutorials
topic we will check if button 1
Need help?
Do you have a question about the Turtlebot4 and is the answer not in the manual?