mlaiacker / rosbag2video

converts image sequence in ros bag files to video files
GNU General Public License v2.0
313 stars 111 forks source link

/usr/bin/python3.10 ros2bag2video.py ~/Downloads/cheezit_1280_whole.bag --> rclpy.exceptions.InvalidTopicNameException: Invalid topic name: topic name must not be empty string: '' #34

Closed monajalal closed 1 year ago

monajalal commented 1 year ago

I have a bag file called cheezeit_1280_whole.bag how do I use ros2bag2video.py for converting it to a video? It seems the way I am using it is wrong.

(base) mona@ada:~/rosbag2video$ /usr/bin/python3.10 ros2bag2video.py ~/Downloads/cheezit_1280_whole.bag 
FPS (int) =  25
Rate (float) =  1.0
Topic (str) =  
Output File (str) =  output.mp4
Verbose (bool) =  False
Reading info from bag file: /home/mona/Downloads/cheezit_1280_whole.bag
[ERROR] [1698850707.416016253] [rosbag2_storage]: No storage id specified, and no plugin found that could open URI
No plugin detected that could open file /home/mona/Downloads/cheezit_1280_whole.bag
ROS Message name =  
Image count =  0
msgtype =  None
AJB: subscribing to msg:  None on topic:  
Traceback (most recent call last):
  File "/home/mona/rosbag2video/ros2bag2video.py", line 430, in <module>
    main(sys.argv)
  File "/home/mona/rosbag2video/ros2bag2video.py", line 420, in main
    videowriter = RosVideoWriter(args)
  File "/home/mona/rosbag2video/ros2bag2video.py", line 142, in __init__
    self.subscription = self.create_subscription(
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/node.py", line 1356, in create_subscription
    raise ex from None
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/node.py", line 1354, in create_subscription
    self._validate_topic_or_service_name(topic)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/node.py", line 1183, in _validate_topic_or_service_name
    validate_topic_name(topic_or_service_name, is_service=is_service)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/validate_topic_name.py", line 43, in validate_topic_name
    raise InvalidTopicNameException(name, error_msg, invalid_index)
rclpy.exceptions.InvalidTopicNameException: Invalid topic name: topic name must not be empty string:
  ''
   ^
(base) mona@ada:~/rosbag2video$ ls
total 72K
-rwxrwxr-x  1 mona mona  14K Nov  1 09:31 rosbag2video.py
-rwxrwxr-x  1 mona mona  14K Nov  1 09:31 ros2bag2video.py
-rw-rw-r--  1 mona mona 2.5K Nov  1 09:31 README.md
-rw-rw-r--  1 mona mona  18K Nov  1 09:31 LICENSE
-rw-rw-r--  1 mona mona  755 Nov  1 09:31 .gitignore
drwxrwxr-x  8 mona mona 4.0K Nov  1 09:31 .git
drwxrwxr-x  3 mona mona 4.0K Nov  1 09:31 .
drwxr-x--- 55 mona mona 4.0K Nov  1 10:48 ..
(base) mona@ada:~/rosbag2video$ mkdir bag_out
(base) mona@ada:~/rosbag2video$ /usr/bin/python3.10 ros2bag2video.py ~/Downloads/cheezit_1280_whole.bag  bag_out/
FPS (int) =  25
Rate (float) =  1.0
Topic (str) =  
Output File (str) =  output.mp4
Verbose (bool) =  False
Reading info from bag file: /home/mona/Downloads/cheezit_1280_whole.bag
[ERROR] [1698850810.162299632] [rosbag2_storage]: No storage id specified, and no plugin found that could open URI
No plugin detected that could open file /home/mona/Downloads/cheezit_1280_whole.bag
ROS Message name =  
Image count =  0
msgtype =  None
AJB: subscribing to msg:  None on topic:  
Traceback (most recent call last):
  File "/home/mona/rosbag2video/ros2bag2video.py", line 430, in <module>
    main(sys.argv)
  File "/home/mona/rosbag2video/ros2bag2video.py", line 420, in main
    videowriter = RosVideoWriter(args)
  File "/home/mona/rosbag2video/ros2bag2video.py", line 142, in __init__
    self.subscription = self.create_subscription(
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/node.py", line 1356, in create_subscription
    raise ex from None
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/node.py", line 1354, in create_subscription
    self._validate_topic_or_service_name(topic)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/node.py", line 1183, in _validate_topic_or_service_name
    validate_topic_name(topic_or_service_name, is_service=is_service)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/validate_topic_name.py", line 43, in validate_topic_name
    raise InvalidTopicNameException(name, error_msg, invalid_index)
rclpy.exceptions.InvalidTopicNameException: Invalid topic name: topic name must not be empty string:
  ''
   ^

I have ROS 2 Humble in Ubuntu 22.04. The bag file can be downloaded from here: https://github.com/NVlabs/BundleSDF/issues/82#issuecomment-1777539417

Also, I have:

(base) mona@ada:~/rosbag2video$ ros2 bag info  /home/mona/Downloads/cheezit_1280_whole.bag

closing.

closing.
[ERROR] [1698864601.552300192] [rosbag2_storage]: No storage id specified, and no plugin found that could open URI
No plugin detected that could open file /home/mona/Downloads/cheezit_1280_whole.bag
(base) mona@ada:~/rosbag2video$ ls /home/mona/Downloads/cheezit_1280_whole.bag
-rw-rw-r-- 1 mona mona 11G Nov  1 09:33 /home/mona/Downloads/cheezit_1280_whole.bag
monajalal commented 1 year ago

I am trying to get the topic names but I get this error:

$ ros2 bag info ~/Downloads/cheezit_1280_whole.bag 

closing.

closing.
[ERROR] [1698866437.101886092] [rosbag2_storage]: No storage id specified, and no plugin found that could open URI
No plugin detected that could open file /home/mona/Downloads/cheezit_1280_whole.bag

I tried to use rgb as a topic (not sure what exactly the name of topic is) and got this error:

(base) mona@ada:~/rosbag2video$ /usr/bin/python3.10 ros2bag2video.py ~/Downloads/cheezit_1280_whole.bag  -t rgb bag_out/
FPS (int) =  25
Rate (float) =  1.0
Topic (str) =  
Output File (str) =  output.mp4
Verbose (bool) =  False
Reading info from bag file: /home/mona/Downloads/cheezit_1280_whole.bag
[ERROR] [1698866380.991651220] [rosbag2_storage]: No storage id specified, and no plugin found that could open URI
No plugin detected that could open file /home/mona/Downloads/cheezit_1280_whole.bag
ROS Message name =  
Image count =  0
msgtype =  None
AJB: subscribing to msg:  None on topic:  
Traceback (most recent call last):
  File "/home/mona/rosbag2video/ros2bag2video.py", line 430, in <module>
    main(sys.argv)
  File "/home/mona/rosbag2video/ros2bag2video.py", line 420, in main
    videowriter = RosVideoWriter(args)
  File "/home/mona/rosbag2video/ros2bag2video.py", line 142, in __init__
    self.subscription = self.create_subscription(
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/node.py", line 1356, in create_subscription
    raise ex from None
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/node.py", line 1354, in create_subscription
    self._validate_topic_or_service_name(topic)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/node.py", line 1183, in _validate_topic_or_service_name
    validate_topic_name(topic_or_service_name, is_service=is_service)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/validate_topic_name.py", line 43, in validate_topic_name
    raise InvalidTopicNameException(name, error_msg, invalid_index)
rclpy.exceptions.InvalidTopicNameException: Invalid topic name: topic name must not be empty string:
  ''
   ^