zauberzeug / ros_nicegui_turtlesim_joystick

A simple ROS2 example that uses a joystick to control the turtlesim node.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot shutdown the node from terminal.

kyuhyong opened this issue · comments

The node is working ok but I cannot shut the node down by Ctrl+C but only by "kill" command.
I tried to add a button to shut it down from web

ui.button('shutdown', on_click=lambda: self.shutdown())

def shutdown(self):
    self.destroy_node()

But this does not work either.

Asked to destroy handle, but it was already destroyed
Traceback (most recent call last):
  File "/home/kyu/.local/lib/python3.8/site-packages/nicegui/events.py", line 400, in handle_event
    result = handler(arguments) if expects_arguments else handler()
  File "/home/kyu/uds_mmu_workspace/build/uds_gcs_commander/uds_gcs_commander/gcs_ui.py", line 78, in <lambda>
    ui.button('shutdown', on_click=lambda: self.shutdown())
  File "/home/kyu/uds_mmu_workspace/build/uds_gcs_commander/uds_gcs_commander/gcs_ui.py", line 82, in shutdown
    self.destroy_node()
  File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/node.py", line 1533, in destroy_node
    self.handle.destroy()
  File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/handle.py", line 92, in destroy
    raise InvalidHandle('Asked to destroy handle, but it was already destroyed')
rclpy.handle.InvalidHandle: Asked to destroy handle, but it was already destroyed

How can I terminate with Ctrl+c as usual?

Hi @kyuhyong,

It looks like your problem has been solved by installing ROS Humble, as mentioned here: zauberzeug/nicegui#2356 (comment).
Is that correct?

@falkoschindler Yes that is correct.