dusty-nv / ros_deep_learning

Deep learning inference nodes for ROS / ROS2 with support for NVIDIA Jetson and TensorRT
887 stars 258 forks source link

Can't read from topic from vision_msgs.msg Import Detection2DArray #58

Open ljenster opened 3 years ago

ljenster commented 3 years ago

Hey guys, So I've made a package that has a python script which subscribes to the detectnet topic detections, but when I try to read the msg i get the error:

Traceback (most recent call last):
  File "/home/lars/catkin_ws/src/internship_lars/scripts/listener.py", line 5, in <module>
    from vision_msgs.msg import Detection2DArray

The code that matters:

from vision_msgs.msg import Detection2DArray

rospy.Subscriber('/detectnet/detections', Detection2DArray, callback2) 

Hope anone can see what I'm obviously doing wrong, something with the XML or CMakeLists?

CMakeLists.txt

cmake_minimum_required(VERSION 3.0.2)
project(internship_lars)

find_package(catkin REQUIRED COMPONENTS
  roscpp
  rospy
  std_msgs
  vision_msgs
)

generate_messages(
  DEPENDENCIES
  std_msgs
  vision_msgs
)

catkin_package(
   CATKIN_DEPENDS vision_msgs
)

include_directories(
  ${catkin_INCLUDE_DIRS}
)

catkin_install_python(PROGRAMS scripts/talker.py scripts/listener.py scripts/dataSubscribe.py
  DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

Package.xml:

<?xml version="1.0"?>
<package format="2">
  <name>internship_lars</name>
  <version>0.0.0</version>
  <description>The internship_lars package</description>

  <license>TODO</license>

  <build_depend>message_generation</build_depend>

  <buildtool_depend>catkin</buildtool_depend>
  <build_depend>roscpp</build_depend>
  <build_depend>rospy</build_depend>
  <build_depend>std_msgs</build_depend>
  <build_depend>vision_msgs</build_depend>
  <build_export_depend>roscpp</build_export_depend>
  <build_export_depend>rospy</build_export_depend>
  <build_export_depend>std_msgs</build_export_depend>
  <exec_depend>roscpp</exec_depend>
  <exec_depend>rospy</exec_depend>
  <exec_depend>std_msgs</exec_depend>
  <exec_depend>vision_msgs</exec_depend>

  <export>

  </export>
</package>
WaldoPepper commented 3 years ago

Have you tried

rostopic echo /detectnet/detections

If the detection messages are unknown to your environment, you should get an error message....