diff --git a/CMakeLists.txt b/CMakeLists.txt
index 10d82cf..af08016 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -107,11 +107,12 @@ endif()
find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
find_package(pybind11_vendor REQUIRED)
find_package(pybind11 REQUIRED)
+find_package(py_binding_tools REQUIRED)
ament_python_install_package(moveit_visual_tools PACKAGE_DIR python/moveit_visual_tools)
pybind11_add_module(pymoveit_visual_tools python/src/moveit_visual_tools.cpp)
-target_link_libraries(pymoveit_visual_tools PUBLIC moveit_visual_tools)
+target_link_libraries(pymoveit_visual_tools PUBLIC moveit_visual_tools py_binding_tools::py_binding_tools)
ament_target_dependencies(pymoveit_visual_tools PUBLIC pybind11 rviz_visual_tools)
install(TARGETS pymoveit_visual_tools
LIBRARY DESTINATION ${PYTHON_INSTALL_DIR}/moveit_visual_tools)
@@ -119,5 +120,6 @@ install(PROGRAMS
python/examples/moveit_visual_tools_demo.py
DESTINATION lib/${PROJECT_NAME}
)
+ament_export_dependencies(py_binding_tools)
ament_package()
diff --git a/package.xml b/package.xml
index 2057040..a14a6e3 100644
--- a/package.xml
+++ b/package.xml
@@ -28,6 +28,7 @@
tf2_ros
trajectory_msgs
visualization_msgs
+ py_binding_tools
pybind11_vendor
diff --git a/python/examples/moveit_visual_tools_demo.py b/python/examples/moveit_visual_tools_demo.py
index 7815d62..00eb0eb 100755
--- a/python/examples/moveit_visual_tools_demo.py
+++ b/python/examples/moveit_visual_tools_demo.py
@@ -2,6 +2,7 @@
import moveit_visual_tools as mvt
import rviz_visual_tools as rvt
+import rclcpp
import sys
import time
from rclpy import logging
@@ -13,12 +14,11 @@
from geometry_msgs.msg import Pose, Point, Quaternion
-rvt.init()
+rclcpp.init()
PLANNING_GROUP_NAME = "arm"
-node = rvt.RvizVisualToolsNode("moveit_visual_tools_demo")
-node.start_spin_thread()
+node = rclcpp.Node("moveit_visual_tools_demo")
visual_tools = mvt.MoveItVisualTools(node, "world", "/moveit_visual_tools")
visual_tools.load_planning_scene_monitor()
visual_tools.load_marker_publisher(True)
@@ -129,3 +129,5 @@
cylinder_pose.position.x += 0.1 + i
visual_tools.trigger_planning_scene_update()
time.sleep(1.0)
+
+rclcpp.shutdown()
diff --git a/python/src/moveit_visual_tools.cpp b/python/src/moveit_visual_tools.cpp
index 44cde2a..42b4648 100644
--- a/python/src/moveit_visual_tools.cpp
+++ b/python/src/moveit_visual_tools.cpp
@@ -3,7 +3,7 @@
#include
#include
#include
-#include
+#include
namespace py = pybind11;
using py::literals::operator""_a;
@@ -18,9 +18,8 @@ PYBIND11_MODULE(pymoveit_visual_tools, m)
py::module::import("moveit.core.planning_scene");
py::class_(m, "MoveItVisualTools")
- .def(py::init(
- [](const rviz_visual_tools::RvizVisualToolsNode::SharedPtr& node) { return MoveItVisualTools(node); }))
- .def(py::init([](const rviz_visual_tools::RvizVisualToolsNode::SharedPtr& node, const std::string& base_frame,
+ .def(py::init([](const rclcpp::Node::SharedPtr& node) { return MoveItVisualTools(node); }))
+ .def(py::init([](const rclcpp::Node::SharedPtr& node, const std::string& base_frame,
const std::string& marker_topic) { return MoveItVisualTools(node, base_frame, marker_topic); }),
"node"_a, "base_frame"_a, "marker_topic"_a = rviz_visual_tools::RVIZ_MARKER_TOPIC)
.def("set_robot_state_topic", &MoveItVisualTools::setRobotStateTopic)