Skip to content

Commit

Permalink
Fix unclean node shutdown on ctrl-c
Browse files Browse the repository at this point in the history
  • Loading branch information
process1183 committed Jun 7, 2022
1 parent 3e06832 commit 0901968
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ros2_bno055/bno055.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,11 @@ def diag_timer_callback(self) -> None:
def main(args = None) -> None:
rclpy.init(args=args)
bno055_pub = BNO055Pub()
rclpy.spin(bno055_pub)

try:
rclpy.spin(bno055_pub)
except KeyboardInterrupt:
pass

bno055_pub.destroy_node()
rclpy.shutdown()
Expand Down

0 comments on commit 0901968

Please sign in to comment.