Add your dependencies
For this tutorial, we will need to use the
rclcpp
an
d irobot_create_msgs
packages. The
rclcpp
package allows us to create ROS2 nodes and gives us full access to all the base ROS2
functionality in C++. The
irobot_create_msgs
package gives us access to the custom messages
used by the Create® 3 for reading the button presses and controlling the lightring.
In your CMakeLists.txt file, add these lines under
find_package(ament_cmake REQUIRED)
:
find_package(rclcpp REQUIRED)
find_package(irobot_create_msgs REQUIRED)
and add this line under
add_executable(turtlebot4_first_cpp_node
src/turtlebot4_first_cpp_node.cpp)
:
ament_target_dependencies(turtlebot4_first_cpp_node rclcpp irobot_create_msgs)
In package.xml, add these lines under
<buildtool_depend>ament_cmake</buildtool_depend>
:
<depend>
rclcpp
</depend>
<depend>
irobot_create_msgs
</depend
>
Finally, in your nodes
.cpp
file you will need to include these headers:
#include <chrono>
#include <functional>
#include <memory>
#include <string>
#include "rclcpp/rclcpp.hpp"
#include "irobot_create_msgs/msg/interface_buttons.hpp"
#include "irobot_create_msgs/msg/lightring_leds.hpp"
Содержание TurtleBot 4 Lite
Страница 50: ...Running the Light Ring test...
Страница 61: ...Adding Displays in Rviz2...
Страница 63: ...Camera image displayed in Rviz2...
Страница 82: ...TurtleBot 4 Lite with a NED2 arm...
Страница 147: ...Color camera diagnostics...