leggedrobotics / darknet_ros

YOLO ROS: Real-Time Object Detection for ROS
BSD 3-Clause "New" or "Revised" License
2.23k stars 1.18k forks source link

How to get BoundingBOX msgs in another node? #146

Open QiuYilin opened 5 years ago

QiuYilin commented 5 years ago

I try to write a node to receive and show data of Bounding Box like below.

include "ros/ros.h"

include <darknet_ros_msgs/BoundingBoxes.h>

include <darknet_ros_msgs/BoundingBox.h>

using namespace std; void msgCallback(const darknet_ros_msgs::BoundingBoxes::ConstPtr& msg)

{ cout<<"Bouding Boxes (header):" << msg->header <<endl; cout<<"Bouding Boxes (image_header):" << msg->image_header <<endl; cout<<"Bouding Boxes (Class):" << msg->bounding_boxes[0].Class <<endl; cout<<"Bouding Boxes (xmin):" << msg->bounding_boxes[0].xmin <<endl; cout<<"Bouding Boxes (xmax):" << msg->bounding_boxes[0].xmax <<endl; cout<<"Bouding Boxes (ymin):" << msg->bounding_boxes[0].ymin <<endl; cout<<"Bouding Boxes (ymax):" << msg->bounding_boxes[0].ymax <<endl; cout << "\033[2J\033[1;1H"; // clear terminal } int main(int argc, char **argv) { ros::init(argc,argv,"coord_pixel_subscriber"); ros::NodeHandle nh; ros::Subscriber ros_coord_pixel_sub = nh.subscribe("/darknet_ros/bounding_boxes",100,msgCallback); ros::spin(); return 0; }

I have modify the cmakelist.txt and package.xml

cmakelist.txt cmake_minimum_required(VERSION 2.8.3) project(coord_tran)

find_package(catkin REQUIRED COMPONENTS geometry_msgs roscpp rospy std_msgs darknet_ros message_generation )

catkin_package( INCLUDE_DIRS include LIBRARIES coord_tran CATKIN_DEPENDS geometry_msgs roscpp rospy std_msgs message_runtime

DEPENDS system_lib

)

include_directories( include ${catkin_INCLUDE_DIRS}

include

${catkin_INCLUDE_DIRS} )

add_executable(coord_tran src/coord_pixel_subscriber.cpp) add_dependencies(coord_tran ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) target_link_libraries(coord_tran ${catkin_LIBRARIES})

package.xml: <?xml version="1.0"?>

coord_tran 0.0.0 The coord_tran package qiuyilin TODO darknet_ros catkin geometry_msgs roscpp rospy std_msgs geometry_msgs roscpp rospy std_msgs message_generation geometry_msgs roscpp rospy std_msgs darknet_ros message_generation message_runtime

but when I run catkin_make, these mistakes happen [100%] Built target darknet_ros /usr/bin/ld: cannot find -lcudart /usr/bin/ld: cannot find -lcublas /usr/bin/ld: cannot find -lcurand collect2: error: ld returned 1 exit status coord_tran/CMakeFiles/coord_tran.dir/build.make:216: recipe for target '/home/qiuyilin/catkin_ws/devel/lib/coord_tran/coord_tran' failed make[2]: [/home/qiuyilin/catkin_ws/devel/lib/coord_tran/coord_tran] Error 1 CMakeFiles/Makefile2:9146: recipe for target 'coord_tran/CMakeFiles/coord_tran.dir/all' failed make[1]: [coord_tran/CMakeFiles/coord_tran.dir/all] Error 2 Makefile:138: recipe for target 'all' failed make: *** [all] Error 2

I don't know how to solve it.

Comedian1926 commented 5 years ago

我遇到了同样的问题,请问你解决了吗:)

Comedian1926 commented 5 years ago

cmakelist.txt cmake_minimum_required(VERSION 2.8.3) project(coord_tran)

find_package(catkin REQUIRED COMPONENTS geometry_msgs roscpp rospy std_msgs darknet_ros message_generation )

中删除darknet_ros,添加darknet_ros_msgs试试

Shame-fight commented 5 years ago

cmakelist.txt cmake_minimum_required(VERSION 2.8.3) project(coord_tran)

find_package(catkin REQUIRED COMPONENTS geometry_msgs roscpp rospy std_msgs darknet_ros message_generation )

中删除darknet_ros,添加darknet_ros_msgs试试

I also want to get BoundingBOX msgs in another node,do you have finished it? can you give me some advices.