use rclcpp componet

This commit is contained in:
Joe Dong
2023-08-22 21:11:59 +08:00
parent 4c83927cdd
commit 76742927b5
3 changed files with 35 additions and 68 deletions
-13
View File
@@ -1,13 +0,0 @@
#include <rclcpp/rclcpp.hpp>
#include <orbbec_camera/ob_camera_node_driver.h>
int main(int argc, char** argv) {
rclcpp::init(argc, argv);
rclcpp::NodeOptions options;
using namespace orbbec_camera;
auto node = std::make_shared<OBCameraNodeDriver>(options);
rclcpp::spin(node);
rclcpp::shutdown();
return 0;
}
@@ -15,6 +15,7 @@
#include <semaphore.h>
#include <sys/shm.h>
#include <ament_index_cpp/get_package_share_directory.hpp>
#include <rclcpp_components/register_node_macro.hpp>
namespace orbbec_camera {
OBCameraNodeDriver::OBCameraNodeDriver(const rclcpp::NodeOptions &node_options)
@@ -406,3 +407,5 @@ void OBCameraNodeDriver::startDevice(const std::shared_ptr<ob::DeviceList> &list
initializeDevice(device);
}
} // namespace orbbec_camera
RCLCPP_COMPONENTS_REGISTER_NODE(orbbec_camera::OBCameraNodeDriver)