dusty-nv / ros_deep_learning

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

Map topics with a new node in ROS2 #66

Closed Ryan-ZL-Lin closed 3 years ago

Ryan-ZL-Lin commented 3 years ago

Hi @dusty-nv I tried to create a new node (move_controller) to subscribe the detectnet/detection topic, if I don't remap the topic in detectnet.ros2.launch, I get the following result Node Graph-Old

After I remap the topic in detectnet.ros2.launch as follows

<node pkg="ros_deep_learning" exec="move_controller" output="screen">
        <remap from="/move_controller/detections" to="/detectnet/detections"/>
    </node>

I got an error saying that the the new node has died due to the mapping

[detectnet-2] [INFO] [detectnet]: detected 1 objects in 1280x720 image [ERROR] [move_controller-3]: process has died [pid 26614, exit code -11, cmd '/home/jetbot/ros_workspace/install/ros_deep_learning/lib/ros_deep_learning/move_controller --ros-args -r /move_controller/detections:=/detectnet/detections']. [detectnet-2] [INFO] [detectnet]: object 0 class #77 (cell phone) confidence=0.954816

Based on your experience on successful mapping the topic on node detectnet, do you have any idea what might be the potential root cause?

BTW, I'm using jetson nano, ROS2 eloquent

Ryan-ZL-Lin commented 3 years ago

issue close, I found that the callback of subscriber needs to be designed as follows: void det_callback( const vision_msgs::Detection2DArray::SharedPtr input)