RobotLocomotion / drake-ros

Experimental prototyping (for now)
Apache License 2.0
91 stars 38 forks source link

Flaky test tf2_test.py:test_nominal_case #259

Open sloretz opened 1 year ago

sloretz commented 1 year ago

Unexpected test failure of tf2_test.py in #258. The test passed after re-running the job.

https://github.com/RobotLocomotion/drake-ros/actions/runs/4411951236/jobs/7730944385

  12: Test command: /usr/bin/python3.10 "-u" "/opt/ros/humble/share/ament_cmake_test/cmake/run_test.py" "/__w/drake-ros/drake-ros/ros_ws/build/drake_ros/test_results/drake_ros/tf2_test_py.xml" "--package-name" "drake_ros" "--command" "/usr/bin/python3.10" "/__w/drake-ros/drake-ros/ros_ws/src/rx7djvfvei/drake-ros/drake_ros/drake_ros/test/tf2_test.py" "--junit-xml=/__w/drake-ros/drake-ros/ros_ws/build/drake_ros/test_results/drake_ros/tf2_test_py.xml" "--junit-prefix=drake_ros"
  12: Test timeout computed to be: 60
  12: -- run_test.py: invoking following command in '/__w/drake-ros/drake-ros/ros_ws/build/drake_ros/py':
  12:  - /usr/bin/python3.10 /__w/drake-ros/drake-ros/ros_ws/src/rx7djvfvei/drake-ros/drake_ros/drake_ros/test/tf2_test.py --junit-xml=/__w/drake-ros/drake-ros/ros_ws/build/drake_ros/test_results/drake_ros/tf2_test_py.xml --junit-prefix=drake_ros
  12: ============================= test session starts ==============================
  12: platform linux -- Python 3.10.6, pytest-7.2.2, pluggy-1.0.0
  12: rootdir: /__w/drake-ros/drake-ros/ros_ws
  12: plugins: ament-flake8-0.12.5, ament-xmllint-0.12.5, ament-pep257-0.12.5, ament-lint-0.12.5, launch-testing-1.0.4, launch-testing-ros-0.19.4, ament-copyright-0.12.5, rerunfailures-11.1.2, mock-3.10.0, repeat-0.9.1, cov-4.0.0, colcon-core-0.6.1
  12: collected 1 item
  12: 
  12: ../../../src/rx7djvfvei/drake-ros/drake_ros/drake_ros/test/tf2_test.py F [100%]
  12: 
  12: =================================== FAILURES ===================================
  12: ______________________________ test_nominal_case _______________________________
  12: 
  12:     def test_nominal_case():
  12:         drake_ros.core.init()
  12:     
  12:         builder = DiagramBuilder()
  12:     
  12:         sys_ros_interface = builder.AddSystem(
  12:             RosInterfaceSystem('test_tf_broadcaster_py'))
  12:     
  12:         scene_graph = builder.AddSystem(SceneGraph())
  12:         source_id = scene_graph.RegisterSource('test_source')
  12:         odom_frame = scene_graph.RegisterFrame(
  12:             source_id, GeometryFrame('odom'))
  12:         base_link_frame = scene_graph.RegisterFrame(
  12:             source_id, odom_frame, GeometryFrame('base_link'))
  12:     
  12:         X_WO = RigidTransform(
  12:             R=RotationMatrix.Identity(),
  12:             p=np.array([1., 1., 0.]))
  12:         X_OB = RigidTransform(
  12:             rpy=RollPitchYaw(0., 0., math.pi / 2.),
  12:             p=np.array([1., 1., 0.]))
  12:     
  12:         pose_vector = FramePoseVector()
  12:         pose_vector.set_value(odom_frame, X_WO)
  12:         pose_vector.set_value(base_link_frame, X_OB)
  12:     
  12:         pose_vector_source = builder.AddSystem(
  12:             ConstantValueSource(AbstractValue.Make(pose_vector)))
  12:     
  12:         builder.Connect(
  12:             pose_vector_source.get_output_port(),
  12:             scene_graph.get_source_pose_port(source_id))
  12:     
  12:         scene_tf_broadcaster = builder.AddSystem(
  12:             SceneTfBroadcasterSystem(
  12:                 sys_ros_interface.get_ros_interface(),
  12:                 params=SceneTfBroadcasterParams(
  12:                     publish_triggers={TriggerType.kForced}
  12:                 )
  12:             )
  12:         )
  12:     
  12:         builder.Connect(
  12:             scene_graph.get_query_output_port(),
  12:             scene_tf_broadcaster.get_graph_query_input_port())
  12:     
  12:         diagram = builder.Build()
  12:         context = diagram.CreateDefaultContext()
  12:     
  12:         rclpy.init()
  12:         node = rclpy.create_node('tf_listener')
  12:     
  12:         buffer_ = tf2_ros.Buffer()
  12:         listener = tf2_ros.TransformListener(buffer_, node, spin_thread=False)  # noqa
  12:     
  12:         time = rclpy.time.Time(seconds=13.)
  12:         stamp = time.to_msg()
  12:     
  12:         context.SetTime(time.nanoseconds / 1e9)
  12:         diagram.ForcedPublish(context)
  12:     
  12:         future = buffer_.wait_for_transform_async('world', 'odom', time)
  12:         rclpy.spin_until_future_complete(node, future, timeout_sec=2)
  12:     
  12: >       assert future.done()
  12: E       assert False
  12: E        +  where False = <bound method Future.done of <rclpy.task.Future object at 0x7fc26b119840>>()
  12: E        +    where <bound method Future.done of <rclpy.task.Future object at 0x7fc26b119840>> = <rclpy.task.Future object at 0x7fc26b119840>.done
  12: 
  12: ../../../src/rx7djvfvei/drake-ros/drake_ros/drake_ros/test/tf2_test.py:94: AssertionError
  12: - generated xml file: /__w/drake-ros/drake-ros/ros_ws/build/drake_ros/test_results/drake_ros/tf2_test_py.xml -
  12: =========================== short test summary info ============================
  12: FAILED ../../../src/rx7djvfvei/drake-ros/drake_ros/drake_ros/test/tf2_test.py::test_nominal_case - assert False
  12:  +  where False = <bound method Future.done of <rclpy.task.Future object at 0x7fc26b119840>>()
  12:  +    where <bound method Future.done of <rclpy.task.Future object at 0x7fc26b119840>> = <rclpy.task.Future object at 0x7fc26b119840>.done
  12: ============================== 1 failed in 2.16s ===============================
  12: -- run_test.py: return code 1
  12: -- run_test.py: verify result file '/__w/drake-ros/drake-ros/ros_ws/build/drake_ros/test_results/drake_ros/tf2_test_py.xml'
  12/14 Test #12: tf2_test_py ......................***Failed    3.55 sec
sloretz commented 1 year ago

Another failure: https://github.com/RobotLocomotion/drake-ros/actions/runs/4441711313/jobs/7797120216?pr=133