rknn-toolkit2 icon indicating copy to clipboard operation
rknn-toolkit2 copied to clipboard

ROS init_node issue

Open WWX-alpha opened this issue 1 year ago • 4 comments

If rospy and RKNNLite are imported at same time, follow error occurs:

orangepi@orangepi5plus:~/spt_ws/src$ /bin/python /home/orangepi/spt_ws/src/serialTest/scripts/yoloRosTest.py
Traceback (most recent call last):
  File "/home/orangepi/spt_ws/src/serialTest/scripts/yoloRosTest.py", line 236, in <module>
    rospy.init_node('detect_node') #定义节点
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/client.py", line 309, in init_node
    rospy.core.configure_logging(resolved_node_name)
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/core.py", line 405, in configure_logging
    _log_filename = rosgraph.roslogging.configure_logging('rospy', level, filename=filename)
  File "/opt/ros/noetic/lib/python3/dist-packages/rosgraph/roslogging.py", line 192, in configure_logging
    logging.config.fileConfig(config_file, disable_existing_loggers=False)
  File "/usr/lib/python3.8/logging/config.py", line 79, in fileConfig
    handlers = _install_handlers(cp, formatters)
  File "/usr/lib/python3.8/logging/config.py", line 148, in _install_handlers
    h.setLevel(level)
  File "/usr/lib/python3.8/logging/__init__.py", line 916, in setLevel
    self.level = _checkLevel(level)
  File "/usr/lib/python3.8/logging/__init__.py", line 198, in _checkLevel
    raise ValueError("Unknown level: %r" % level)
ValueError: Unknown level: 'DEBUG'

my code:

#!/usr/bin/env python3
#coding = utf-8

import rospy
import numpy as np
import cv2
from rknnlite.api import RKNNLite

if __name__ == '__main__':
    rospy.init_node('detect_node') 

WWX-alpha avatar Jan 02 '24 14:01 WWX-alpha

It looks like RKNN overrides ros logging. Try to launch detection in a separate process may help you.

fronos avatar Mar 07 '24 11:03 fronos

same issue , import RKNNLite after init_node

knifecutter avatar Mar 20 '24 10:03 knifecutter

same issue , import RKNNLite after init_node

hi bro ,could you show some details ,how to import RKNNLite after that ,thank you

yueluweiming avatar Jul 11 '24 13:07 yueluweiming

same issue , import RKNNLite after init_node

hi bro ,could you show some details ,how to import RKNNLite after that ,thank you

maybe just init_node first and then import RKNNLite. but I used multiprossing to seprate them in two threads, one for ROS and another for RKNN, then use pipe to communicate.

WWX-alpha avatar Jul 11 '24 15:07 WWX-alpha