How to make another package node get BoundingBox msgs frome darknet_ros
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,"cood_subscriber");
ros::NodeHandle nh;
ros::Subscriber cood_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(cood_tran)
find_package(catkin REQUIRED COMPONENTS roscpp darknet_ros darknet_ros_msgs)
catkin_package(
#INCLUDE_DIRS include
LIBRARIES cood_tran
)
include_directories(
include
${catkin_INCLUDE_DIRS}
)
add_executable(cood_tran src/cood_tran.cpp)
add_dependencies(cood_tran ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
target_link_libraries(cood_tran ${catkin_LIBRARIES} )
package.xml:
<?xml version="1.0"?>
<package format="2">
<name>cood_tran</name>
<version>0.0.0</version>
<description>The cood_tran package</description>
<maintainer email="qiuyilin@qq.com">qiuyilin</maintainer> <!-- One license tag required, multiple allowed, one license per tag -->
<license>TODO</license> <!-- Url tags are optional, but multiple are allowed, one per tag -->
<buildtool_depend>catkin</buildtool_depend> <!-- The export tag contains other, unspecified, tags -->
<export>
</export>
<build_depend>roscpp</build_depend>
<build_depend>darknet_ros</build_depend>
<build_depend>std_msgs</build_depend>
<build_depend>darknet_ros_msgs</build_depend>
<exec_depend>roscpp</exec_depend>
<exec_depend>darknet_ros</exec_depend>
<exec_depend>std_msgs</exec_depend>
<exec_depend>darknet_ros_msgs</exec_depend>
</package>
but when I run catkin_make, these mistakes happen
Packages "coord_tran, realsense-2.1.1" not found in the workspace - ignoring them
-- Using CATKIN_DEVEL_PREFIX: /home/qiuyilin/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/kinetic
-- This workspace overlays: /opt/ros/kinetic
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/qiuyilin/catkin_ws/build/test_results
-- Found gmock sources under '/usr/src/gmock': gmock will be built
-- Found gtest sources under '/usr/src/gmock': gtests will be built
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.7.14
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~ traversing 39 packages in topological order:
-- ~~ - image_pipeline (metapackage)
-- ~~ - moveit_dobot
-- ~~ - panda_moveit_config
-- ~~ - universal_robot (metapackage)
-- ~~ - ur_description
-- ~~ - ur_msgs
-- ~~ - dobot
-- ~~ - my_first_ros_pkg
-- ~~ - my_second_ros_pkg
-- ~~ - ros_tutorials_param
-- ~~ - ros_tutorials_service
-- ~~ - ros_tutorials_topic
-- ~~ - camera_calibration
-- ~~ - magician
-- ~~ - ros_tutorials_action
-- ~~ - darknet_ros_msgs
-- ~~ - darknet_ros
-- ~~ - cood_tran
-- ~~ - image_proc
-- ~~ - image_publisher
-- ~~ - image_view
-- ~~ - stereo_image_proc
-- ~~ - depth_image_proc
-- ~~ - realsense2_camera
-- ~~ - image_rotate
-- ~~ - ur_bringup
-- ~~ - ur_driver
-- ~~ - ur_gazebo
-- ~~ - mimic_parallel_link_description
-- ~~ - ur_kinematics
-- ~~ - video_stream_opencv
-- ~~ - moveit_tutorials
-- ~~ - seven_dof_arm_test
-- ~~ - mastering_ros_robot_description_pkg
-- ~~ - seven_dof_arm_config
-- ~~ - seven_dof_arm_gazebo
-- ~~ - ur10_moveit_config
-- ~~ - ur3_moveit_config
-- ~~ - ur5_moveit_config
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin metapackage: 'image_pipeline'
-- ==> add_subdirectory(image_pipeline-indigo/image_pipeline)
-- +++ processing catkin package: 'moveit_dobot'
-- ==> add_subdirectory(moveit_dobot)
-- +++ processing catkin package: 'panda_moveit_config'
-- ==> add_subdirectory(panda_moveit_config)
-- +++ processing catkin metapackage: 'universal_robot'
-- ==> add_subdirectory(universal_robot/universal_robot)
-- +++ processing catkin package: 'ur_description'
-- ==> add_subdirectory(universal_robot/ur_description)
-- +++ processing catkin package: 'ur_msgs'
-- ==> add_subdirectory(universal_robot/ur_msgs)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- ur_msgs: 6 messages, 2 services
-- +++ processing catkin package: 'dobot'
-- ==> add_subdirectory(dobot)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- dobot: 0 messages, 60 services
-- +++ processing catkin package: 'my_first_ros_pkg'
-- ==> add_subdirectory(my_first_ros_pkg)
-- +++ processing catkin package: 'my_second_ros_pkg'
-- ==> add_subdirectory(my_second_ros_pkg)
-- +++ processing catkin package: 'ros_tutorials_param'
-- ==> add_subdirectory(ros_tutorials_param)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- ros_tutorials_param: 0 messages, 1 services
-- +++ processing catkin package: 'ros_tutorials_service'
-- ==> add_subdirectory(ros_tutorials_service)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- ros_tutorials_service: 0 messages, 1 services
-- +++ processing catkin package: 'ros_tutorials_topic'
-- ==> add_subdirectory(ros_tutorials_topic)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- ros_tutorials_topic: 1 messages, 0 services
-- +++ processing catkin package: 'camera_calibration'
-- ==> add_subdirectory(image_pipeline-indigo/camera_calibration)
-- +++ processing catkin package: 'magician'
-- ==> add_subdirectory(magician-master)
-- +++ processing catkin package: 'ros_tutorials_action'
-- ==> add_subdirectory(ros_tutorials_action)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- Generating .msg files for action ros_tutorials_action/Fibonacci /home/qiuyilin/catkin_ws/src/ros_tutorials_action/action/Fibonacci.action
-- ros_tutorials_action: 7 messages, 0 services
-- +++ processing catkin package: 'darknet_ros_msgs'
-- ==> add_subdirectory(darknet_ros/darknet_ros_msgs)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- Generating .msg files for action darknet_ros_msgs/CheckForObjects /home/qiuyilin/catkin_ws/src/darknet_ros/darknet_ros_msgs/action/CheckForObjects.action
-- darknet_ros_msgs: 9 messages, 0 services
-- +++ processing catkin package: 'darknet_ros'
-- ==> add_subdirectory(darknet_ros/darknet_ros)
Darknet path dir = /home/qiuyilin/catkin_ws/src/darknet_ros/darknet
-- CUDA Version:
-- CUDA Libararies: /usr/local/cuda/lib64/libcudart_static.a;-lpthread;dl;/usr/lib/x86_64-linux-gnu/librt.so
-- Searching for X11...
-- X11_INCLUDE_DIR: /usr/include
-- X11_LIBRARIES: /usr/lib/x86_64-linux-gnu/libSM.so/usr/lib/x86_64-linux-gnu/libICE.so/usr/lib/x86_64-linux-gnu/libX11.so/usr/lib/x86_64-linux-gnu/libXext.so
-- Boost version: 1.58.0
-- Found the following Boost libraries:
-- thread
-- chrono
-- system
-- date_time
-- atomic
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- Checking and downloading yolov2-tiny.weights if needed ...
-- Checking and downloading yolov3.weights if needed ...
-- Checking and downloading yolov2.weights if needed ...
-- +++ processing catkin package: 'cood_tran'
-- ==> add_subdirectory(cood_tran)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- +++ processing catkin package: 'image_proc'
-- ==> add_subdirectory(image_pipeline-indigo/image_proc)
-- Boost version: 1.58.0
-- Found the following Boost libraries:
-- thread
-- chrono
-- system
-- date_time
-- atomic
-- +++ processing catkin package: 'image_publisher'
-- ==> add_subdirectory(image_pipeline-indigo/image_publisher)
-- Found OpenCV: /opt/ros/kinetic (found version "3.3.1") found components: core
-- opencv version 3.3.1
-- Found OpenCV: /opt/ros/kinetic (found suitable version "3.3.1", minimum required is "3") found components: core imgcodecs videoio
-- +++ processing catkin package: 'image_view'
-- ==> add_subdirectory(image_pipeline-indigo/image_view)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- Boost version: 1.58.0
-- Found the following Boost libraries:
-- signals
-- thread
-- chrono
-- system
-- date_time
-- atomic
-- Found OpenCV: /opt/ros/kinetic (found version "3.3.1")
-- +++ processing catkin package: 'stereo_image_proc'
-- ==> add_subdirectory(image_pipeline-indigo/stereo_image_proc)
-- Boost version: 1.58.0
-- Found the following Boost libraries:
-- thread
-- chrono
-- system
-- date_time
-- atomic
-- +++ processing catkin package: 'depth_image_proc'
-- ==> add_subdirectory(image_pipeline-indigo/depth_image_proc)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- Boost version: 1.58.0
-- +++ processing catkin package: 'realsense2_camera'
-- ==> add_subdirectory(realsense-2.1.1/realsense2_camera)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- Create Debug Build.
-- realsense2_camera: 2 messages, 0 services
-- +++ processing catkin package: 'image_rotate'
-- ==> add_subdirectory(image_pipeline-indigo/image_rotate)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- Found OpenCV: /opt/ros/kinetic (found version "3.3.1") found components: core imgproc
-- +++ processing catkin package: 'ur_bringup'
-- ==> add_subdirectory(universal_robot/ur_bringup)
-- +++ processing catkin package: 'ur_driver'
-- ==> add_subdirectory(universal_robot/ur_driver)
-- +++ processing catkin package: 'ur_gazebo'
-- ==> add_subdirectory(universal_robot/ur_gazebo)
-- +++ processing catkin package: 'mimic_parallel_link_description'
-- ==> add_subdirectory(mimic_parallel_link_description)
-- +++ processing catkin package: 'ur_kinematics'
-- ==> add_subdirectory(universal_robot/ur_kinematics)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- Boost version: 1.58.0
-- Found the following Boost libraries:
-- system
-- +++ processing catkin package: 'video_stream_opencv'
-- ==> add_subdirectory(video_stream_opencv-master)
-- Found OpenCV: /opt/ros/kinetic (found version "3.3.1")
-- +++ processing catkin package: 'moveit_tutorials'
-- ==> add_subdirectory(moveit_tutorials)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- Boost version: 1.58.0
-- Found the following Boost libraries:
-- system
-- filesystem
-- date_time
-- thread
-- chrono
-- atomic
-- +++ processing catkin package: 'seven_dof_arm_test'
-- ==> add_subdirectory(seven_dof_arm_test)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- +++ processing catkin package: 'mastering_ros_robot_description_pkg'
-- ==> add_subdirectory(mastering_ros/mastering_ros_robot_description_pkg)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- +++ processing catkin package: 'seven_dof_arm_config'
-- ==> add_subdirectory(mastering_ros/seven_dof_arm_config)
-- +++ processing catkin package: 'seven_dof_arm_gazebo'
-- ==> add_subdirectory(mastering_ros/seven_dof_arm_gazebo)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- +++ processing catkin package: 'ur10_moveit_config'
-- ==> add_subdirectory(universal_robot/ur10_moveit_config)
-- +++ processing catkin package: 'ur3_moveit_config'
-- ==> add_subdirectory(universal_robot/ur3_moveit_config)
-- +++ processing catkin package: 'ur5_moveit_config'
-- ==> add_subdirectory(universal_robot/ur5_moveit_config)
-- Configuring done
-- Generating done
-- Build files have been written to: /home/qiuyilin/catkin_ws/build
[ 0%] Built target actionlib_msgs_generate_messages_cpp
[ 0%] Built target std_msgs_generate_messages_cpp
[ 0%] Built target geometry_msgs_generate_messages_cpp
[ 0%] Built target _darknet_ros_msgs_generate_messages_check_deps_CheckForObjectsActionFeedback
[ 0%] Built target _darknet_ros_msgs_generate_messages_check_deps_CheckForObjectsGoal
[ 0%] Built target _darknet_ros_msgs_generate_messages_check_deps_CheckForObjectsActionResult
[ 0%] Built target _darknet_ros_msgs_generate_messages_check_deps_BoundingBox
[ 0%] Built target sensor_msgs_generate_messages_cpp
[ 0%] Built target _darknet_ros_msgs_generate_messages_check_deps_CheckForObjectsFeedback
[ 0%] Built target _darknet_ros_msgs_generate_messages_check_deps_CheckForObjectsAction
[ 0%] Built target _darknet_ros_msgs_generate_messages_check_deps_BoundingBoxes
[ 0%] Built target _darknet_ros_msgs_generate_messages_check_deps_CheckForObjectsResult
[ 0%] Built target _darknet_ros_msgs_generate_messages_check_deps_CheckForObjectsActionGoal
[ 8%] Built target darknet_ros_msgs_generate_messages_cpp
[ 91%] Built target darknet_ros_lib
[100%] Built target darknet_ros
[ 0%] Built target geometry_msgs_generate_messages_cpp
[ 0%] Built target std_msgs_generate_messages_cpp
[ 0%] Built target actionlib_msgs_generate_messages_cpp
[ 0%] Built target _darknet_ros_msgs_generate_messages_check_deps_CheckForObjectsActionResult
[ 0%] Built target sensor_msgs_generate_messages_cpp
[ 0%] Built target _darknet_ros_msgs_generate_messages_check_deps_CheckForObjectsActionFeedback
[ 0%] Built target _darknet_ros_msgs_generate_messages_check_deps_CheckForObjectsGoal
[ 0%] Built target _darknet_ros_msgs_generate_messages_check_deps_BoundingBox
[ 0%] Built target _darknet_ros_msgs_generate_messages_check_deps_CheckForObjectsFeedback
[ 0%] Built target _darknet_ros_msgs_generate_messages_check_deps_CheckForObjectsAction
[ 0%] Built target std_msgs_generate_messages_py
[ 0%] Built target std_msgs_generate_messages_eus
[ 0%] Built target _darknet_ros_msgs_generate_messages_check_deps_BoundingBoxes
[ 0%] Built target std_msgs_generate_messages_lisp
[ 0%] Built target roscpp_generate_messages_py
[ 0%] Built target geometry_msgs_generate_messages_py
[ 0%] Built target std_msgs_generate_messages_nodejs
[ 0%] Built target geometry_msgs_generate_messages_nodejs
[ 0%] Built target roscpp_generate_messages_lisp
[ 0%] Built target _darknet_ros_msgs_generate_messages_check_deps_CheckForObjectsResult
[ 0%] Built target roscpp_generate_messages_eus
[ 0%] Built target rosgraph_msgs_generate_messages_lisp
[ 0%] Built target roscpp_generate_messages_cpp
[ 0%] Built target _darknet_ros_msgs_generate_messages_check_deps_CheckForObjectsActionGoal
[ 0%] Built target roscpp_generate_messages_nodejs
[ 0%] Built target geometry_msgs_generate_messages_eus
[ 0%] Built target geometry_msgs_generate_messages_lisp
[ 0%] Built target rosgraph_msgs_generate_messages_cpp
[ 0%] Built target rosgraph_msgs_generate_messages_eus
[ 0%] Built target rosgraph_msgs_generate_messages_nodejs
[ 0%] Built target rosgraph_msgs_generate_messages_py
[ 0%] Built target actionlib_generate_messages_py
[ 0%] Built target actionlib_msgs_generate_messages_nodejs
[ 0%] Built target actionlib_generate_messages_cpp
[ 0%] Built target actionlib_msgs_generate_messages_eus
[ 0%] Built target actionlib_generate_messages_eus
[ 0%] Built target actionlib_generate_messages_nodejs
[ 0%] Built target actionlib_msgs_generate_messages_py
[ 0%] Built target actionlib_msgs_generate_messages_lisp
[ 0%] Built target actionlib_generate_messages_lisp
[ 0%] Built target sensor_msgs_generate_messages_eus
[ 0%] Built target sensor_msgs_generate_messages_lisp
[ 0%] Built target sensor_msgs_generate_messages_py
[ 0%] Built target sensor_msgs_generate_messages_nodejs
[ 5%] Built target darknet_ros_msgs_generate_messages_cpp
[ 17%] Built target darknet_ros_msgs_generate_messages_eus
[ 23%] Built target darknet_ros_msgs_generate_messages_lisp
[ 29%] Built target darknet_ros_msgs_generate_messages_py
[ 41%] Built target darknet_ros_msgs_generate_messages_nodejs
[100%] Built target darknet_ros_lib
Scanning dependencies of target cood_tran
[100%] Building CXX object cood_tran/CMakeFiles/cood_tran.dir/src/cood_tran.cpp.o
[100%] Linking CXX executable /home/qiuyilin/catkin_ws/devel/lib/cood_tran/cood_tran
/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
cood_tran/CMakeFiles/cood_tran.dir/build.make:216: recipe for target '/home/qiuyilin/catkin_ws/devel/lib/cood_tran/cood_tran' failed
make[2]: *** [/home/qiuyilin/catkin_ws/devel/lib/cood_tran/cood_tran] Error 1
CMakeFiles/Makefile2:9146: recipe for target 'cood_tran/CMakeFiles/cood_tran.dir/all' failed
make[1]: *** [cood_tran/CMakeFiles/cood_tran.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
Base path: /home/qiuyilin/catkin_ws
Source space: /home/qiuyilin/catkin_ws/src
Build space: /home/qiuyilin/catkin_ws/build
Devel space: /home/qiuyilin/catkin_ws/devel
Install space: /home/qiuyilin/catkin_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/qiuyilin/catkin_ws/build"
####
####
#### Running command: "make -j8 -l8" in "/home/qiuyilin/catkin_ws/build/darknet_ros/darknet_ros"
####
####
#### Running command: "make -j8 -l8" in "/home/qiuyilin/catkin_ws/build/cood_tran"
####
make: *** [all] Error 2
Invoking "make -j8 -l8" failed
I don't know how to solve it. Is it Related to libraries of CUDA?
Asked by 七小丘人 on 2019-02-22 06:02:55 UTC
Comments
Please don't use screenshots: you can copy-paste text into your question and use the Preformatted Text button (the one with
101010
) to format it properly. You seem to have lots of unneeded dependencies and you miss one on package darknet_ros_msgs. It might help if you also post the full error.Asked by aPonza on 2019-02-22 06:30:31 UTC
Thank you. I have replaced the picture and added darknet_ros_msgs, but the mistake is still there. Then I delete darknet_ros and it works though I don't know why. I thought darknet_ros was a package and darknet_ros_msgs was just a directory.
Asked by 七小丘人 on 2019-02-22 08:26:04 UTC
Yep, as it is right now, your package should compile just fine with only roscpp and darknet_ros_msgs dependencies. It's a bit complicated to figure out dependencies, this helped me a lot.
Asked by aPonza on 2019-02-22 09:01:25 UTC
Thank you.
Asked by 七小丘人 on 2019-02-24 22:14:24 UTC
I have the same problem. How did you solve it?
Asked by Astronaut on 2020-03-03 23:22:22 UTC