iRobotEducation / create3_examples

Example nodes to drive the iRobot® Create® 3 Educational Robot
BSD 3-Clause "New" or "Revised" License
51 stars 12 forks source link

FeatureRequest: Dance example create3_dance.py should exit at end of dance #13

Closed slowrunner closed 2 years ago

slowrunner commented 2 years ago

Create3 Dance example create3_dance.py should exit after it logs "Time xx.x Finished Dance Sequence"

Presently, at the end of the dance sequence, the program sits spinning without purpose. It does not even catch quit via KeyboardInterrupt cleanly:

[INFO] [1635856344.914966551] [dance_command_publisher]: Time 1635856344.907283 Finished Dance Sequence
^CTraceback (most recent call last):
  File "/home/ubuntu/create3ros/create3_examples_ws/install/create3_examples_py/lib/create3_examples_py/create3_dance", line 11, in <module>
    load_entry_point('create3-examples-py==0.0.1', 'console_scripts', 'create3_dance')()
  File "/home/ubuntu/create3ros/create3_examples_ws/install/create3_examples_py/lib/python3.8/site-packages/create3_examples_py/dance/create3_dance.py", line 73, in main
    rclpy.spin(dance_publisher)
  File "/opt/ros/galactic/lib/python3.8/site-packages/rclpy/__init__.py", line 196, in spin
    executor.spin_once()
  File "/opt/ros/galactic/lib/python3.8/site-packages/rclpy/executors.py", line 699, in spin_once
    handler, entity, node = self.wait_for_ready_callbacks(timeout_sec=timeout_sec)
  File "/opt/ros/galactic/lib/python3.8/site-packages/rclpy/executors.py", line 685, in wait_for_ready_callbacks
    return next(self._cb_iter)
  File "/opt/ros/galactic/lib/python3.8/site-packages/rclpy/executors.py", line 530, in _wait_for_ready_callbacks
    context_stack.enter_context(srv.handle)
  File "/usr/lib/python3.8/contextlib.py", line 426, in enter_context
    self._push_cm_exit(cm, _exit)
  File "/usr/lib/python3.8/contextlib.py", line 461, in _push_cm_exit
    self._push_exit_callback(_exit_wrapper, True)
  File "/usr/lib/python3.8/contextlib.py", line 464, in _push_exit_callback
    self._exit_callbacks.append((is_sync, callback))
KeyboardInterrupt
slowrunner commented 2 years ago

Confirmed KeyboardInterrupt handled during execution, and dance node exits at completion of dance.

Super!