Compiling the SpireCV-ROS Interface
1. First, install the SpireCV SDK.
1 min read · English documentation-
First, install the SpireCV SDK.
-
Install ROS. ROS is already installed if you installed Prometheus first.
-
Run the following commands.
git clone -b prometheus_gazebo https://gitee.com/amovlab1/spirecvkitros.git
# Rename the downloaded spirecvkitros folder to spirecv-ros.
Because CUDA 12 and TensorRT have changed, the corresponding CMakeLists.txt used for compilation must also be modified. The main changes are to link TensorRT using link_directories(/home/amov/TensorRT-8.6.1.6/targets/x86_64-linux-gnu/lib) and add nvinfer to the targets. We recommend replacing the entire contents of CMakeLists.txt with the following:
cmake_minimum_required(VERSION 2.8.3)
project(spirecv_ros)
find_package(catkin REQUIRED COMPONENTS
message_generation
roscpp
geometry_msgs
actionlib_msgs
sensor_msgs
nav_msgs
std_msgs
std_srvs
tf2_ros
tf2_eigen
spirecv_msgs
image_transport
cv_bridge
)
catkin_package(
CATKIN_DEPENDS
message_runtime
actionlib_msgs
geometry_msgs
sensor_msgs
message_runtime
std_msgs
)
find_package(SpireCV REQUIRED)
find_package(OpenCV 4 REQUIRED)
message(STATUS "SpireCV library status:")
message(STATUS " include path: ${SV_INCLUDE_DIRS}")
include_directories(
include
${catkin_INCLUDE_DIRS}
${SV_INCLUDE_DIRS}
)
link_directories(/home/amov/TensorRT-8.6.1.6/targets/x86_64-linux-gnu/lib)
add_executable(web_cam
samples/web_cam.cpp
)
target_link_libraries(web_cam ${catkin_LIBRARIES} ${SV_LIBRARIES} nvinfer)
add_executable(saving_image_with_airborne_info
samples/saving_image_with_airborne_info.cpp
)
target_link_libraries(saving_image_with_airborne_info ${catkin_LIBRARIES} ${SV_LIBRARIES} nvinfer)
add_executable(common_object_detection
samples/mipi/common_object_detection.cpp
)
target_link_libraries(common_object_detection ${catkin_LIBRARIES} ${SV_LIBRARIES} nvinfer)
add_executable(common_object_detection_gimbal
samples/g1/common_object_detection_with_gimbal.cpp
)
target_link_libraries(common_object_detection_gimbal ${catkin_LIBRARIES} ${SV_LIBRARIES} nvinfer )
add_executable(ellipse_detection
samples/mipi/ellipse_detection.cpp
)
target_link_libraries(ellipse_detection ${catkin_LIBRARIES} ${SV_LIBRARIES} nvinfer )
add_executable(ellipse_detection_gimbal
samples/g1/ellipse_detection_with_gimbal.cpp
)
target_link_libraries(ellipse_detection_gimbal ${catkin_LIBRARIES} ${SV_LIBRARIES} nvinfer )
add_executable(landing_marker_detection
samples/mipi/landing_marker_detection.cpp
)
target_link_libraries(landing_marker_detection ${catkin_LIBRARIES} ${SV_LIBRARIES} nvinfer )
add_executable(landing_marker_detection_gimbal
samples/g1/landing_marker_detection_with_gimbal.cpp
)
target_link_libraries(landing_marker_detection_gimbal ${catkin_LIBRARIES} ${SV_LIBRARIES} nvinfer )
add_executable(single_object_tracking
samples/mipi/single_object_tracking.cpp
)
target_link_libraries(single_object_tracking ${catkin_LIBRARIES} ${SV_LIBRARIES} nvinfer)
add_executable(single_object_tracking_gimbal
samples/g1/single_object_tracking_with_gimbal.cpp
)
target_link_libraries(single_object_tracking_gimbal ${catkin_LIBRARIES} ${SV_LIBRARIES} nvinfer )
add_executable(aruco_detection
samples/mipi/aruco_detection.cpp
)
target_link_libraries(aruco_detection ${catkin_LIBRARIES} ${SV_LIBRARIES} nvinfer )
add_executable(aruco_detection_with_gimbal
samples/g1/aruco_detection_with_gimbal.cpp
)
target_link_libraries(aruco_detection_with_gimbal ${catkin_LIBRARIES} ${SV_LIBRARIES} nvinfer )
add_executable(common_detection_tracking_with_gimbal
samples/g1/common_detection_tracking_with_gimbal.cpp
)
target_link_libraries(common_detection_tracking_with_gimbal ${catkin_LIBRARIES} ${SV_LIBRARIES} nvinfer)
add_executable(common_detection_tracking
samples/mipi/common_object_detection_tracking.cpp
)
target_link_libraries(common_detection_tracking ${catkin_LIBRARIES} ${SV_LIBRARIES} nvinfer )
#add_executable(veri_with_gimbal
# samples/g1/veri_with_gimbal.cpp
#)
#target_link_libraries(veri_with_gimbal ${catkin_LIBRARIES} ${SV_LIBRARIES})
#add_executable(veri
# samples/mipi/veri.cpp
#)
#target_link_libraries(veri ${catkin_LIBRARIES} ${SV_LIBRARIES})
add_executable(sample_gimbal_node
samples/sample_gimbal_node.cpp
)
target_link_libraries(sample_gimbal_node ${catkin_LIBRARIES} ${SV_LIBRARIES} nvinfer)
add_executable(car_detection_with_d435i
samples/gazebo/car_detection_tracking_with_d435i.cpp
)
target_link_libraries(car_detection_with_d435i ${catkin_LIBRARIES} ${SV_LIBRARIES} nvinfer)
add_executable(aruco_detection_with_d435i
samples/gazebo/aruco_detection_with_d435i.cpp
)
target_link_libraries(aruco_detection_with_d435i ${catkin_LIBRARIES} ${SV_LIBRARIES} nvinfer)

cd spirecv-ros
chmod +x build.sh
./build.sh
# Add it to the startup commands.
echo "source ~/spirecv-ros/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc
Its location should be similar to the following:
source /opt/ros/noetic/setup.bash
source /home/amov/prometheus_mavros/devel/setup.bash
source ~/Prometheus/devel/setup.bash
source ~/spirecv-ros/devel/setup.bash
export GAZEBO_PLUGIN_PATH=$GAZEBO_PLUGIN_PATH:~/Prometheus/devel/lib
export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:~/Prometheus/Simulator/gazebo_simulator/gazebo_models/uav_models
export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:~/Prometheus/Simulator/gazebo_simulator/gazebo_models/ugv_models
export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:~/Prometheus/Simulator/gazebo_simulator/gazebo_models/sensor_models
export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:~/Prometheus/Simulator/gazebo_simulator/gazebo_models/scene_models
export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:~/Prometheus/Simulator/gazebo_simulator/gazebo_models/texture
