22# -*- coding: utf-8 -*-
33
44import sys
5+ import pytest
56import unittest
67import rclcpp
78from geometry_msgs .msg import Pose , PoseStamped , PointStamped , TwistStamped , Vector3Stamped
@@ -13,6 +14,24 @@ def setUpModule():
1314 rclcpp .init ()
1415
1516
17+ # When py_binding_tools and MTC are compiled with different pybind11 versions,
18+ # the corresponding classes are not interoperable.
19+ def check_pybind11_incompatibility ():
20+ rclcpp .init ([])
21+ node = rclcpp .Node ("dummy" )
22+ try :
23+ core .PipelinePlanner (node )
24+ except TypeError :
25+ return True
26+ finally :
27+ rclcpp .shutdown ()
28+ return False
29+
30+
31+ incompatible_pybind11 = check_pybind11_incompatibility ()
32+ incompatible_pybind11_msg = "MoveIt and MTC use incompatible pybind11 versions"
33+
34+
1635class TestPropertyMap (unittest .TestCase ):
1736 def setUp (self ):
1837 self .node = rclcpp .Node ("test_mtc_props" )
@@ -33,6 +52,7 @@ def test_assign(self):
3352 # MotionPlanRequest is not registered as property type and should raise
3453 self .assertRaises (TypeError , self ._check , "request" , MotionPlanRequest ())
3554
55+ @unittest .skipIf (incompatible_pybind11 , incompatible_pybind11_msg )
3656 def test_assign_in_reference (self ):
3757 planner = core .PipelinePlanner (self .node )
3858 props = planner .properties
@@ -115,6 +135,7 @@ def test_allow_collisions(self):
115135
116136
117137class TestStages (unittest .TestCase ):
138+ @unittest .skipIf (incompatible_pybind11 , incompatible_pybind11_msg )
118139 def setUp (self ):
119140 self .node = rclcpp .Node ("test_mtc_stages" )
120141 self .planner = core .PipelinePlanner (self .node )
0 commit comments