Unable to find ros/ros.h

asked 2023-03-30 17:13:53 -0500

djt777 gravatar image

Hello all,

My program cannot find the ros.h library.

I'm working on a project that uses this code for an object detector based on this repository: https://github.com/enazoe/yolo-tensorrt

When I try to compile it with catkin build I get this error.

dylan@desktop:~/Desktop/noeticws$ catkin build
-----------------------------------------------------------------
Profile:                     default
Extending:          [cached] /opt/ros/noetic
Workspace:                   /home/dylan/Desktop/noeticws
-----------------------------------------------------------------
Build Space:        [exists] /home/dylan/Desktop/noeticws/build
Devel Space:        [exists] /home/dylan/Desktop/noeticws/devel
Install Space:      [unused] /home/dylan/Desktop/noeticws/install
Log Space:          [exists] /home/dylan/Desktop/noeticws/logs
Source Space:       [exists] /home/dylan/Desktop/noeticws/src
DESTDIR:            [unused] None
-----------------------------------------------------------------

    Devel Space Layout:          linked
    Install Space Layout:        None
    -----------------------------------------------------------------
Additional CMake Args:       None
Additional Make Args:        None
Additional catkin Make Args: None
Internal Make Job Server:    True
Cache Job Environments:      False
-----------------------------------------------------------------
Buildlisted Packages:        None
Skiplisted Packages:         None
-----------------------------------------------------------------
Workspace configuration appears valid.
-----------------------------------------------------------------
[build] Found 1 packages in 0.0 seconds.                                                                                                                              
[build] Package table is up to date.                                                                                                                                  
Starting  >>> vision                                                                                                                                                  
______________________________________________________________________________________________________________________________________________________________________
Errors     << vision:make /home/dylan/Desktop/noeticws/logs/vision/build.make.003.log                                                                                 
/home/dylan/Desktop/noeticws/src/vision/src/samples/sample_detector.cpp:8:10: fatal error: ros/ros.h: No such file or directory
    8 | #include "ros/ros.h"
      |          ^~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/yolo-trt.dir/build.make:63: CMakeFiles/yolo-trt.dir/src/samples/sample_detector.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:157: CMakeFiles/yolo-trt.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
cd /home/dylan/Desktop/noeticws/build/vision; catkin build --get-env vision | catkin env -si  /usr/bin/make --jobserver-auth=3,4; cd -

......................................................................................................................................................................
Failed     << vision:make           [ Exited with code 2 ]                                                                                                            
Failed    <<< vision                [ 0.2 seconds ]                                                                                                                   
[build] Summary: 0 of 1 packages succeeded.                                                                                                                           
[build]   Ignored:   None.                                                                                                                                            
[build]   Warnings:  None.                                                                                                                                            
[build]   Abandoned: None.                                                                                                                                            
[build]   Failed:    1 packages failed.                                                                                                                               
[build] Runtime: 0.2 seconds total.

This is the code

 #include "class_timer.hpp"
#include "class_detector.h"
#include <opencv2/core.hpp>
#include <opencv2/videoio.hpp>
#include <opencv2/highgui.hpp>
#include <memory>
#include <thread>
#include "ros/ros.h"



int main()
{
    Config config_v3;
    config_v3.net_type = YOLOV3;
    config_v3.file_model_cfg = "../configs/yolov3.cfg";
    config_v3.file_model_weights = "../configs/yolov3.weights";
    config_v3.calibration_image_list_file_txt = "../configs/calibration_images.txt";
    config_v3.inference_precison =FP32;
    config_v3.detect_thresh = 0.5;


    Config config_v4;
    config_v4.net_type = YOLOV4;
    config_v4.file_model_cfg = "../configs/yolov4.cfg";
    config_v4.file_model_weights = "../configs/yolov4.weights";
    config_v4.calibration_image_list_file_txt = "../configs/calibration_images.txt";
    config_v4.inference_precison = FP32;
config_v4.detect_thresh = 0.5;

Config config_v4_tiny;
config_v4_tiny.net_type = YOLOV4_TINY;
config_v4_tiny.detect_thresh = 0.5;
config_v4_tiny.file_model_cfg = "../configs/yolov4-tiny-synth-mk1.cfg";
config_v4_tiny.file_model_weights = "../configs/yolov4-tiny-synth-mk1.weights";
config_v4_tiny.calibration_image_list_file_txt = "../configs/calibration_images.txt";
config_v4_tiny.inference_precison = FP16;

Config config_v5;
config_v5.net_type = YOLOV5;
config_v5.detect_thresh = 0.5;
config_v5.file_model_cfg = "../configs/yolov5-5.0/yolov5s6.cfg";
config_v5.file_model_weights = "../configs/yolov5-5.0/yolov5s6.weights";
config_v5.calibration_image_list_file_txt = "../configs/calibration_images.txt";
config_v5.inference_precison = FP32;

std::unique_ptr<Detector> detector(new Detector());
detector->init(config_v4_tiny);

cv::VideoCapture cap(0);
cv::Mat frame;


//cv::Mat image0 = cv::imread("../configs/cardinal2.jpg", cv::IMREAD_UNCHANGED);
//cv::Mat image1 = cv::imread("../configs/cardinal2.jpg", cv::IMREAD_UNCHANGED);
std::vector<BatchResult> batch_res;
Timer timer;
while(cap.read(frame))
    {
        //prepare batch data
        std::vector<cv::Mat> batch_img ...
(more)
edit retag flag offensive close merge delete